Skip to content

Commit d9061bd

Browse files
committed
Added test for download progress
1 parent 8c9affe commit d9061bd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

flutter_cache_manager/test/image_cache_manager_test.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:io';
2+
import 'dart:math';
23
import 'dart:typed_data';
34
import 'dart:ui';
45

@@ -99,6 +100,22 @@ void main() {
99100
expect(result, isNotNull);
100101
config.verifyDownloadCall();
101102
});
103+
104+
test('Downloads should give progress', () async {
105+
var config = await setupConfig(cacheKey: 'resized_w100_h150_$fileUrl');
106+
var cacheManager = TestCacheManager(config);
107+
var results = await cacheManager
108+
.getImageFile(
109+
fileUrl,
110+
maxWidth: 100,
111+
maxHeight: 80,
112+
withProgress: true,
113+
)
114+
.toList();
115+
var progress = results.whereType<DownloadProgress>().toList();
116+
config.verifyDownloadCall();
117+
expect(progress, isNotEmpty);
118+
});
102119
});
103120
}
104121

0 commit comments

Comments
 (0)