test(ui): extend the small-phone overflow guard (about, intro, profile)
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.
This commit is contained in:
parent
2c33172ba4
commit
d89ee64bc7
1 changed files with 72 additions and 0 deletions
|
|
@ -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<void> 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue