A popup menu is width-capped at ~280px, so the full-sentence German entries in the audit overflow menu ran past the edge. The clipped tail of the reset entry was exactly the "(nur local/dev)" scope that keeps it from reading as "delete evidence", and the label's centre landed outside the hit box. Guard in responsive_test: the page-level overflow sweep cannot see popup menus (their width does not follow the window), which is why this went unnoticed. Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
125 lines
4.2 KiB
Dart
125 lines
4.2 KiB
Dart
// Responsive sweep: every sidebar page must lay out without
|
|
// RenderFlex/RenderBox overflow at the window sizes operators
|
|
// actually use — a small laptop split-screen, the macOS default
|
|
// window, and a full HD display. Overflow errors surface as test
|
|
// failures via FlutterError.onError, so a regression in any page's
|
|
// layout at any of these sizes fails this suite.
|
|
//
|
|
// Navigation mirrors sidebar_test.dart (fixed pumps; the app never
|
|
// "settles" because of long-lived timers).
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:chain_studio/data/hub.dart';
|
|
import 'package:chain_studio/main.dart';
|
|
|
|
import 'support/fake_hub.dart';
|
|
|
|
const _destinations = <String>[
|
|
'welcome',
|
|
'store',
|
|
'doctor',
|
|
'flows',
|
|
'audit',
|
|
'approvals',
|
|
'runs',
|
|
'federation',
|
|
];
|
|
|
|
const _sizes = <String, Size>{
|
|
'tiny (800x600)': Size(800, 600),
|
|
'small (960x600)': Size(960, 600),
|
|
'default (1280x800)': Size(1280, 800),
|
|
'large (1920x1080)': Size(1920, 1080),
|
|
};
|
|
|
|
void main() {
|
|
for (final entry in _sizes.entries) {
|
|
testWidgets('all pages lay out without overflow — ${entry.key}',
|
|
(tester) async {
|
|
// Hermetic: pages render against the scriptable fake, never a
|
|
// hub that happens to listen on the operator's machine.
|
|
installFakeHub();
|
|
tester.view.physicalSize = entry.value;
|
|
tester.view.devicePixelRatio = 1.0;
|
|
addTearDown(tester.view.reset);
|
|
|
|
await tester.pumpWidget(
|
|
const StudioApp(
|
|
initialThemeMode: ThemeModeValue.dark,
|
|
initialLocale: Locale('de'),
|
|
),
|
|
);
|
|
await tester.pump(const Duration(milliseconds: 100));
|
|
|
|
for (final id in _destinations) {
|
|
// The destinations list scrolls by design: at 600-px-high
|
|
// windows the rail (destinations + search row + footer)
|
|
// exceeds the viewport, so bring the item into view first.
|
|
final item = find.byKey(ValueKey('sidebar-item-$id'));
|
|
await tester.scrollUntilVisible(item, 40,
|
|
scrollable: find.byType(Scrollable).first);
|
|
await tester.tap(item);
|
|
await tester.pump(const Duration(milliseconds: 400));
|
|
expect(
|
|
tester.takeException(),
|
|
isNull,
|
|
reason: 'page "$id" at ${entry.key} threw during layout',
|
|
);
|
|
}
|
|
});
|
|
}
|
|
|
|
// Popup menus have a hard width cap (~280px) that no window size
|
|
// relaxes, so the page sweep above cannot see them overflow. The
|
|
// audit overflow menu spells its entries out in full German
|
|
// sentences — unwrapped, the tail was clipped, and on the reset
|
|
// entry the clipped tail was the "(nur local/dev)" that keeps it
|
|
// from reading as "delete evidence".
|
|
testWidgets('audit overflow-menu entries wrap instead of overflowing', (
|
|
tester,
|
|
) async {
|
|
installFakeHub();
|
|
tester.view.physicalSize = const Size(1280, 800);
|
|
tester.view.devicePixelRatio = 1.0;
|
|
addTearDown(tester.view.reset);
|
|
|
|
await tester.pumpWidget(
|
|
const StudioApp(
|
|
initialThemeMode: ThemeModeValue.dark,
|
|
initialLocale: Locale('de'),
|
|
),
|
|
);
|
|
await tester.pump(const Duration(milliseconds: 100));
|
|
await tester.tap(find.byKey(const ValueKey('sidebar-item-audit')));
|
|
await tester.pump(const Duration(milliseconds: 400));
|
|
|
|
await tester.tap(find.byTooltip('Weitere Aktionen'));
|
|
for (var i = 0; i < 6; i++) {
|
|
await tester.pump(const Duration(milliseconds: 200));
|
|
}
|
|
expect(
|
|
tester.takeException(),
|
|
isNull,
|
|
reason: 'the audit overflow menu threw during layout',
|
|
);
|
|
|
|
// Every entry stays inside the menu it belongs to — a label
|
|
// that overruns is not just ugly, it is unreadable and unhittable.
|
|
final menu = tester.getRect(find.byType(PopupMenuItem<String>).first);
|
|
for (final label in find.byType(PopupMenuItem<String>).evaluate()) {
|
|
final text = find.descendant(
|
|
of: find.byWidget(label.widget),
|
|
matching: find.byType(Text),
|
|
);
|
|
expect(
|
|
tester.getRect(text).right,
|
|
lessThanOrEqualTo(menu.right + 0.5),
|
|
reason: 'menu label runs past the menu edge',
|
|
);
|
|
}
|
|
|
|
await tester.pumpWidget(const SizedBox.shrink());
|
|
await tester.pump(const Duration(minutes: 1));
|
|
});
|
|
}
|