d1b05217c9
Keep the pipeline feature on its existing Material path because the app runs under MaterialApp and never selects Cupertino hosts. Preserve public cupertino parameters and required Cupertino icon values for later cleanup and shared controls.
77 lines
2.7 KiB
Dart
77 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/pipelines/widgets/pipeline_tabs.dart';
|
|
import 'package:pipelines_app/features/pipelines/widgets/pipeline_detail_styles.dart';
|
|
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
|
|
|
|
void main() {
|
|
testWidgets('code-like values still use native host typography', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: Scaffold(
|
|
body: Builder(
|
|
builder: (context) {
|
|
expect(
|
|
pipelineValueStyle(context, monospace: true),
|
|
Theme.of(context).textTheme.bodyMedium,
|
|
);
|
|
return const SizedBox.shrink();
|
|
},
|
|
),
|
|
),
|
|
),
|
|
);
|
|
});
|
|
|
|
for (final width in [320.0, 390.0, 720.0, 1200.0]) {
|
|
testWidgets('floating tabs at $width, 2x', (tester) async {
|
|
tester.view.physicalSize = Size(width, 640);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.reset);
|
|
PipelineDetailTab? selected;
|
|
final body = Align(
|
|
alignment: Alignment.bottomCenter,
|
|
child: PipelineDetailTabs(
|
|
selected: PipelineDetailTab.summary,
|
|
onSelected: (value) => selected = value,
|
|
),
|
|
);
|
|
Widget scaled(BuildContext context, Widget? child) => MediaQuery(
|
|
data: MediaQuery.of(
|
|
context,
|
|
).copyWith(textScaler: TextScaler.linear(2)),
|
|
child: child!,
|
|
);
|
|
await tester.pumpWidget(
|
|
MaterialApp(builder: scaled, home: Scaffold(body: body)),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
// One floating bar of separate round tab buttons.
|
|
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
|
final pill = tester.getRect(find.byKey(FloatingDestinationBar.rowKey));
|
|
// Sized to its three tabs at the right edge, on a phone as when wide.
|
|
expect(pill.right, width - 16);
|
|
expect(
|
|
pill.width,
|
|
FloatingDestinationBar.rowWidth(
|
|
cupertino: false,
|
|
tabs: PipelineDetailTab.values.length,
|
|
),
|
|
);
|
|
for (final tab in PipelineDetailTab.values) {
|
|
final rect = tester.getRect(
|
|
find.byKey(ValueKey('pipeline-detail-tab-${tab.name}')),
|
|
);
|
|
expect(rect.left, greaterThanOrEqualTo(pill.left), reason: tab.name);
|
|
expect(rect.right, lessThanOrEqualTo(pill.right), reason: tab.name);
|
|
}
|
|
await tester.tap(find.byKey(const Key('pipeline-detail-tab-source')));
|
|
await tester.pumpAndSettle();
|
|
expect(selected, PipelineDetailTab.source);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
}
|
|
}
|