9bdabb32d9
Keep the Material-only shell path while preserving public cupertino parameters for callers. Narrow matching tests to Material hosts and behavior because the app always runs under MaterialApp.
38 lines
1.5 KiB
Dart
38 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/shell/destination.dart';
|
|
import 'package:pipelines_app/shell/empty_detail_pane.dart';
|
|
|
|
/// One placeholder for an empty detail pane: the destination's icon above a
|
|
/// short muted line, centred.
|
|
void main() {
|
|
for (final destination in [
|
|
AppDestination.runs,
|
|
AppDestination.chat,
|
|
AppDestination.pipelines,
|
|
]) {
|
|
testWidgets('${destination.name}: icon over a muted line', (tester) async {
|
|
final content = EmptyDetailPane(
|
|
destination: destination,
|
|
message: 'Select one to open it here.',
|
|
);
|
|
await tester.pumpWidget(MaterialApp(home: Scaffold(body: content)));
|
|
final icon = find.byIcon(destinationDetails(destination).icon);
|
|
expect(icon, findsOneWidget);
|
|
final text = find.text('Select one to open it here.');
|
|
expect(
|
|
tester.getTopLeft(text).dy,
|
|
greaterThan(tester.getRect(icon).bottom),
|
|
);
|
|
// Centred in the pane.
|
|
final size = tester.view.physicalSize / tester.view.devicePixelRatio;
|
|
expect(tester.getCenter(text).dx, closeTo(size.width / 2, 1));
|
|
// Muted: the same secondary colour on the icon and the line.
|
|
final context = tester.element(text);
|
|
final muted = Theme.of(context).colorScheme.onSurfaceVariant;
|
|
expect(tester.widget<Icon>(icon).color, muted);
|
|
expect(tester.widget<Text>(text).style?.color, muted);
|
|
});
|
|
}
|
|
}
|