Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Goldens update darkmode status #3016

Merged
merged 4 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/smooth_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ packages:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.3.1"
built_collection:
dependency: transitive
description:
Expand Down Expand Up @@ -209,7 +209,7 @@ packages:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.0"
version: "4.3.0"
collection:
dependency: "direct main"
description:
Expand All @@ -223,7 +223,7 @@ packages:
name: connectivity_plus
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.6+1"
version: "2.3.7"
connectivity_plus_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -272,7 +272,7 @@ packages:
name: cross_file
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.3+1"
version: "0.3.3+2"
crypto:
dependency: transitive
description:
Expand Down Expand Up @@ -1231,7 +1231,7 @@ packages:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
version: "1.2.3"
source_span:
dependency: transitive
description:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 19 additions & 13 deletions packages/smooth_app/test/pages/user_preferences_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import '../tests_utils/mocks.dart';
void main() {
group('UserPreferencesPage looks as expected', () {
for (final bool themeDark in <bool>[true, false]) {
final String theme = themeDark ? 'dark' : 'light';
final String theme = themeDark ? 'Dark' : 'Light';

testWidgets(theme, (WidgetTester tester) async {
// Override & mock out HTTP Requests
Expand All @@ -28,12 +28,12 @@ void main() {
late ThemeProvider themeProvider;

SharedPreferences.setMockInitialValues(
mockSharedPreferences(
themeDark: themeDark,
),
mockSharedPreferences(),
);

userPreferences = await UserPreferences.getUserPreferences();
userPreferences.setTheme(theme);

productPreferences = ProductPreferences(ProductPreferencesSelection(
setImportance: userPreferences.setImportance,
getImportance: userPreferences.getImportance,
Expand All @@ -43,17 +43,23 @@ void main() {
await userPreferences.init(productPreferences);
themeProvider = ThemeProvider(userPreferences);

await tester.pumpWidget(MockSmoothApp(
userPreferences,
UserManagementProvider(),
productPreferences,
themeProvider,
const UserPreferencesPage(),
));
await tester.pumpWidget(
MockSmoothApp(
userPreferences,
UserManagementProvider(),
productPreferences,
themeProvider,
const UserPreferencesPage(),
),
);
await tester.pump();

await expectGoldenMatches(find.byType(UserPreferencesPage),
'user_preferences_page-$theme.png');
// We need to lowercase the theme, as on some platforms
// the name is always lowercase
await expectGoldenMatches(
find.byType(UserPreferencesPage),
'user_preferences_page-${theme.toLowerCase()}.png',
);
expect(tester, meetsGuideline(textContrastGuideline));
expect(tester, meetsGuideline(labeledTapTargetGuideline));
expect(tester, meetsGuideline(iOSTapTargetGuideline));
Expand Down
1 change: 0 additions & 1 deletion packages/smooth_app/test/tests_utils/mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class MockSmoothApp extends StatelessWidget {
}

Map<String, Object> mockSharedPreferences({
Color color = Colors.lightBlue,
bool init = true,
bool themeDark = false,
}) =>
Expand Down