Skip to content

Commit 235943b

Browse files
committed
wip: add png image bytes for mock
1 parent 67b3b74 commit 235943b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

example/lib/mock_project_db.dart

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ class MockProjectDb implements ProjectDb {
8282
..text = "log_20221202_000000"
8383
];
8484

85+
// 1x1 transparent pixel
86+
// https://github.com/flutter/flutter/blob/master/packages/flutter_test/test/goldens_test.dart#L14-L20
87+
Uint8List pngBytes = Uint8List.fromList([
88+
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0,
89+
1, 0, 0, 0, 1, 8, 6, 0, 0, 0, 31, 21, 196, 137, 0, 0, 0, 11, 73, 68, 65, 84,
90+
120, 1, 99, 97, 0, 2, 0, 0, 25, 0, 5, 144, 240, 54, 245, 0, 0, 0, 0, 73, 69,
91+
78, 68, 174, 66, 96, 130, // avoid flutter format
92+
]);
93+
8594
@override
8695
String getPath() {
8796
return "mock/path";
@@ -145,22 +154,22 @@ class MockProjectDb implements ProjectDb {
145154

146155
@override
147156
Image? getThumbnail(int imageDataId) {
148-
return null;
157+
return Image.memory(pngBytes);
149158
}
150159

151160
@override
152161
Uint8List? getThumbnailBytes(int imageDataId) {
153-
return null;
162+
return pngBytes;
154163
}
155164

156165
@override
157166
Image? getImage(int imageDataId) {
158-
return null;
167+
return Image.memory(pngBytes);
159168
}
160169

161170
@override
162171
Uint8List? getImageDataBytes(int imageDataId) {
163-
return null;
172+
return pngBytes;
164173
}
165174

166175
@override

0 commit comments

Comments
 (0)