A pub workspace of the Dart packages Halkyon's apps share: halkyon_ui, Halkyon's look (the theme, fonts, layout and shared widgets, with texts in English and German), halkyon_core's low-level primitives and halkyon_interop's cross-app contracts. Dart 3.13 with LeanCode's lints, configured once at the root; apps take a package by git, pinned to a signed commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
53 lines
1.9 KiB
Dart
53 lines
1.9 KiB
Dart
import 'dart:typed_data';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:halkyon_ui/halkyon_ui.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
|
|
import '../support/test_app.dart';
|
|
|
|
/// A transparent PNG of one pixel, standing in for an app's icon.
|
|
final _icon = MemoryImage(
|
|
Uint8List.fromList(const [
|
|
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, //
|
|
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
|
|
0x08, 0x06, 0x00, 0x00, 0x00, 0x1F, 0x15, 0xC4, 0x89, 0x00, 0x00, 0x00,
|
|
0x0D, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9C, 0x63, 0x00, 0x01, 0x00, 0x00,
|
|
0x05, 0x00, 0x01, 0x0D, 0x0A, 0x2D, 0xB4, 0x00, 0x00, 0x00, 0x00, 0x49,
|
|
0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82,
|
|
]),
|
|
);
|
|
|
|
void main() {
|
|
testWidgets("shows the app's icon, and \"Halkyon\" over the app's word, "
|
|
"read out as the app's name", (tester) async {
|
|
await tester.pumpWidget(
|
|
testApp(LaunchScreen(icon: _icon, product: 'Todo', name: 'Halkyon Todo')),
|
|
);
|
|
|
|
expect(find.byType(Image), findsOneWidget);
|
|
final brand = tester.getRect(find.text('Halkyon'));
|
|
final product = tester.getRect(find.text('Todo'));
|
|
expect(product.top, greaterThanOrEqualTo(brand.bottom - 1));
|
|
expect(product.center.dx, moreOrLessEquals(brand.center.dx));
|
|
expect(find.bySemanticsLabel('Halkyon Todo'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('the wordmark is cobalt over copper, and silent to screen '
|
|
'readers', (tester) async {
|
|
await tester.pumpWidget(
|
|
testApp(const Scaffold(body: BrandWordmark(product: 'Train'))),
|
|
);
|
|
|
|
final scheme = appTheme(Brightness.light).colorScheme;
|
|
expect(
|
|
tester.widget<Text>(find.text('Halkyon')).style?.color,
|
|
scheme.primary,
|
|
);
|
|
expect(
|
|
tester.widget<Text>(find.text('Train')).style?.color,
|
|
scheme.tertiary,
|
|
);
|
|
expect(find.bySemanticsLabel('Train'), findsNothing);
|
|
});
|
|
}
|