Skip to content

Commit

Permalink
fix: image tests (AppFlowy-IO#6928)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 authored Dec 9, 2024
1 parent 3b56887 commit e0885e2
Showing 1 changed file with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ import 'package:run_with_network_images/run_with_network_images.dart';
import '../../shared/mock/mock_file_picker.dart';
import '../../shared/util.dart';

const _testImageUrls = [
'https://images.unsplash.com/photo-1469474968028-56623f02e42e?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&dl=david-marcu-78A265wPiO4-unsplash.jpg&w=640',
'https://www.easygifanimator.net/images/samples/eglite.gif',
'https://people.math.sc.edu/Burkardt/data/bmp/snail.bmp',
'https://file-examples.com/storage/fe9566cb7d67345489a5a97/2017/10/file_example_JPG_100kB.jpg',
];

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
TestWidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -138,11 +131,33 @@ void main() {
file.deleteSync();
});

for (final url in _testImageUrls) {
testWidgets('insert an image from network: $url', (tester) async {
await testEmbedImage(tester, url);
});
}
testWidgets('insert a gif image from network', (tester) async {
await testEmbedImage(
tester,
'https://www.easygifanimator.net/images/samples/sparkles.gif',
);
});

testWidgets('insert a jpg image from network', (tester) async {
await testEmbedImage(
tester,
'https://file-examples.com/storage/fe9566cb7d67345489a5a97/2017/10/file_example_JPG_100kB.jpg',
);
});

testWidgets('insert a bmp image from network', (tester) async {
await testEmbedImage(
tester,
'https://people.math.sc.edu/Burkardt/data/bmp/snail.bmp',
);
});

testWidgets('insert a jpg image from network', (tester) async {
await testEmbedImage(
tester,
'https://images.unsplash.com/photo-1469474968028-56623f02e42e?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&dl=david-marcu-78A265wPiO4-unsplash.jpg&w=640',
);
});

testWidgets('insert an image from unsplash', (tester) async {
await runWithNetworkImages(() async {
Expand Down

0 comments on commit e0885e2

Please sign in to comment.