Files
pipelines/app/test/features/templates/ui/template_layout_test.dart
T
alan 1db273894c Remove Cupertino template branches
Keep the Material-only template implementation and narrow its tests to the runtime path. Retain public Cupertino parameters for compatibility while removing unreachable hosts, widgets, and test variants.
2026-11-11 02:53:23 +00:00

63 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/templates/screen.dart';
import 'package:pipelines_app/features/templates/ui/template_gallery.dart';
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
import '../data/template_test_support.dart' show source;
import 'template_gallery_test_support.dart';
/// The gallery and an open template on a wide window: the column stops at the
/// Settings reading width, start-aligned; the bar names the open template and
/// the Create action is a compact button, not a full-width bar.
void main() {
testWidgets('rows and detail are capped at 720 on a wide window', (
tester,
) async {
final gateway = GalleryGateway(
(type, fields) async => templatesReply(galleryTemplates),
);
await pumpGallery(tester, gateway, size: const Size(1200, 800));
final row = tester.getRect(find.byKey(templateRowKey('release')));
expect(row.left, 0);
expect(row.width, templatesContentMaxWidth);
expect(find.text('Templates'), findsOneWidget);
await tester.tap(find.byKey(templateRowKey('release')));
await tester.pumpAndSettle();
final bar = find.byType(SegmentedBar);
expect(
find.descendant(of: bar, matching: find.text('Release workflow')),
findsOneWidget,
);
expect(find.text('Templates'), findsNothing);
final create = tester.getRect(find.byKey(templateCreateActionKey));
expect(create.left, 16);
// Its own width, not stretched across the 688 content column.
expect(create.width, lessThan(templatesContentMaxWidth - 32));
final body = tester.getRect(selectableSource(source));
expect(body.right, lessThanOrEqualTo(templatesContentMaxWidth));
expect(tester.takeException(), isNull);
});
testWidgets('the detail fits 320 at 2x text', (tester) async {
final gateway = GalleryGateway(
(type, fields) async => templatesReply(galleryTemplates),
);
await pumpGallery(
tester,
gateway,
size: const Size(320, 800),
textScale: 2,
);
expect(tester.takeException(), isNull);
await tester.tap(find.byKey(templateRowKey('release')));
await tester.pumpAndSettle();
expect(find.byKey(templateCreateActionKey), findsOneWidget);
expect(tester.takeException(), isNull);
});
}