utils/kuhy_credit/flutter/test/kuhy_credit_layout_test.dart
Krzysztof kuhy Rudnicki 2352c17723
Some checks are pending
file length / file-length (push) Waiting to run
kuhy_credit drift / drift (push) Waiting to run
kuhy_credit tests / python (push) Waiting to run
kuhy_credit tests / web (push) Waiting to run
kuhy_credit tests / flutter (push) Waiting to run
kuhy_credit tests / godot (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
kuhy_credit: keep logo size in stretching parents
A ListView child got the full row width; the painter scaled the dark
field across the row and the glyph left the clip, so the logo was
invisible in punchme's settings. Loosen constraints at the root and
scale by the short side. Release 0.3.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 09:03:27 +01:00

28 lines
989 B
Dart

import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:kuhy_credit/kuhy_credit.dart';
void main() {
testWidgets('a stretching parent (ListView) keeps the logo at its size', (
tester,
) async {
await tester.pumpWidget(
WidgetsApp(
color: const Color(kDarkBg),
pageRouteBuilder: <T>(settings, builder) => PageRouteBuilder<T>(
settings: settings,
pageBuilder: (context, _, _) => builder(context),
),
home: ListView(children: const [KuhyCredit(size: 40)]),
),
);
final logo = find.byKey(KuhyCredit.logoKey);
expect(tester.getSize(logo), const Size(40, 40));
// The tap target shrank with the logo: the row's far end opens nothing.
final row = tester.getRect(find.byType(KuhyCredit));
await tester.tapAt(row.centerRight - const Offset(4, 0));
await tester.pumpAndSettle();
expect(find.byKey(KuhyCredit.panelKey), findsNothing);
});
}