What Learn and Todo each held now comes from halkyon_app: - AccountTiles: whose account on which instance, switching, signing out (asking first for an anonymous account, as it deletes it) and deleting it (asking first), the app's own words passed in. - showAppAbout: the app's name, version, icon and legalese as it gives them, the source of what the instance runs (AppDependencies gains sourceCodeUrl), the app's own parts, the licence list. - resolveAppLocale: the first preferred language the app speaks, never by country alone, British English otherwise. - AssetCountryNames, the default of InstanceGate and InstanceScope: Unicode CLDR 48.2's territory names in English and German (tool/country_names.py, 7.6 KB), Hong Kong, Macao, Myanmar and Palestine by their short names as Learn's world map has them, so Todo says "Germany (EU)" where it said "DE (EU)". Learn's texts read as before in every language; its About bloc and gateway, its country names from the world map and the keys only the moved code used are gone, as are Todo's copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
84 lines
2.5 KiB
Dart
84 lines
2.5 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:halkyon_app/halkyon_app.dart';
|
|
import 'package:halkyon_app/testing.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
|
|
void main() {
|
|
late TestAppDependencies dependencies;
|
|
|
|
setUp(() => dependencies = TestAppDependencies());
|
|
|
|
/// Opens About from a button, with [version], [legalese] and [children]
|
|
/// as the app gives them.
|
|
Future<void> open(
|
|
WidgetTester tester, {
|
|
String? version,
|
|
String? legalese,
|
|
List<Widget> children = const [],
|
|
Locale locale = const Locale('en'),
|
|
}) async {
|
|
await tester.pumpWidget(
|
|
testApp(
|
|
Builder(
|
|
builder: (context) => TextButton(
|
|
onPressed: () => showAppAbout(
|
|
context,
|
|
version: version,
|
|
legalese: legalese,
|
|
children: children,
|
|
),
|
|
child: const Text('About'),
|
|
),
|
|
),
|
|
dependencies: dependencies,
|
|
locale: locale,
|
|
),
|
|
);
|
|
await tester.tap(find.text('About'));
|
|
await tester.pumpAndSettle();
|
|
}
|
|
|
|
testWidgets('names the app and where the source of what the instance runs '
|
|
'is, which both licences require offering', (tester) async {
|
|
await open(tester);
|
|
|
|
expect(find.text('Halkyon Test'), findsWidgets);
|
|
expect(find.text('The source of what this instance runs:'), findsOneWidget);
|
|
expect(find.text('https://code.example.org/halkyon'), findsOneWidget);
|
|
// Flutter's own button to every package's notice.
|
|
expect(find.text('View licenses'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets("says so when the instance can't be asked", (tester) async {
|
|
dependencies.sourceCodeError = Exception('No connection');
|
|
await open(tester);
|
|
|
|
expect(
|
|
find.text("Couldn't reach this instance to ask where its source is."),
|
|
findsOneWidget,
|
|
);
|
|
});
|
|
|
|
testWidgets("shows the app's version, legalese and own parts where it "
|
|
'gives them', (tester) async {
|
|
await open(
|
|
tester,
|
|
version: '0.18.0',
|
|
legalese: 'Free software.',
|
|
children: const [Text('Data in the app')],
|
|
);
|
|
|
|
expect(find.text('0.18.0'), findsOneWidget);
|
|
expect(find.text('Free software.'), findsOneWidget);
|
|
expect(find.text('Data in the app'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('speaks German', (tester) async {
|
|
await open(tester, locale: const Locale('de'));
|
|
|
|
expect(
|
|
find.text('Der Quellcode dessen, was diese Instanz ausführt:'),
|
|
findsOneWidget,
|
|
);
|
|
});
|
|
}
|