Imrpoved image handling since the size of the image is about 5MB.
This commit is contained in:
@@ -35,7 +35,7 @@ void _testDelete(PictureController controller, int response, bool expected) asyn
|
||||
|
||||
when(client.delete(Uri.parse('http://localhost:8080/api/picture/4'), headers: {"Accept-Language": "en-US"})).thenAnswer((_) async => http.Response("", response));
|
||||
|
||||
var dto = await controller.delete(PictureDto(id: 4, image: "", pictureDate: DateTime.now(), category: "", comment: "", evaluation: 1, username: ""));
|
||||
var dto = await controller.delete(PictureDto(id: 4, pictureDate: DateTime.now(), category: "", comment: "", evaluation: 1, username: "", imageUrl: "", normalSizeUrl: "", thumbnailSizeUrl: ""));
|
||||
expect(dto, expected);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -12,9 +12,6 @@ import 'package:mockito/mockito.dart';
|
||||
import '../testing/test_utils.dart';
|
||||
import '../testing/test_utils.mocks.dart';
|
||||
|
||||
// Minimal valid base64 encoded 1x1 pixel PNG image
|
||||
const String _testImage = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
DiContainer.instance.initState();
|
||||
@@ -31,30 +28,36 @@ void main() {
|
||||
id: 1,
|
||||
comment: 'First picture comment',
|
||||
category: 'category1',
|
||||
image: _testImage,
|
||||
pictureDate: DateTime(2024, 1, 15),
|
||||
username: 'user1',
|
||||
evaluation: 1,
|
||||
imageUrl: "",
|
||||
normalSizeUrl: "",
|
||||
thumbnailSizeUrl: "",
|
||||
);
|
||||
|
||||
pictureDto2 = PictureDto(
|
||||
id: 2,
|
||||
comment: 'Second picture comment',
|
||||
category: 'category2',
|
||||
image: _testImage,
|
||||
pictureDate: DateTime(2024, 2, 20),
|
||||
username: 'user2',
|
||||
evaluation: 1,
|
||||
imageUrl: "",
|
||||
normalSizeUrl: "",
|
||||
thumbnailSizeUrl: "",
|
||||
);
|
||||
|
||||
pictureDto3 = PictureDto(
|
||||
id: 3,
|
||||
comment: null,
|
||||
category: 'category3',
|
||||
image: _testImage,
|
||||
pictureDate: DateTime(2024, 3, 25),
|
||||
username: 'user3',
|
||||
evaluation: 1,
|
||||
imageUrl: "",
|
||||
normalSizeUrl: "",
|
||||
thumbnailSizeUrl: "",
|
||||
);
|
||||
|
||||
customerDto = CustomerDto(
|
||||
@@ -170,10 +173,9 @@ void main() {
|
||||
expect(find.text('First picture comment'), findsOneWidget);
|
||||
|
||||
// Tap right navigation button
|
||||
print(find.byKey(Key("navigate_right")));
|
||||
await tester.tap(find.byKey(Key("navigate_right")));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
|
||||
// Verify second picture comment is now shown
|
||||
expect(find.text('Second picture comment'), findsOneWidget);
|
||||
expect(find.text('First picture comment'), findsNothing);
|
||||
|
||||
Reference in New Issue
Block a user