73 lines
2.6 KiB
Dart
73 lines
2.6 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() {
|
|
for (final cupertino in [false, true]) {
|
|
final host = cupertino ? 'Cupertino' : 'Material';
|
|
|
|
testWidgets('$host: 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,
|
|
cupertino: cupertino,
|
|
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('$host: the detail fits 320 at 2x text', (tester) async {
|
|
final gateway = GalleryGateway(
|
|
(type, fields) async => templatesReply(galleryTemplates),
|
|
);
|
|
await pumpGallery(
|
|
tester,
|
|
gateway,
|
|
cupertino: cupertino,
|
|
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);
|
|
});
|
|
}
|
|
}
|