From 76556f782b842a9298e5fb02391f599c6418156a Mon Sep 17 00:00:00 2001 From: vjrj Date: Sat, 11 Jul 2026 00:59:57 +0200 Subject: [PATCH] test(ui): extend the small-phone overflow guard (about, intro, profile) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds about, intro and the profile screen (identity card + Save button) to the 320x568 overflow guard across es/pt/ast. All pass — these screens already fit small phones; the guard now protects them from regressions. 15 cases green. --- .../test/ui/small_screen_overflow_test.dart | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/apps/app_seeds/test/ui/small_screen_overflow_test.dart b/apps/app_seeds/test/ui/small_screen_overflow_test.dart index 1c70f40..41be17a 100644 --- a/apps/app_seeds/test/ui/small_screen_overflow_test.dart +++ b/apps/app_seeds/test/ui/small_screen_overflow_test.dart @@ -1,10 +1,19 @@ import 'package:commons_core/commons_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:package_info_plus/package_info_plus.dart'; import 'package:tane/db/enums.dart'; import 'package:tane/i18n/strings.g.dart'; +import 'package:tane/services/profile_store.dart'; +import 'package:tane/services/social_account_store.dart'; +import 'package:tane/services/social_connection.dart'; +import 'package:tane/services/social_service.dart'; +import 'package:tane/services/social_settings.dart'; +import 'package:tane/ui/about_screen.dart'; import 'package:tane/ui/home_screen.dart'; +import 'package:tane/ui/intro_screen.dart'; import 'package:tane/ui/inventory_list_screen.dart'; +import 'package:tane/ui/profile_screen.dart'; import 'package:tane/ui/settings_screen.dart'; import '../support/test_support.dart'; @@ -26,6 +35,14 @@ void main() { // The locales whose strings are longest — English rarely overflows first. const longLocales = [AppLocale.es, AppLocale.pt, AppLocale.ast]; + setUpAll(() => PackageInfo.setMockInitialValues( + appName: 'Tanemaki', + packageName: 'org.comunes.tane', + version: '0.1.0', + buildNumber: '1', + buildSignature: '', + )); + Future pumpSmall(WidgetTester tester, Widget widget) async { tester.view.physicalSize = small; tester.view.devicePixelRatio = 1.0; @@ -65,8 +82,63 @@ void main() { ); await disposeTree(tester); }); + + testWidgets('about (title, version, license) fits ($tag)', (tester) async { + final db = newTestDatabase(); + addTearDown(db.close); + await pumpSmall( + tester, + wrapScreen( + repository: newTestRepository(db), + locale: locale, + child: const AboutScreen(), + ), + ); + await disposeTree(tester); + }); + + testWidgets('the intro carousel fits ($tag)', (tester) async { + final db = newTestDatabase(); + addTearDown(db.close); + await pumpSmall( + tester, + wrapScreen( + repository: newTestRepository(db), + locale: locale, + child: IntroScreen(onDone: () {}), + ), + ); + await disposeTree(tester); + }); } + testWidgets('profile (identity card + save button) fits a small screen', + (tester) async { + final db = newTestDatabase(); + addTearDown(db.close); + final social = await SocialService.fromRootSeedHex('00' * 32); + final connection = SocialConnection( + social: social, + settings: SocialSettings(InMemorySecretStore()), + open: (_) async => throw StateError('offline'), + online: const Stream.empty(), + ); + await pumpSmall( + tester, + wrapScreen( + repository: newTestRepository(db), + locale: AppLocale.es, + child: ProfileScreen( + social: social, + connection: connection, + profileStore: ProfileStore(InMemorySecretStore()), + accounts: SocialAccountStore(InMemorySecretStore()), + ), + ), + ); + await disposeTree(tester); + }); + testWidgets('inventory (empty) fits a small screen', (tester) async { final db = newTestDatabase(); addTearDown(db.close);