Apply a Material 3 seed-green palette and rounded components across the home, inventory, quick-add, quantity picker and variety-detail screens. The full-screen photo viewer can now set any photo as the cover (via attachment sort order) and delete after confirmation. Lot forms and packaging surface as choice chips. Extract About out of Settings into its own screen (app version via package_info_plus, website link). Add es/en strings for the new lot types, presentation, home tagline and About. Update Seedees v2 mockups.
83 lines
2.5 KiB
Dart
83 lines
2.5 KiB
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/app.dart';
|
|
import 'package:tane/i18n/strings.g.dart';
|
|
|
|
import '../support/test_support.dart';
|
|
|
|
void main() {
|
|
Widget app(db) => TranslationProvider(
|
|
child: TaneApp(
|
|
repository: newTestRepository(db),
|
|
species: newTestSpeciesRepository(db),
|
|
),
|
|
);
|
|
|
|
setUp(() {
|
|
PackageInfo.setMockInitialValues(
|
|
appName: 'Tanemaki',
|
|
packageName: 'org.comunes.tane',
|
|
version: '0.1.0',
|
|
buildNumber: '1',
|
|
buildSignature: '',
|
|
);
|
|
});
|
|
|
|
testWidgets('Settings About tile opens the About screen', (tester) async {
|
|
LocaleSettings.setLocaleSync(AppLocale.en);
|
|
final db = newTestDatabase();
|
|
addTearDown(db.close);
|
|
|
|
await tester.pumpWidget(app(db));
|
|
await tester.pumpAndSettle();
|
|
|
|
await tester.tap(find.byIcon(Icons.menu));
|
|
await tester.pumpAndSettle();
|
|
await tester.tap(find.text('Settings'));
|
|
await tester.pumpAndSettle();
|
|
|
|
await tester.tap(find.text('About Tanemaki'));
|
|
await tester.pumpAndSettle();
|
|
|
|
// Explanation text and kanji are shown above the fold.
|
|
expect(find.text('種まき'), findsOneWidget);
|
|
expect(
|
|
find.textContaining('helps people and collectives'),
|
|
findsOneWidget,
|
|
);
|
|
expect(find.textContaining('digital Plantare'), findsOneWidget);
|
|
|
|
// License and version live below the fold; scroll them into view.
|
|
await tester.scrollUntilVisible(find.text('AGPL-3.0'), 200);
|
|
expect(find.text('AGPL-3.0'), findsOneWidget);
|
|
expect(find.text('0.1.0 (1)'), findsOneWidget);
|
|
await disposeTree(tester);
|
|
});
|
|
|
|
testWidgets('About screen opens the open-source licenses page', (
|
|
tester,
|
|
) async {
|
|
LocaleSettings.setLocaleSync(AppLocale.en);
|
|
final db = newTestDatabase();
|
|
addTearDown(db.close);
|
|
|
|
await tester.pumpWidget(app(db));
|
|
await tester.pumpAndSettle();
|
|
|
|
await tester.tap(find.byIcon(Icons.menu));
|
|
await tester.pumpAndSettle();
|
|
await tester.tap(find.text('Settings'));
|
|
await tester.pumpAndSettle();
|
|
await tester.tap(find.text('About Tanemaki'));
|
|
await tester.pumpAndSettle();
|
|
|
|
await tester.scrollUntilVisible(find.text('Open-source licenses'), 200);
|
|
await tester.tap(find.text('Open-source licenses'));
|
|
await tester.pumpAndSettle();
|
|
|
|
// Flutter's built-in LicensePage renders the app name.
|
|
expect(find.byType(LicensePage), findsOneWidget);
|
|
await disposeTree(tester);
|
|
});
|
|
}
|