Search results and pill span the pane; lock stage page to the full detail pane
Remove the 840 px Search reading cap (results column and bar pill) so both fill the pane at Fold and wide widths. Add a width test for the stage page at 880 and 1400 and deep-link/query flags to the search probe entry.
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
||||
import 'package:pipelines_app/shell/adaptive_shell.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
import 'package:pipelines_app/shell/detail_page.dart';
|
||||
import 'package:pipelines_app/shell/list_detail.dart';
|
||||
import 'package:pipelines_app/ui/layout/sticky_section.dart';
|
||||
|
||||
import '../features/runs/ui/run_detail_graph_support.dart';
|
||||
import '../features/runs/ui/run_detail_visit_support.dart';
|
||||
|
||||
/// The stage page opened from a run's Timeline fills the detail pane edge to
|
||||
/// edge at an unfolded foldable's width and on a wide window: its content
|
||||
/// spans the pane minus the page's own padding, with no reading-width cap.
|
||||
void main() {
|
||||
Future<void> openStagePage(
|
||||
WidgetTester tester, {
|
||||
required bool cupertino,
|
||||
required Size size,
|
||||
}) async {
|
||||
tester.view.physicalSize = size;
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final gateway = RunDetailFakeGateway(visitRunFixture());
|
||||
final controller = RunsController(RunsRepository(gateway));
|
||||
addTearDown(controller.dispose);
|
||||
await controller.select(77);
|
||||
final shell = AdaptiveShell(
|
||||
cupertino: cupertino,
|
||||
destination: AppDestination.runs,
|
||||
destinationBodies: {
|
||||
AppDestination.runs: (_) => ListDetailPanes(
|
||||
list: ListView(children: const [Text('run row 0')]),
|
||||
detail: DetailPane(
|
||||
destination: AppDestination.runs,
|
||||
implyBack: false,
|
||||
builder: (_) => RunDetailView(
|
||||
controller: controller,
|
||||
gateway: gateway,
|
||||
onBack: () {},
|
||||
),
|
||||
),
|
||||
),
|
||||
},
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(home: shell)
|
||||
: MaterialApp(
|
||||
theme: ThemeData(platform: TargetPlatform.android),
|
||||
home: shell,
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
await openRunDetailTab(tester, RunDetailTab.timeline);
|
||||
final row = find.byKey(const ValueKey('run-timeline-visit-1'));
|
||||
await tester.ensureVisible(row);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(row);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
for (final cupertino in [false, true]) {
|
||||
final host = cupertino ? 'Cupertino' : 'Material';
|
||||
for (final size in const [Size(880, 1000), Size(1400, 900)]) {
|
||||
testWidgets('$host ${size.width.toInt()}: the stage page spans the '
|
||||
'detail pane edge to edge', (tester) async {
|
||||
await openStagePage(tester, cupertino: cupertino, size: size);
|
||||
expect(find.byKey(const Key('run-visit-back')), findsOneWidget);
|
||||
final body = tester.getRect(
|
||||
find.byKey(const ValueKey('list-detail-body')),
|
||||
);
|
||||
// The pane is the detail's whole share of the window, up to its
|
||||
// right edge.
|
||||
expect(body.right, size.width);
|
||||
final pane = tester.getRect(find.byKey(const Key('run-visit-pane')));
|
||||
expect(pane.left, body.left);
|
||||
expect(pane.right, body.right);
|
||||
// The facts block and the Input and Output sections span the whole
|
||||
// pane; only the page's own padding insets their content.
|
||||
final facts = tester.getRect(find.byKey(const Key('run-visit-facts')));
|
||||
expect(facts.left, body.left);
|
||||
expect(facts.right, body.right);
|
||||
final titles = find.descendant(
|
||||
of: find.byKey(const Key('run-visit-pane')),
|
||||
matching: find.byType(StickySectionTitle),
|
||||
);
|
||||
expect(titles, findsNWidgets(2));
|
||||
for (final title in tester.widgetList(titles)) {
|
||||
final rect = tester.getRect(find.byWidget(title));
|
||||
expect(rect.left, body.left);
|
||||
expect(rect.right, body.right);
|
||||
}
|
||||
// The heading starts at the page padding and the chevron ends at it.
|
||||
final input = tester.getRect(
|
||||
find.descendant(of: titles.first, matching: find.text('Input')),
|
||||
);
|
||||
expect(input.left, body.left + 16);
|
||||
final chevron = tester.getRect(
|
||||
find.descendant(of: titles.first, matching: find.byType(Icon)).last,
|
||||
);
|
||||
expect(chevron.right, closeTo(body.right - 8, 0.5));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user