From c88a9e8ce82bb54d2efda5a3ba83b7a08aafc478 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 11 Nov 2026 20:48:02 +0000 Subject: [PATCH] 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. --- .../material-cleanup-shared-ui-primitives.md | 4 + .../features/runs/ui/run_path_mini_test.dart | 8 +- .../adaptive/floating_bar_geometry_test.dart | 20 ++- .../adaptive/segmented_bar_entrance_test.dart | 26 ++-- .../adaptive/segmented_bar_motion_test.dart | 26 ++-- .../adaptive/segmented_bar_overflow_test.dart | 57 +++------ app/test/ui/adaptive/segmented_bar_test.dart | 117 ++++++------------ .../segmented_bar_title_widget_test.dart | 45 +++---- 8 files changed, 111 insertions(+), 192 deletions(-) diff --git a/app/notes/material-cleanup-shared-ui-primitives.md b/app/notes/material-cleanup-shared-ui-primitives.md index 0d69d4ee..be20f20b 100644 --- a/app/notes/material-cleanup-shared-ui-primitives.md +++ b/app/notes/material-cleanup-shared-ui-primitives.md @@ -8,6 +8,10 @@ production caller. The status helper keeps an optional scheme for pure tests. - Focused verification: `tool/memwatch/full.sh` over the seven named Material 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. - A broader exploratory run including `floating_bar_geometry_test.dart` failed only in its obsolete CupertinoApp variants because those fixtures do not diff --git a/app/test/features/runs/ui/run_path_mini_test.dart b/app/test/features/runs/ui/run_path_mini_test.dart index 751514d2..0acebc78 100644 --- a/app/test/features/runs/ui/run_path_mini_test.dart +++ b/app/test/features/runs/ui/run_path_mini_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/runs/ui/run_path_mini.dart'; @@ -42,7 +41,10 @@ void main() { .whereType() .map((color) => color.toARGB32()) .toList(); - expect(colors, contains(CupertinoColors.systemGreen.color.toARGB32())); - expect(colors, contains(CupertinoColors.systemRed.color.toARGB32())); + final scheme = Theme.of( + tester.element(find.byKey(const Key('run-path-mini'))), + ).colorScheme; + expect(colors, contains(scheme.tertiary.toARGB32())); + expect(colors, contains(scheme.error.toARGB32())); }); } diff --git a/app/test/ui/adaptive/floating_bar_geometry_test.dart b/app/test/ui/adaptive/floating_bar_geometry_test.dart index 982227f1..f5fc7ac5 100644 --- a/app/test/ui/adaptive/floating_bar_geometry_test.dart +++ b/app/test/ui/adaptive/floating_bar_geometry_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart'; @@ -54,11 +53,7 @@ void main() { ), child: child, ); - await tester.pumpWidget( - cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: body)) - : MaterialApp(home: Scaffold(body: body)), - ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: body))); await tester.pumpAndSettle(); } @@ -80,18 +75,17 @@ void main() { (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 gap = FloatingDestinationBar.buttonGap(cupertino: cupertino); - final iconSize = cupertino - ? FloatingDestinationBar.cupertinoIconSize - : FloatingDestinationBar.materialIconSize; + final iconSize = FloatingDestinationBar.materialIconSize; test('$host: buttons are larger than the old 44/42 circle, hit targets ' 'meet the platform minimum', () { - expect(diameter, cupertino ? 50 : 52); - expect(diameter, greaterThanOrEqualTo(cupertino ? 44 : 48)); + expect(diameter, 52); + expect(diameter, greaterThanOrEqualTo(48)); expect(gap, inInclusiveRange(10, 12)); }); diff --git a/app/test/ui/adaptive/segmented_bar_entrance_test.dart b/app/test/ui/adaptive/segmented_bar_entrance_test.dart index fe265e0c..2b80bf1d 100644 --- a/app/test/ui/adaptive/segmented_bar_entrance_test.dart +++ b/app/test/ui/adaptive/segmented_bar_entrance_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/ui/adaptive/pop_entrance.dart'; @@ -26,17 +25,13 @@ void main() { actions: actions, actionsKey: actionsKey, ); - final Widget home = cupertino - ? CupertinoPageScaffold( - navigationBar: bar, - child: const SizedBox.expand(), - ) - : Scaffold( - extendBodyBehindAppBar: true, - appBar: bar, - body: const SizedBox.expand(), - ); - final app = cupertino ? CupertinoApp(home: home) : MaterialApp(home: home); + final app = MaterialApp( + home: Scaffold( + extendBodyBehindAppBar: true, + appBar: bar, + body: const SizedBox.expand(), + ), + ); return MediaQuery( data: MediaQueryData(disableAnimations: reduced), child: app, @@ -60,9 +55,10 @@ void main() { const begin = Motion.tabEntranceScaleBegin; const step = Motion.tabEntranceStagger; - for (final cupertino in [false, true]) { - final host = cupertino ? 'Cupertino' : 'Material'; - final icon = cupertino ? CupertinoIcons.refresh : Icons.refresh; + { + const cupertino = false; + const host = 'Material'; + const icon = Icons.refresh; Widget action(String key) => IconButton(key: Key(key), icon: Icon(icon), onPressed: () {}); final a = find.byKey(const Key('a')); diff --git a/app/test/ui/adaptive/segmented_bar_motion_test.dart b/app/test/ui/adaptive/segmented_bar_motion_test.dart index c83d3436..d7aba5bc 100644 --- a/app/test/ui/adaptive/segmented_bar_motion_test.dart +++ b/app/test/ui/adaptive/segmented_bar_motion_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -30,17 +29,13 @@ void main() { ), actions: actions, ); - final Widget home = cupertino - ? CupertinoPageScaffold( - navigationBar: bar, - child: const SizedBox.expand(), - ) - : Scaffold( - extendBodyBehindAppBar: true, - appBar: bar, - body: const SizedBox.expand(), - ); - final app = cupertino ? CupertinoApp(home: home) : MaterialApp(home: home); + final app = MaterialApp( + home: Scaffold( + extendBodyBehindAppBar: true, + appBar: bar, + body: const SizedBox.expand(), + ), + ); return MediaQuery( data: MediaQueryData(disableAnimations: reduced), child: app, @@ -74,9 +69,10 @@ void main() { final back = find.byKey(const Key('back')); final title = find.text('Runs'); - for (final cupertino in [false, true]) { - final host = cupertino ? 'Cupertino' : 'Material'; - final icon = cupertino ? CupertinoIcons.refresh : Icons.refresh; + { + const cupertino = false; + const host = 'Material'; + const icon = Icons.refresh; Widget action(String key) => IconButton(key: Key(key), icon: Icon(icon), onPressed: () {}); diff --git a/app/test/ui/adaptive/segmented_bar_overflow_test.dart b/app/test/ui/adaptive/segmented_bar_overflow_test.dart index 7fc41cc8..a1501236 100644 --- a/app/test/ui/adaptive/segmented_bar_overflow_test.dart +++ b/app/test/ui/adaptive/segmented_bar_overflow_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.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'); /// An icon action like the list bars' own, at the host's touch target. -Widget _icon(bool cupertino, String name, VoidCallback onPressed) => cupertino - ? Semantics( - button: true, - label: name, - excludeSemantics: true, - 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), - ); +Widget _icon(bool cupertino, String name, VoidCallback onPressed) => 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. List _actions(bool cupertino, List pressed) => [ @@ -52,22 +38,14 @@ List _actions(bool cupertino, List pressed) => [ ]; Widget _app(bool cupertino, SegmentedBar bar, {Brightness? brightness}) => - cupertino - ? CupertinoApp( - theme: CupertinoThemeData(brightness: brightness), - home: CupertinoPageScaffold( - navigationBar: bar, - child: const SizedBox.expand(), - ), - ) - : MaterialApp( - theme: ThemeData(brightness: brightness ?? Brightness.light), - home: Scaffold( - extendBodyBehindAppBar: true, - appBar: bar, - 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. Future _pump(WidgetTester tester, Widget app) async { @@ -87,8 +65,9 @@ bool _whole(WidgetTester tester, String text) { } 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 brightness in Brightness.values) { 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))), tester.getRect(more), ]; - final target = cupertino ? 44.0 : 48.0; + const target = 48.0; for (final (index, rect) in rects.indexed) { expect(rect.width, greaterThanOrEqualTo(target)); expect(rect.height, greaterThanOrEqualTo(target)); diff --git a/app/test/ui/adaptive/segmented_bar_test.dart b/app/test/ui/adaptive/segmented_bar_test.dart index 80c9873b..8fb0b721 100644 --- a/app/test/ui/adaptive/segmented_bar_test.dart +++ b/app/test/ui/adaptive/segmented_bar_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.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 { _size(tester, 320, scale: 2); - for (final cupertino in [false, true]) { - final bar = SegmentedBar( - cupertino: cupertino, - leading: SegmentedBackButton(cupertino: cupertino, onPressed: () {}), - title: 'A long conversation title', - subtitle: 'a-working-folder', - subtitleIcon: Icons.folder_outlined, - onTitlePressed: () {}, - actions: cupertino - ? [ - CupertinoButton( - onPressed: () {}, - child: const Text( - 'gpt-5.6-luna', - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - ] - : [ - _modelAction('gpt-5.6-luna'), - IconButton(onPressed: () {}, icon: const Icon(Icons.refresh)), - ], - ); - // 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'); - } + final bar = SegmentedBar( + cupertino: false, + leading: SegmentedBackButton(cupertino: false, onPressed: () {}), + title: 'A long conversation title', + subtitle: 'a-working-folder', + subtitleIcon: Icons.folder_outlined, + onTitlePressed: () {}, + actions: [ + _modelAction('gpt-5.6-luna'), + IconButton(onPressed: () {}, icon: const Icon(Icons.refresh)), + ], + ); + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + extendBodyBehindAppBar: true, + appBar: bar, + body: const SizedBox.expand(), + ), + ), + ); + expect(tester.takeException(), isNull); }); testWidgets('taps between the pieces reach the content behind', ( @@ -173,48 +148,36 @@ void main() { testWidgets('pieces are frosted glass, solid under high contrast', ( tester, ) async { - Widget app(bool highContrast) => CupertinoApp( + Widget app(bool highContrast) => MaterialApp( home: MediaQuery( data: MediaQueryData(highContrast: highContrast), - child: const CupertinoPageScaffold( - navigationBar: SegmentedBar(cupertino: true, title: 'Glass'), - child: SizedBox.expand(), + child: Scaffold( + appBar: const SegmentedBar(cupertino: false, title: 'Glass'), + body: const SizedBox.expand(), ), ), ); await tester.pumpWidget(app(false)); expect(find.byType(GlassPill), findsOneWidget); expect(find.byType(BackdropFilter), findsOneWidget); - // The Cupertino bar draws no Material widget. - expect(find.byType(Material), findsNothing); + expect(find.byType(Material), findsWidgets); await tester.pumpWidget(app(true)); expect(find.byType(BackdropFilter), findsNothing); }); - testWidgets('Material and Cupertino titles use semibold text', ( - tester, - ) async { - for (final cupertino in [false, true]) { - await tester.pumpWidget( - cupertino - ? const CupertinoApp( - home: CupertinoPageScaffold( - navigationBar: SegmentedBar(cupertino: true, title: 'Title'), - child: SizedBox.expand(), - ), - ) - : const MaterialApp( - home: Scaffold( - appBar: SegmentedBar(cupertino: false, title: 'Title'), - body: SizedBox.expand(), - ), - ), - ); - expect( - tester.widget(find.text('Title')).style?.fontWeight, - FontWeight.w600, - ); - } + testWidgets('Material titles use semibold text', (tester) async { + await tester.pumpWidget( + const MaterialApp( + home: Scaffold( + appBar: SegmentedBar(cupertino: false, title: 'Title'), + body: SizedBox.expand(), + ), + ), + ); + expect( + tester.widget(find.text('Title')).style?.fontWeight, + FontWeight.w600, + ); }); } diff --git a/app/test/ui/adaptive/segmented_bar_title_widget_test.dart b/app/test/ui/adaptive/segmented_bar_title_widget_test.dart index cbc6c408..09f2b499 100644 --- a/app/test/ui/adaptive/segmented_bar_title_widget_test.dart +++ b/app/test/ui/adaptive/segmented_bar_title_widget_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/shell/adaptive_shell.dart'; @@ -18,31 +17,22 @@ void main() { const fieldKey = Key('field'); - Widget field(bool cupertino) => cupertino - ? const CupertinoTextField(key: fieldKey, placeholder: 'Find') - : const TextField(key: fieldKey); + const field = TextField(key: fieldKey); Rect pillOf(WidgetTester tester, Finder child) => tester.getRect( find.ancestor(of: child, matching: find.byType(GlassPill)).first, ); - Widget page(bool cupertino, SegmentedBar bar) => cupertino - ? CupertinoApp( - home: CupertinoPageScaffold( - navigationBar: bar, - child: const SizedBox.expand(), - ), - ) - : MaterialApp( - home: Scaffold( - extendBodyBehindAppBar: true, - appBar: bar, - body: const SizedBox.expand(), - ), - ); + Widget page(SegmentedBar bar) => 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', ( tester, @@ -50,11 +40,10 @@ void main() { setSize(tester, 390); await tester.pumpWidget( page( - cupertino, SegmentedBar( - cupertino: cupertino, + cupertino: false, title: 'Search', - titleWidget: field(cupertino), + titleWidget: field, titleWidgetMaxWidth: 840, ), ), @@ -81,15 +70,11 @@ void main() { setSize(tester, 1200); await tester.pumpWidget( page( - cupertino, SegmentedBar( - cupertino: cupertino, + cupertino: false, title: 'Search', - leading: SegmentedBackButton( - cupertino: cupertino, - onPressed: () {}, - ), - titleWidget: field(cupertino), + leading: SegmentedBackButton(cupertino: false, onPressed: () {}), + titleWidget: field, titleWidgetMaxWidth: 600, actions: const [Icon(Icons.info_outline, key: Key('action'))], ),