Skip to content

Commit

Permalink
wip: add png image bytes for mock
Browse files Browse the repository at this point in the history
  • Loading branch information
sanak committed Dec 2, 2022
1 parent c2c5f39 commit 2d0d913
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions example/lib/mock_project_db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ class MockProjectDb implements ProjectDb {
..text = "log_20221202_000000"
];

// 1x1 transparent pixel
// https://github.com/flutter/flutter/blob/master/packages/flutter_test/test/goldens_test.dart#L14-L20
Uint8List pngBytes = Uint8List.fromList([
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0,
1, 0, 0, 0, 1, 8, 6, 0, 0, 0, 31, 21, 196, 137, 0, 0, 0, 11, 73, 68, 65, 84,
120, 1, 99, 97, 0, 2, 0, 0, 25, 0, 5, 144, 240, 54, 245, 0, 0, 0, 0, 73, 69,
78, 68, 174, 66, 96, 130, // avoid flutter format
]);

@override
String getPath() {
return "mock/path";
Expand Down Expand Up @@ -145,22 +154,22 @@ class MockProjectDb implements ProjectDb {

@override
Image? getThumbnail(int imageDataId) {
return null;
return Image.memory(pngBytes);
}

@override
Uint8List? getThumbnailBytes(int imageDataId) {
return null;
return pngBytes;
}

@override
Image? getImage(int imageDataId) {
return null;
return Image.memory(pngBytes);
}

@override
Uint8List? getImageDataBytes(int imageDataId) {
return null;
return pngBytes;
}

@override
Expand Down

0 comments on commit 2d0d913

Please sign in to comment.