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>
64 lines
1.7 KiB
Dart
64 lines
1.7 KiB
Dart
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';
|
|
|
|
void main() {
|
|
/// Pumps [child] under a screen tint, in a medium window, so a gradient
|
|
/// in it claims its colour while in view.
|
|
Future<ScreenTint> show(WidgetTester tester, {required bool visible}) async {
|
|
tester.view.physicalSize = const Size(800, 600);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.reset);
|
|
final tint = ScreenTint();
|
|
addTearDown(tint.dispose);
|
|
await tester.pumpWidget(
|
|
testApp(
|
|
ScreenTintScope(
|
|
notifier: tint,
|
|
child: TabVisibility(
|
|
visible: visible,
|
|
child: const TopGradient(
|
|
color: Color(0xFFBA1E55),
|
|
background: Color(0xFFFFFFFF),
|
|
child: SizedBox.expand(),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pump();
|
|
return tint;
|
|
}
|
|
|
|
testWidgets('a screen whose tab shows gives the frame its colour', (
|
|
tester,
|
|
) async {
|
|
final tint = await show(tester, visible: true);
|
|
|
|
expect(tint.color, const Color(0xFFBA1E55));
|
|
});
|
|
|
|
testWidgets("a hidden tab's screen leaves the frame's colour alone", (
|
|
tester,
|
|
) async {
|
|
final tint = await show(tester, visible: false);
|
|
|
|
expect(tint.color, Brand.primary);
|
|
});
|
|
|
|
testWidgets('outside any tabs, a screen counts as shown', (tester) async {
|
|
late bool visible;
|
|
await tester.pumpWidget(
|
|
Builder(
|
|
builder: (context) {
|
|
visible = TabVisibility.of(context);
|
|
return const SizedBox();
|
|
},
|
|
),
|
|
);
|
|
|
|
expect(visible, isTrue);
|
|
});
|
|
}
|