diff --git a/app/test/homework/homework_dialog_bloc_test.dart b/app/test/homework/homework_dialog_bloc_test.dart index 0307a5416..d4e6a3935 100644 --- a/app/test/homework/homework_dialog_bloc_test.dart +++ b/app/test/homework/homework_dialog_bloc_test.dart @@ -448,6 +448,17 @@ class FakeLocalFile extends LocalFile { required this.mimeType, }); + factory FakeLocalFile.empty({String name = '', MimeType? mimeType}) { + return FakeLocalFile._( + file: null, + fileData: Uint8List(0), + sizeBytes: 0, + path: null, + mimeType: null, + fileName: name, + ); + } + factory FakeLocalFile.fromData( Uint8List data, String? path, String name, String? type) { return FakeLocalFile._( diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.iphone11.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.iphone11.png new file mode 100644 index 000000000..293afff63 Binary files /dev/null and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.iphone11.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.phone.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.phone.png new file mode 100644 index 000000000..a32168b6e Binary files /dev/null and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.phone.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.phone_landscape.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.phone_landscape.png new file mode 100644 index 000000000..3a4de40a0 Binary files /dev/null and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.phone_landscape.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.tablet_landscape.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.tablet_landscape.png new file mode 100644 index 000000000..98180eb25 Binary files /dev/null and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.tablet_landscape.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.tablet_portrait.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.tablet_portrait.png new file mode 100644 index 000000000..befeaeaa2 Binary files /dev/null and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_dark.tablet_portrait.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.iphone11.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.iphone11.png new file mode 100644 index 000000000..3caf2fdf9 Binary files /dev/null and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.iphone11.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.phone.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.phone.png new file mode 100644 index 000000000..be356d28f Binary files /dev/null and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.phone.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.phone_landscape.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.phone_landscape.png new file mode 100644 index 000000000..664d57efa Binary files /dev/null and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.phone_landscape.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.tablet_landscape.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.tablet_landscape.png new file mode 100644 index 000000000..15efba4e1 Binary files /dev/null and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.tablet_landscape.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.tablet_portrait.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.tablet_portrait.png new file mode 100644 index 000000000..e92c5f7ad Binary files /dev/null and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_add_filled_1_light.tablet_portrait.png differ diff --git a/app/test_goldens/homework/homework_dialog/homework_dialog_test.dart b/app/test_goldens/homework/homework_dialog/homework_dialog_test.dart index 055959dfd..09ac1eb27 100644 --- a/app/test_goldens/homework/homework_dialog/homework_dialog_test.dart +++ b/app/test_goldens/homework/homework_dialog/homework_dialog_test.dart @@ -7,6 +7,11 @@ // SPDX-License-Identifier: EUPL-1.2 import 'package:bloc_test/bloc_test.dart'; +import 'package:common_domain_models/common_domain_models.dart'; +import 'package:date/date.dart'; +import 'package:fast_immutable_collections/fast_immutable_collections.dart'; +import 'package:files_basics/files_models.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart' as bloc_lib; import 'package:flutter_test/flutter_test.dart'; @@ -15,6 +20,8 @@ import 'package:sharezone/blocs/homework/homework_dialog_bloc.dart'; import 'package:sharezone/pages/homework/homework_dialog.dart'; import 'package:sharezone_widgets/sharezone_widgets.dart'; +import '../../../test/homework/homework_dialog_bloc_test.dart'; + // ignore_for_file: invalid_use_of_visible_for_testing_member class MockHomeworkDialogBloc @@ -77,6 +84,61 @@ void main() { 'homework_dialog_add_empty_dark', ); }); + + testGoldens('renders filled create homework dialog as expected', + (tester) async { + final state = Ready( + title: 'S. 32 8a)', + course: CourseChosen( + courseId: CourseId('maths'), + courseName: 'Maths', + isChangeable: true, + ), + dueDate: Date('2023-10-12'), + submissions: const SubmissionsDisabled(isChangeable: false), + description: 'Das ist eine Beschreibung', + attachments: IList([ + FileView( + fileId: FileId('foo'), + fileName: 'foo.png', + format: FileFormat.image, + localFile: FakeLocalFile.empty(name: 'foo.png'), + ), + FileView( + fileId: FileId('bar'), + fileName: 'bar.pdf', + format: FileFormat.pdf, + localFile: FakeLocalFile.empty(name: 'bar.pdf'), + ), + ]), + notifyCourseMembers: false, + isPrivate: (true, isChangeable: true), + hasModifiedData: true, + isEditing: false, + ); + + whenListen( + homeworkDialogBloc, + Stream.value(state), + initialState: state, + ); + + await pumpAndSettleHomeworkDialog(tester, + isEditing: false, theme: lightTheme); + + await multiScreenGolden( + tester, + 'homework_dialog_add_filled_1_light', + ); + + await pumpAndSettleHomeworkDialog(tester, + isEditing: false, theme: darkTheme); + + await multiScreenGolden( + tester, + 'homework_dialog_add_filled_1_dark', + ); + }); }); }