Remove obsolete Cupertino fixture coverage

Keep the shared UI primitive tests focused on the app's Material-only behavior and remove alternate-host fixtures that no longer represent supported rendering.
This commit is contained in:
2026-11-11 20:48:02 +00:00
parent 86a8e11438
commit c88a9e8ce8
8 changed files with 111 additions and 192 deletions
@@ -8,6 +8,10 @@
production caller. The status helper keeps an optional scheme for pure tests. production caller. The status helper keeps an optional scheme for pure tests.
- Focused verification: `tool/memwatch/full.sh` over the seven named Material - Focused verification: `tool/memwatch/full.sh` over the seven named Material
and status/graph tests: 47 passed, 0 failed, peak 1555 MB. and status/graph tests: 47 passed, 0 failed, peak 1555 MB.
- Removed obsolete Cupertino variants from the run-path and segmented-bar
mirrored tests; Material color-scheme roles and Material host/localizations
are now the only assertions in those fixtures. Focused rerun: 14 passed,
0 failed.
- `tool/analyze.sh`: clean, 0 errors/warnings/infos. - `tool/analyze.sh`: clean, 0 errors/warnings/infos.
- A broader exploratory run including `floating_bar_geometry_test.dart` failed - A broader exploratory run including `floating_bar_geometry_test.dart` failed
only in its obsolete CupertinoApp variants because those fixtures do not only in its obsolete CupertinoApp variants because those fixtures do not
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/ui/run_path_mini.dart'; import 'package:pipelines_app/features/runs/ui/run_path_mini.dart';
@@ -42,7 +41,10 @@ void main() {
.whereType<Color>() .whereType<Color>()
.map((color) => color.toARGB32()) .map((color) => color.toARGB32())
.toList(); .toList();
expect(colors, contains(CupertinoColors.systemGreen.color.toARGB32())); final scheme = Theme.of(
expect(colors, contains(CupertinoColors.systemRed.color.toARGB32())); tester.element(find.byKey(const Key('run-path-mini'))),
).colorScheme;
expect(colors, contains(scheme.tertiary.toARGB32()));
expect(colors, contains(scheme.error.toARGB32()));
}); });
} }
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart'; import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
@@ -54,11 +53,7 @@ void main() {
), ),
child: child, child: child,
); );
await tester.pumpWidget( await tester.pumpWidget(MaterialApp(home: Scaffold(body: body)));
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: body))
: MaterialApp(home: Scaffold(body: body)),
);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
} }
@@ -80,18 +75,17 @@ void main() {
(name: 'phone 560, 5 tabs', size: const Size(560, 844), count: 5), (name: 'phone 560, 5 tabs', size: const Size(560, 844), count: 5),
]; ];
for (final cupertino in [false, true]) { {
final host = cupertino ? 'Cupertino' : 'Material'; const cupertino = false;
const host = 'Material';
final diameter = FloatingDestinationBar.buttonSize(cupertino: cupertino); final diameter = FloatingDestinationBar.buttonSize(cupertino: cupertino);
final gap = FloatingDestinationBar.buttonGap(cupertino: cupertino); final gap = FloatingDestinationBar.buttonGap(cupertino: cupertino);
final iconSize = cupertino final iconSize = FloatingDestinationBar.materialIconSize;
? FloatingDestinationBar.cupertinoIconSize
: FloatingDestinationBar.materialIconSize;
test('$host: buttons are larger than the old 44/42 circle, hit targets ' test('$host: buttons are larger than the old 44/42 circle, hit targets '
'meet the platform minimum', () { 'meet the platform minimum', () {
expect(diameter, cupertino ? 50 : 52); expect(diameter, 52);
expect(diameter, greaterThanOrEqualTo(cupertino ? 44 : 48)); expect(diameter, greaterThanOrEqualTo(48));
expect(gap, inInclusiveRange(10, 12)); expect(gap, inInclusiveRange(10, 12));
}); });
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/adaptive/pop_entrance.dart'; import 'package:pipelines_app/ui/adaptive/pop_entrance.dart';
@@ -26,17 +25,13 @@ void main() {
actions: actions, actions: actions,
actionsKey: actionsKey, actionsKey: actionsKey,
); );
final Widget home = cupertino final app = MaterialApp(
? CupertinoPageScaffold( home: Scaffold(
navigationBar: bar, extendBodyBehindAppBar: true,
child: const SizedBox.expand(), appBar: bar,
) body: const SizedBox.expand(),
: Scaffold( ),
extendBodyBehindAppBar: true, );
appBar: bar,
body: const SizedBox.expand(),
);
final app = cupertino ? CupertinoApp(home: home) : MaterialApp(home: home);
return MediaQuery( return MediaQuery(
data: MediaQueryData(disableAnimations: reduced), data: MediaQueryData(disableAnimations: reduced),
child: app, child: app,
@@ -60,9 +55,10 @@ void main() {
const begin = Motion.tabEntranceScaleBegin; const begin = Motion.tabEntranceScaleBegin;
const step = Motion.tabEntranceStagger; const step = Motion.tabEntranceStagger;
for (final cupertino in [false, true]) { {
final host = cupertino ? 'Cupertino' : 'Material'; const cupertino = false;
final icon = cupertino ? CupertinoIcons.refresh : Icons.refresh; const host = 'Material';
const icon = Icons.refresh;
Widget action(String key) => Widget action(String key) =>
IconButton(key: Key(key), icon: Icon(icon), onPressed: () {}); IconButton(key: Key(key), icon: Icon(icon), onPressed: () {});
final a = find.byKey(const Key('a')); final a = find.byKey(const Key('a'));
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
@@ -30,17 +29,13 @@ void main() {
), ),
actions: actions, actions: actions,
); );
final Widget home = cupertino final app = MaterialApp(
? CupertinoPageScaffold( home: Scaffold(
navigationBar: bar, extendBodyBehindAppBar: true,
child: const SizedBox.expand(), appBar: bar,
) body: const SizedBox.expand(),
: Scaffold( ),
extendBodyBehindAppBar: true, );
appBar: bar,
body: const SizedBox.expand(),
);
final app = cupertino ? CupertinoApp(home: home) : MaterialApp(home: home);
return MediaQuery( return MediaQuery(
data: MediaQueryData(disableAnimations: reduced), data: MediaQueryData(disableAnimations: reduced),
child: app, child: app,
@@ -74,9 +69,10 @@ void main() {
final back = find.byKey(const Key('back')); final back = find.byKey(const Key('back'));
final title = find.text('Runs'); final title = find.text('Runs');
for (final cupertino in [false, true]) { {
final host = cupertino ? 'Cupertino' : 'Material'; const cupertino = false;
final icon = cupertino ? CupertinoIcons.refresh : Icons.refresh; const host = 'Material';
const icon = Icons.refresh;
Widget action(String key) => Widget action(String key) =>
IconButton(key: Key(key), icon: Icon(icon), onPressed: () {}); IconButton(key: Key(key), icon: Icon(icon), onPressed: () {});
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
@@ -15,25 +14,12 @@ const _names = ['Needs you', 'Usage', 'Filter', 'Sort', 'Select'];
Key _key(String name) => ValueKey('action.$name'); Key _key(String name) => ValueKey('action.$name');
/// An icon action like the list bars' own, at the host's touch target. /// An icon action like the list bars' own, at the host's touch target.
Widget _icon(bool cupertino, String name, VoidCallback onPressed) => cupertino Widget _icon(bool cupertino, String name, VoidCallback onPressed) => IconButton(
? Semantics( key: _key(name),
button: true, tooltip: name,
label: name, onPressed: onPressed,
excludeSemantics: true, icon: const Icon(Icons.circle_outlined),
child: CupertinoButton( );
key: _key(name),
padding: EdgeInsets.zero,
minimumSize: const Size.square(kMinInteractiveDimensionCupertino),
onPressed: onPressed,
child: const Icon(CupertinoIcons.circle),
),
)
: IconButton(
key: _key(name),
tooltip: name,
onPressed: onPressed,
icon: const Icon(Icons.circle_outlined),
);
/// The Runs bar's shape: a bell that always stays, then four that may move. /// The Runs bar's shape: a bell that always stays, then four that may move.
List<Widget> _actions(bool cupertino, List<String> pressed) => [ List<Widget> _actions(bool cupertino, List<String> pressed) => [
@@ -52,22 +38,14 @@ List<Widget> _actions(bool cupertino, List<String> pressed) => [
]; ];
Widget _app(bool cupertino, SegmentedBar bar, {Brightness? brightness}) => Widget _app(bool cupertino, SegmentedBar bar, {Brightness? brightness}) =>
cupertino MaterialApp(
? CupertinoApp( theme: ThemeData(brightness: brightness ?? Brightness.light),
theme: CupertinoThemeData(brightness: brightness), home: Scaffold(
home: CupertinoPageScaffold( extendBodyBehindAppBar: true,
navigationBar: bar, appBar: bar,
child: const SizedBox.expand(), body: const SizedBox.expand(),
), ),
) );
: MaterialApp(
theme: ThemeData(brightness: brightness ?? Brightness.light),
home: Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: const SizedBox.expand(),
),
);
/// Pumps the bar and the frame its More menu settles in. /// Pumps the bar and the frame its More menu settles in.
Future<void> _pump(WidgetTester tester, Widget app) async { Future<void> _pump(WidgetTester tester, Widget app) async {
@@ -87,8 +65,9 @@ bool _whole(WidgetTester tester, String text) {
} }
void main() { void main() {
for (final cupertino in [false, true]) { {
final host = cupertino ? 'Cupertino' : 'Material'; const cupertino = false;
const host = 'Material';
for (final width in [240.0, 270.0, 320.0]) { for (final width in [240.0, 270.0, 320.0]) {
for (final brightness in Brightness.values) { for (final brightness in Brightness.values) {
testWidgets('$host ${brightness.name} ${width.toInt()}px: the title ' testWidgets('$host ${brightness.name} ${width.toInt()}px: the title '
@@ -126,7 +105,7 @@ void main() {
for (final name in shown) tester.getRect(find.byKey(_key(name))), for (final name in shown) tester.getRect(find.byKey(_key(name))),
tester.getRect(more), tester.getRect(more),
]; ];
final target = cupertino ? 44.0 : 48.0; const target = 48.0;
for (final (index, rect) in rects.indexed) { for (final (index, rect) in rects.indexed) {
expect(rect.width, greaterThanOrEqualTo(target)); expect(rect.width, greaterThanOrEqualTo(target));
expect(rect.height, greaterThanOrEqualTo(target)); expect(rect.height, greaterThanOrEqualTo(target));
+40 -77
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
@@ -69,52 +68,28 @@ void main() {
testWidgets('320px at 2x text lays out without overflow', (tester) async { testWidgets('320px at 2x text lays out without overflow', (tester) async {
_size(tester, 320, scale: 2); _size(tester, 320, scale: 2);
for (final cupertino in [false, true]) { final bar = SegmentedBar(
final bar = SegmentedBar( cupertino: false,
cupertino: cupertino, leading: SegmentedBackButton(cupertino: false, onPressed: () {}),
leading: SegmentedBackButton(cupertino: cupertino, onPressed: () {}), title: 'A long conversation title',
title: 'A long conversation title', subtitle: 'a-working-folder',
subtitle: 'a-working-folder', subtitleIcon: Icons.folder_outlined,
subtitleIcon: Icons.folder_outlined, onTitlePressed: () {},
onTitlePressed: () {}, actions: [
actions: cupertino _modelAction('gpt-5.6-luna'),
? [ IconButton(onPressed: () {}, icon: const Icon(Icons.refresh)),
CupertinoButton( ],
onPressed: () {}, );
child: const Text( await tester.pumpWidget(
'gpt-5.6-luna', MaterialApp(
maxLines: 1, home: Scaffold(
overflow: TextOverflow.ellipsis, extendBodyBehindAppBar: true,
), appBar: bar,
), body: const SizedBox.expand(),
] ),
: [ ),
_modelAction('gpt-5.6-luna'), );
IconButton(onPressed: () {}, icon: const Icon(Icons.refresh)), expect(tester.takeException(), isNull);
],
);
// A Cupertino bar over content (the conversation's own) scales its
// text; as a navigation bar the scaffold turns scaling off.
await tester.pumpWidget(
cupertino
? CupertinoApp(
home: CupertinoPageScaffold(
child: SegmentedBarOverlay(
bar: bar,
child: const SizedBox.expand(),
),
),
)
: MaterialApp(
home: Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: const SizedBox.expand(),
),
),
);
expect(tester.takeException(), isNull, reason: 'cupertino: $cupertino');
}
}); });
testWidgets('taps between the pieces reach the content behind', ( testWidgets('taps between the pieces reach the content behind', (
@@ -173,48 +148,36 @@ void main() {
testWidgets('pieces are frosted glass, solid under high contrast', ( testWidgets('pieces are frosted glass, solid under high contrast', (
tester, tester,
) async { ) async {
Widget app(bool highContrast) => CupertinoApp( Widget app(bool highContrast) => MaterialApp(
home: MediaQuery( home: MediaQuery(
data: MediaQueryData(highContrast: highContrast), data: MediaQueryData(highContrast: highContrast),
child: const CupertinoPageScaffold( child: Scaffold(
navigationBar: SegmentedBar(cupertino: true, title: 'Glass'), appBar: const SegmentedBar(cupertino: false, title: 'Glass'),
child: SizedBox.expand(), body: const SizedBox.expand(),
), ),
), ),
); );
await tester.pumpWidget(app(false)); await tester.pumpWidget(app(false));
expect(find.byType(GlassPill), findsOneWidget); expect(find.byType(GlassPill), findsOneWidget);
expect(find.byType(BackdropFilter), findsOneWidget); expect(find.byType(BackdropFilter), findsOneWidget);
// The Cupertino bar draws no Material widget. expect(find.byType(Material), findsWidgets);
expect(find.byType(Material), findsNothing);
await tester.pumpWidget(app(true)); await tester.pumpWidget(app(true));
expect(find.byType(BackdropFilter), findsNothing); expect(find.byType(BackdropFilter), findsNothing);
}); });
testWidgets('Material and Cupertino titles use semibold text', ( testWidgets('Material titles use semibold text', (tester) async {
tester, await tester.pumpWidget(
) async { const MaterialApp(
for (final cupertino in [false, true]) { home: Scaffold(
await tester.pumpWidget( appBar: SegmentedBar(cupertino: false, title: 'Title'),
cupertino body: SizedBox.expand(),
? const CupertinoApp( ),
home: CupertinoPageScaffold( ),
navigationBar: SegmentedBar(cupertino: true, title: 'Title'), );
child: SizedBox.expand(), expect(
), tester.widget<Text>(find.text('Title')).style?.fontWeight,
) FontWeight.w600,
: const MaterialApp( );
home: Scaffold(
appBar: SegmentedBar(cupertino: false, title: 'Title'),
body: SizedBox.expand(),
),
),
);
expect(
tester.widget<Text>(find.text('Title')).style?.fontWeight,
FontWeight.w600,
);
}
}); });
} }
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart'; import 'package:pipelines_app/shell/adaptive_shell.dart';
@@ -18,31 +17,22 @@ void main() {
const fieldKey = Key('field'); const fieldKey = Key('field');
Widget field(bool cupertino) => cupertino const field = TextField(key: fieldKey);
? const CupertinoTextField(key: fieldKey, placeholder: 'Find')
: const TextField(key: fieldKey);
Rect pillOf(WidgetTester tester, Finder child) => tester.getRect( Rect pillOf(WidgetTester tester, Finder child) => tester.getRect(
find.ancestor(of: child, matching: find.byType(GlassPill)).first, find.ancestor(of: child, matching: find.byType(GlassPill)).first,
); );
Widget page(bool cupertino, SegmentedBar bar) => cupertino Widget page(SegmentedBar bar) => MaterialApp(
? CupertinoApp( home: Scaffold(
home: CupertinoPageScaffold( extendBodyBehindAppBar: true,
navigationBar: bar, appBar: bar,
child: const SizedBox.expand(), body: const SizedBox.expand(),
), ),
) );
: MaterialApp(
home: Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: const SizedBox.expand(),
),
);
for (final cupertino in [false, true]) { {
final host = cupertino ? 'Cupertino' : 'Material'; const host = 'Material';
testWidgets('$host: the widget replaces the title and fills a phone bar', ( testWidgets('$host: the widget replaces the title and fills a phone bar', (
tester, tester,
@@ -50,11 +40,10 @@ void main() {
setSize(tester, 390); setSize(tester, 390);
await tester.pumpWidget( await tester.pumpWidget(
page( page(
cupertino,
SegmentedBar( SegmentedBar(
cupertino: cupertino, cupertino: false,
title: 'Search', title: 'Search',
titleWidget: field(cupertino), titleWidget: field,
titleWidgetMaxWidth: 840, titleWidgetMaxWidth: 840,
), ),
), ),
@@ -81,15 +70,11 @@ void main() {
setSize(tester, 1200); setSize(tester, 1200);
await tester.pumpWidget( await tester.pumpWidget(
page( page(
cupertino,
SegmentedBar( SegmentedBar(
cupertino: cupertino, cupertino: false,
title: 'Search', title: 'Search',
leading: SegmentedBackButton( leading: SegmentedBackButton(cupertino: false, onPressed: () {}),
cupertino: cupertino, titleWidget: field,
onPressed: () {},
),
titleWidget: field(cupertino),
titleWidgetMaxWidth: 600, titleWidgetMaxWidth: 600,
actions: const [Icon(Icons.info_outline, key: Key('action'))], actions: const [Icon(Icons.info_outline, key: Key('action'))],
), ),