diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.iphone11.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.iphone11.png new file mode 100644 index 000000000..0bae37b22 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.iphone11.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.phone.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.phone.png new file mode 100644 index 000000000..09016b167 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.phone.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.phone_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.phone_landscape.png new file mode 100644 index 000000000..15758e61a Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.phone_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.tablet_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.tablet_landscape.png new file mode 100644 index 000000000..fe43d92b8 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.tablet_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.tablet_portrait.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.tablet_portrait.png new file mode 100644 index 000000000..a5fc77231 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_dark.tablet_portrait.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.iphone11.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.iphone11.png new file mode 100644 index 000000000..918311bab Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.iphone11.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.phone.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.phone.png new file mode 100644 index 000000000..1cb8a732d Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.phone.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.phone_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.phone_landscape.png new file mode 100644 index 000000000..0a0ccd87b Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.phone_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.tablet_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.tablet_landscape.png new file mode 100644 index 000000000..d442e12fa Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.tablet_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.tablet_portrait.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.tablet_portrait.png new file mode 100644 index 000000000..c1e14ea44 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_error_light.tablet_portrait.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.iphone11.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.iphone11.png new file mode 100644 index 000000000..5a49e961f Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.iphone11.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.phone.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.phone.png new file mode 100644 index 000000000..5c7f0d967 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.phone.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.phone_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.phone_landscape.png new file mode 100644 index 000000000..b3fbb59cf Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.phone_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.tablet_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.tablet_landscape.png new file mode 100644 index 000000000..a54120b95 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.tablet_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.tablet_portrait.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.tablet_portrait.png new file mode 100644 index 000000000..02c2c97a3 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_dark.tablet_portrait.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.iphone11.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.iphone11.png new file mode 100644 index 000000000..fe6b1e8ac Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.iphone11.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.phone.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.phone.png new file mode 100644 index 000000000..06b68344f Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.phone.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.phone_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.phone_landscape.png new file mode 100644 index 000000000..d7583cec5 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.phone_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.tablet_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.tablet_landscape.png new file mode 100644 index 000000000..f2eb845a4 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.tablet_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.tablet_portrait.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.tablet_portrait.png new file mode 100644 index 000000000..734779417 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_loading_light.tablet_portrait.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.iphone11.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.iphone11.png new file mode 100644 index 000000000..e1ed00068 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.iphone11.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.phone.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.phone.png new file mode 100644 index 000000000..594bba968 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.phone.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.phone_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.phone_landscape.png new file mode 100644 index 000000000..01c875f41 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.phone_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.tablet_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.tablet_landscape.png new file mode 100644 index 000000000..36a39a3b7 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.tablet_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.tablet_portrait.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.tablet_portrait.png new file mode 100644 index 000000000..efe2cb0ba Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_dark.tablet_portrait.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.iphone11.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.iphone11.png new file mode 100644 index 000000000..a2cf45996 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.iphone11.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.phone.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.phone.png new file mode 100644 index 000000000..07d8dfcbe Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.phone.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.phone_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.phone_landscape.png new file mode 100644 index 000000000..b5f8ddeae Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.phone_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.tablet_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.tablet_landscape.png new file mode 100644 index 000000000..33fab6d9b Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.tablet_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.tablet_portrait.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.tablet_portrait.png new file mode 100644 index 000000000..26adbb809 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_page_with_data_2_light.tablet_portrait.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.iphone11.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.iphone11.png new file mode 100644 index 000000000..28eb4f692 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.iphone11.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.phone.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.phone.png new file mode 100644 index 000000000..dd5d16f76 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.phone.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.phone_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.phone_landscape.png new file mode 100644 index 000000000..5d0dd6641 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.phone_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.tablet_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.tablet_landscape.png new file mode 100644 index 000000000..6852860b2 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.tablet_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.tablet_portrait.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.tablet_portrait.png new file mode 100644 index 000000000..e4b48749e Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_dark.tablet_portrait.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.iphone11.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.iphone11.png new file mode 100644 index 000000000..cee76f601 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.iphone11.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.phone.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.phone.png new file mode 100644 index 000000000..18cde1392 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.phone.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.phone_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.phone_landscape.png new file mode 100644 index 000000000..9271519a1 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.phone_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.tablet_landscape.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.tablet_landscape.png new file mode 100644 index 000000000..145d5ef64 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.tablet_landscape.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.tablet_portrait.png b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.tablet_portrait.png new file mode 100644 index 000000000..734ad70b3 Binary files /dev/null and b/app/test_goldens/grades/pages/term_settings_page/goldens/terms_settings_with_data_1_light.tablet_portrait.png differ diff --git a/app/test_goldens/grades/pages/term_settings_page/term_settings_page_test.dart b/app/test_goldens/grades/pages/term_settings_page/term_settings_page_test.dart new file mode 100644 index 000000000..c92fd484f --- /dev/null +++ b/app/test_goldens/grades/pages/term_settings_page/term_settings_page_test.dart @@ -0,0 +1,212 @@ +// Copyright (c) 2024 Sharezone UG (haftungsbeschränkt) +// Licensed under the EUPL-1.2-or-later. +// +// You may obtain a copy of the Licence at: +// https://joinup.ec.europa.eu/software/page/eupl +// +// SPDX-License-Identifier: EUPL-1.2 + +import 'dart:math'; + +import 'package:design/design.dart'; +import 'package:fast_immutable_collections/fast_immutable_collections.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:golden_toolkit/golden_toolkit.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:provider/provider.dart'; +import 'package:sharezone/grades/grades_service/grades_service.dart'; +import 'package:sharezone/grades/pages/term_settings_page/term_settings_page.dart'; +import 'package:sharezone/grades/pages/term_settings_page/term_settings_page_controller.dart'; +import 'package:sharezone/grades/pages/term_settings_page/term_settings_page_controller_factory.dart'; +import 'package:sharezone/grades/pages/term_settings_page/term_settings_page_view.dart'; +import 'package:sharezone_widgets/sharezone_widgets.dart'; + +import 'term_settings_page_test.mocks.dart'; + +@GenerateNiceMocks([ + MockSpec(), + MockSpec(), +]) +void main() { + group(TermSettingsPage, () { + const termId = TermId('term-1'); + late TermSettingsPageController controller; + late TermSettingsPageControllerFactory controllerFactory; + + setUp(() { + controller = MockTermSettingsPageController(); + controllerFactory = MockTermSettingsPageControllerFactory(); + when(controllerFactory.create(termId)).thenReturn(controller); + }); + + void setState(TermSettingsState state) { + // Mockito does not support mocking sealed classes yet, so we have to + // provide a dummy implementation of the state. + // + // Ticket: https://github.com/dart-lang/mockito/issues/675 + provideDummy(state); + when(controller.state).thenReturn(state); + } + + void setLoaded2() { + final random = Random(35); + setState( + TermSettingsLoaded( + TermSettingsPageView( + name: '11/23', + isActiveTerm: true, + gradingSystem: GradingSystem.zeroToFifteenPoints, + finalGradeType: GradeType.writtenExam, + selectableGradingTypes: const IListConst([]), + weights: IMapConst({ + GradeType.writtenExam.id: const Weight.factor(2), + GradeType.oralParticipation.id: const Weight.factor(.5), + GradeType.presentation.id: const Weight.factor(1), + }), + subjects: IListConst([ + ( + displayName: 'Deutsch', + abbreviation: 'DE', + design: Design.random(random), + id: const SubjectId('d'), + weight: const Weight.factor(1), + ), + ( + displayName: 'Englisch', + abbreviation: 'E', + design: Design.random(random), + id: const SubjectId('e'), + weight: const Weight.factor(2), + ), + ]), + ), + ), + ); + } + + void setLoaded1() { + final random = Random(42); + setState( + TermSettingsLoaded( + TermSettingsPageView( + name: '10/22', + isActiveTerm: true, + gradingSystem: GradingSystem.oneToSixWithPlusAndMinus, + finalGradeType: GradeType.schoolReportGrade, + selectableGradingTypes: const IListConst([]), + weights: IMapConst({ + GradeType.writtenExam.id: const Weight.factor(2), + GradeType.oralParticipation.id: const Weight.factor(.5), + GradeType.presentation.id: const Weight.factor(1), + }), + subjects: IListConst([ + ( + displayName: 'Deutsch', + abbreviation: 'DE', + design: Design.random(random), + id: const SubjectId('d'), + weight: const Weight.factor(1), + ), + ( + displayName: 'Englisch', + abbreviation: 'E', + design: Design.random(random), + id: const SubjectId('e'), + weight: const Weight.factor(2), + ), + ]), + ), + ), + ); + } + + void setError() { + setState(const TermSettingsError('An error occurred.')); + } + + void setLoading() { + setState(const TermSettingsLoading()); + } + + Future pushTermSettingsPage( + WidgetTester tester, ThemeData theme) async { + await tester.pumpWidgetBuilder( + MultiProvider(providers: [ + Provider( + create: (_) => GradesService(), + ), + Provider.value( + value: controllerFactory, + ), + ChangeNotifierProvider.value( + value: controller, + ), + ], child: const TermSettingsPage(termId: termId)), + wrapper: materialAppWrapper(theme: theme), + ); + } + + group('empty', () { + testGoldens('renders as expected (light mode)', (tester) async { + setLoaded1(); + await pushTermSettingsPage(tester, getLightTheme()); + await multiScreenGolden(tester, 'terms_settings_with_data_1_light'); + }); + + testGoldens('renders as expected (dark mode)', (tester) async { + setLoaded1(); + await pushTermSettingsPage(tester, getDarkTheme()); + await multiScreenGolden(tester, 'terms_settings_with_data_1_dark'); + }); + }); + + group('with data', () { + testGoldens('renders as expected (light mode)', (tester) async { + setLoaded2(); + await pushTermSettingsPage(tester, getLightTheme()); + await multiScreenGolden( + tester, 'terms_settings_page_with_data_2_light'); + }); + + testGoldens('renders as expected (dark mode)', (tester) async { + setLoaded2(); + await pushTermSettingsPage(tester, getDarkTheme()); + await multiScreenGolden(tester, 'terms_settings_page_with_data_2_dark'); + }); + }); + + group('error', () { + testGoldens('renders as expected (light mode)', (tester) async { + setError(); + await pushTermSettingsPage(tester, getLightTheme()); + await multiScreenGolden(tester, 'terms_settings_page_error_light'); + }); + + testGoldens('renders as expected (dark mode)', (tester) async { + setError(); + await pushTermSettingsPage(tester, getDarkTheme()); + await multiScreenGolden(tester, 'terms_settings_page_error_dark'); + }); + }); + + group('loading', () { + testGoldens('renders as expected (light mode)', (tester) async { + setLoading(); + await pushTermSettingsPage(tester, getLightTheme()); + await multiScreenGolden(tester, 'terms_settings_page_loading_light', + customPump: (tester) => + tester.pump(const Duration(milliseconds: 100))); + }); + + testGoldens('renders as expected (dark mode)', (tester) async { + setLoading(); + await pushTermSettingsPage(tester, getDarkTheme()); + await multiScreenGolden(tester, 'terms_settings_page_loading_dark', + customPump: (tester) => + tester.pump(const Duration(milliseconds: 100))); + }); + }); + }); +} diff --git a/app/test_goldens/grades/pages/term_settings_page/term_settings_page_test.mocks.dart b/app/test_goldens/grades/pages/term_settings_page/term_settings_page_test.mocks.dart new file mode 100644 index 000000000..c2facb3a9 --- /dev/null +++ b/app/test_goldens/grades/pages/term_settings_page/term_settings_page_test.mocks.dart @@ -0,0 +1,463 @@ +// Mocks generated by Mockito 5.4.4 from annotations +// in sharezone/test_goldens/grades/pages/term_settings_page/term_settings_page_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i6; + +import 'package:fast_immutable_collections/fast_immutable_collections.dart' + as _i3; +import 'package:group_domain_models/group_domain_models.dart' as _i7; +import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i8; +import 'package:sharezone/grades/grades_service/grades_service.dart' as _i2; +import 'package:sharezone/grades/pages/term_settings_page/term_settings_page_controller.dart' + as _i5; +import 'package:sharezone/grades/pages/term_settings_page/term_settings_page_controller_factory.dart' + as _i9; +import 'package:sharezone/grades/pages/term_settings_page/term_settings_page_view.dart' + as _i4; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeGradesService_0 extends _i1.SmartFake implements _i2.GradesService { + _FakeGradesService_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeTermRef_1 extends _i1.SmartFake implements _i2.TermRef { + _FakeTermRef_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeGradeType_2 extends _i1.SmartFake implements _i2.GradeType { + _FakeGradeType_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeIList_3 extends _i1.SmartFake implements _i3.IList { + _FakeIList_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); + + @override + String toString([bool? prettyPrint]) => super.toString(); +} + +class _FakeTermId_4 extends _i1.SmartFake implements _i2.TermId { + _FakeTermId_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeTermSettingsPageView_5 extends _i1.SmartFake + implements _i4.TermSettingsPageView { + _FakeTermSettingsPageView_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeTermSettingsPageController_6 extends _i1.SmartFake + implements _i5.TermSettingsPageController { + _FakeTermSettingsPageController_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [TermSettingsPageController]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTermSettingsPageController extends _i1.Mock + implements _i5.TermSettingsPageController { + @override + _i2.GradesService get gradesService => (super.noSuchMethod( + Invocation.getter(#gradesService), + returnValue: _FakeGradesService_0( + this, + Invocation.getter(#gradesService), + ), + returnValueForMissingStub: _FakeGradesService_0( + this, + Invocation.getter(#gradesService), + ), + ) as _i2.GradesService); + + @override + _i2.TermRef get termRef => (super.noSuchMethod( + Invocation.getter(#termRef), + returnValue: _FakeTermRef_1( + this, + Invocation.getter(#termRef), + ), + returnValueForMissingStub: _FakeTermRef_1( + this, + Invocation.getter(#termRef), + ), + ) as _i2.TermRef); + + @override + _i6.Stream> get coursesStream => (super.noSuchMethod( + Invocation.getter(#coursesStream), + returnValue: _i6.Stream>.empty(), + returnValueForMissingStub: _i6.Stream>.empty(), + ) as _i6.Stream>); + + @override + String get name => (super.noSuchMethod( + Invocation.getter(#name), + returnValue: _i8.dummyValue( + this, + Invocation.getter(#name), + ), + returnValueForMissingStub: _i8.dummyValue( + this, + Invocation.getter(#name), + ), + ) as String); + + @override + set name(String? _name) => super.noSuchMethod( + Invocation.setter( + #name, + _name, + ), + returnValueForMissingStub: null, + ); + + @override + bool get isActiveTerm => (super.noSuchMethod( + Invocation.getter(#isActiveTerm), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + set isActiveTerm(bool? _isActiveTerm) => super.noSuchMethod( + Invocation.setter( + #isActiveTerm, + _isActiveTerm, + ), + returnValueForMissingStub: null, + ); + + @override + _i2.GradingSystem get gradingSystem => (super.noSuchMethod( + Invocation.getter(#gradingSystem), + returnValue: _i2.GradingSystem.oneToSixWithPlusAndMinus, + returnValueForMissingStub: _i2.GradingSystem.oneToSixWithPlusAndMinus, + ) as _i2.GradingSystem); + + @override + set gradingSystem(_i2.GradingSystem? _gradingSystem) => super.noSuchMethod( + Invocation.setter( + #gradingSystem, + _gradingSystem, + ), + returnValueForMissingStub: null, + ); + + @override + _i2.GradeType get finalGradeType => (super.noSuchMethod( + Invocation.getter(#finalGradeType), + returnValue: _FakeGradeType_2( + this, + Invocation.getter(#finalGradeType), + ), + returnValueForMissingStub: _FakeGradeType_2( + this, + Invocation.getter(#finalGradeType), + ), + ) as _i2.GradeType); + + @override + set finalGradeType(_i2.GradeType? _finalGradeType) => super.noSuchMethod( + Invocation.setter( + #finalGradeType, + _finalGradeType, + ), + returnValueForMissingStub: null, + ); + + @override + _i3.IList<_i7.Course> get courses => (super.noSuchMethod( + Invocation.getter(#courses), + returnValue: _FakeIList_3<_i7.Course>( + this, + Invocation.getter(#courses), + ), + returnValueForMissingStub: _FakeIList_3<_i7.Course>( + this, + Invocation.getter(#courses), + ), + ) as _i3.IList<_i7.Course>); + + @override + set courses(_i3.IList<_i7.Course>? _courses) => super.noSuchMethod( + Invocation.setter( + #courses, + _courses, + ), + returnValueForMissingStub: null, + ); + + @override + _i5.TermSettingsState get state => (super.noSuchMethod( + Invocation.getter(#state), + returnValue: _i8.dummyValue<_i5.TermSettingsState>( + this, + Invocation.getter(#state), + ), + returnValueForMissingStub: _i8.dummyValue<_i5.TermSettingsState>( + this, + Invocation.getter(#state), + ), + ) as _i5.TermSettingsState); + + @override + set state(_i5.TermSettingsState? _state) => super.noSuchMethod( + Invocation.setter( + #state, + _state, + ), + returnValueForMissingStub: null, + ); + + @override + _i2.TermId get termId => (super.noSuchMethod( + Invocation.getter(#termId), + returnValue: _FakeTermId_4( + this, + Invocation.getter(#termId), + ), + returnValueForMissingStub: _FakeTermId_4( + this, + Invocation.getter(#termId), + ), + ) as _i2.TermId); + + @override + _i4.TermSettingsPageView get view => (super.noSuchMethod( + Invocation.getter(#view), + returnValue: _FakeTermSettingsPageView_5( + this, + Invocation.getter(#view), + ), + returnValueForMissingStub: _FakeTermSettingsPageView_5( + this, + Invocation.getter(#view), + ), + ) as _i4.TermSettingsPageView); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + void setName(String? name) => super.noSuchMethod( + Invocation.method( + #setName, + [name], + ), + returnValueForMissingStub: null, + ); + + @override + void setIsActiveTerm(bool? isActiveTerm) => super.noSuchMethod( + Invocation.method( + #setIsActiveTerm, + [isActiveTerm], + ), + returnValueForMissingStub: null, + ); + + @override + void setGradingSystem(_i2.GradingSystem? gradingSystem) => super.noSuchMethod( + Invocation.method( + #setGradingSystem, + [gradingSystem], + ), + returnValueForMissingStub: null, + ); + + @override + void setFinalGradeType(_i2.GradeType? gradeType) => super.noSuchMethod( + Invocation.method( + #setFinalGradeType, + [gradeType], + ), + returnValueForMissingStub: null, + ); + + @override + void setGradeWeight( + _i2.GradeTypeId? gradeTypeId, + _i2.Weight? weight, + ) => + super.noSuchMethod( + Invocation.method( + #setGradeWeight, + [ + gradeTypeId, + weight, + ], + ), + returnValueForMissingStub: null, + ); + + @override + void removeGradeType(_i2.GradeTypeId? gradeTypeId) => super.noSuchMethod( + Invocation.method( + #removeGradeType, + [gradeTypeId], + ), + returnValueForMissingStub: null, + ); + + @override + _i6.Future setSubjectWeight( + _i2.SubjectId? subjectId, + _i2.Weight? weight, + ) => + (super.noSuchMethod( + Invocation.method( + #setSubjectWeight, + [ + subjectId, + weight, + ], + ), + returnValue: _i6.Future.value(), + returnValueForMissingStub: _i6.Future.value(), + ) as _i6.Future); + + @override + void dispose() => super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void addListener(dynamic listener) => super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void removeListener(dynamic listener) => super.noSuchMethod( + Invocation.method( + #removeListener, + [listener], + ), + returnValueForMissingStub: null, + ); + + @override + void notifyListeners() => super.noSuchMethod( + Invocation.method( + #notifyListeners, + [], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [TermSettingsPageControllerFactory]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTermSettingsPageControllerFactory extends _i1.Mock + implements _i9.TermSettingsPageControllerFactory { + @override + _i2.GradesService get gradesService => (super.noSuchMethod( + Invocation.getter(#gradesService), + returnValue: _FakeGradesService_0( + this, + Invocation.getter(#gradesService), + ), + returnValueForMissingStub: _FakeGradesService_0( + this, + Invocation.getter(#gradesService), + ), + ) as _i2.GradesService); + + @override + _i6.Stream> Function() get coursesStream => + (super.noSuchMethod( + Invocation.getter(#coursesStream), + returnValue: () => _i6.Stream>.empty(), + returnValueForMissingStub: () => _i6.Stream>.empty(), + ) as _i6.Stream> Function()); + + @override + _i5.TermSettingsPageController create(_i2.TermId? termId) => + (super.noSuchMethod( + Invocation.method( + #create, + [termId], + ), + returnValue: _FakeTermSettingsPageController_6( + this, + Invocation.method( + #create, + [termId], + ), + ), + returnValueForMissingStub: _FakeTermSettingsPageController_6( + this, + Invocation.method( + #create, + [termId], + ), + ), + ) as _i5.TermSettingsPageController); +}