feat(image_compress_utility): adde test for corupted images

This commit is contained in:
misha
2026-04-15 16:27:27 +03:00
parent 03ec91a595
commit c8284338aa

View File

@@ -426,5 +426,27 @@ void main() {
}
}
});
test('compressFile - does not crash on corrupted image', () async {
final file = File('corrupted.jpg');
try {
await file.writeAsBytes([
0xFF, 0xD8, 0xFF, 0xE0,
0x00, 0x10,
0x4A, 0x46, 0x49, 0x46,
0xFF, 0xDA,
]);
final result = await ImageCompressUtility.compressFile(file);
expect(result, isA<File>());
expect(result.path, file.path);
} finally {
if (await file.exists()) {
await file.delete();
}
}
});
});
}