Skip to content

Commit

Permalink
test(android): add simple test to avoid using androidx.core.graphics.…
Browse files Browse the repository at this point in the history
…decodeBitmap
  • Loading branch information
EchoEllet committed Oct 29, 2024
1 parent 24d6d3d commit 2c07d0a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions quill_native_bridge_android/test/bug_fix_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'dart:io';

import 'package:flutter_test/flutter_test.dart';

void main() {
test(
'ensure compatibility by avoiding unresolved image decoder import (See https://github.com/singerdmx/flutter-quill/issues/2340)',
() {
// TODO: Avoid hardcoding the `dev/flutterquill/quill_native_bridge/`
// in here and in pigeons/messages.dart
final targetDirectory = Directory(
'android/src/main/kotlin/dev/flutterquill/quill_native_bridge/');

expect(targetDirectory.existsSync(), isTrue,
reason: 'Target directory does not exist: ${targetDirectory.path}');

for (final entity in targetDirectory.listSync(recursive: true)) {
if (entity is! File) {
continue;
}
final content = entity.readAsStringSync();
expect(
content.contains('import androidx.core.graphics.decodeBitmap'),
isFalse,
reason: 'Compatibility issue detected in ${entity.path}. '
'Avoid using `androidx.core.graphics.decodeBitmap`. '
'For more details, see https://github.com/FlutterQuill/quill-native-bridge/pull/7',
);
}
},
);
}

0 comments on commit 2c07d0a

Please sign in to comment.