Skip to content

Commit

Permalink
test: use ios theme for ios screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
adil192 committed Sep 6, 2024
1 parent a3e5e81 commit 0aa879e
Show file tree
Hide file tree
Showing 42 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/pages/home/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ class _SettingsPageState extends State<SettingsPage> {
),
ToggleButtonsOption(
() {
// Hack to allow screenshot golden tests
if (kDebugMode &&
(Prefs.platform.value == TargetPlatform.iOS ||
Prefs.platform.value == TargetPlatform.macOS))
return Prefs.platform.value.index;
if (usesCupertinoByDefault)
return defaultTargetPlatform.index;
return TargetPlatform.iOS.index;
Expand Down
Binary file modified metadata/cs/images/phoneScreenshots/4_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/cs/images/tenInchScreenshots/4_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/de/images/phoneScreenshots/4_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/de/images/tenInchScreenshots/4_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/macbookScreenshots/1_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/macbookScreenshots/2_editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/macbookScreenshots/3_login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/macbookScreenshots/4_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/newerIpadScreenshots/1_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/newerIpadScreenshots/2_editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/newerIpadScreenshots/3_login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/newerIpadScreenshots/4_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/newerIphoneScreenshots/1_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/newerIphoneScreenshots/2_editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/newerIphoneScreenshots/3_login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/newerIphoneScreenshots/4_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/olderIpadScreenshots/1_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/olderIpadScreenshots/2_editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/olderIpadScreenshots/3_login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/olderIpadScreenshots/4_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/olderIphoneScreenshots/1_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/olderIphoneScreenshots/2_editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/olderIphoneScreenshots/3_login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/olderIphoneScreenshots/4_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/phoneScreenshots/4_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified metadata/en-US/images/tenInchScreenshots/4_settings.png
Binary file modified metadata/es/images/phoneScreenshots/4_settings.png
Binary file modified metadata/es/images/tenInchScreenshots/4_settings.png
Binary file modified metadata/fr/images/phoneScreenshots/4_settings.png
Binary file modified metadata/fr/images/tenInchScreenshots/4_settings.png
Binary file modified metadata/hu/images/phoneScreenshots/4_settings.png
Binary file modified metadata/hu/images/tenInchScreenshots/4_settings.png
Binary file modified metadata/it/images/phoneScreenshots/4_settings.png
Binary file modified metadata/it/images/tenInchScreenshots/4_settings.png
Binary file modified metadata/pt-BR/images/phoneScreenshots/4_settings.png
Binary file modified metadata/pt-BR/images/tenInchScreenshots/4_settings.png
Binary file modified metadata/ru/images/phoneScreenshots/4_settings.png
Binary file modified metadata/ru/images/tenInchScreenshots/4_settings.png
Binary file modified metadata/tr/images/phoneScreenshots/4_settings.png
Binary file modified metadata/tr/images/tenInchScreenshots/4_settings.png
13 changes: 13 additions & 0 deletions test/screenshot_goldens_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ void main() {
textTheme: GoogleFonts.interTextTheme().withFallbacks(),
scaffoldBackgroundColor: colorScheme.surface,
);
final cupertinoTheme = ThemeData(
colorScheme: colorScheme,
textTheme: GoogleFonts.interTextTheme().withFallbacks(),
scaffoldBackgroundColor: colorScheme.surface,
platform: TargetPlatform.iOS,
);
final yaruVariant = YaruBuilder.findClosestYaruVariant(colorScheme.primary);
final yaruTheme = YaruThemeData(variant: yaruVariant, useMaterial3: true);

Expand All @@ -105,12 +111,14 @@ void main() {
_screenshot(
frameColors: homeFrameColors,
materialTheme: materialTheme,
cupertinoTheme: cupertinoTheme,
yaruTheme: yaruTheme,
goldenFileName: '1_home',
child: const HomePage(subpage: HomePage.recentSubpage, path: ''),
);
_screenshot(
materialTheme: materialTheme,
cupertinoTheme: cupertinoTheme,
yaruTheme: yaruTheme,
goldenFileName: '2_editor',
child: Editor(
Expand All @@ -119,6 +127,7 @@ void main() {
);
_screenshot(
materialTheme: materialTheme,
cupertinoTheme: cupertinoTheme,
yaruTheme: yaruTheme,
goldenFileName: '3_login',
child: const NcLoginPage(
Expand All @@ -128,6 +137,7 @@ void main() {
_screenshot(
frameColors: homeFrameColors,
materialTheme: materialTheme,
cupertinoTheme: cupertinoTheme,
yaruTheme: yaruTheme,
goldenFileName: '4_settings',
child: const HomePage(subpage: HomePage.settingsSubpage, path: ''),
Expand All @@ -138,6 +148,7 @@ void main() {
void _screenshot({
ScreenshotFrameColors? frameColors,
required ThemeData materialTheme,
required ThemeData cupertinoTheme,
required YaruThemeData yaruTheme,
required String goldenFileName,
required Widget child,
Expand Down Expand Up @@ -176,6 +187,7 @@ void _screenshot({
for (final (localeCode, goldenDevice) in localeDeviceMatrix) {
testWidgets('for ${goldenDevice.name} in $localeCode', (tester) async {
final device = goldenDevice.device;
Prefs.platform.value = device.platform;
LocaleSettings.setLocaleRaw(localeCode);

debugDisableShadows = false;
Expand All @@ -188,6 +200,7 @@ void _screenshot({
final widget = ScreenshotApp(
theme: switch (device.platform) {
TargetPlatform.linux => yaruTheme.theme,
TargetPlatform.iOS || TargetPlatform.macOS => cupertinoTheme,
_ => materialTheme,
},
device: device,
Expand Down

0 comments on commit 0aa879e

Please sign in to comment.