From 3650726ca171bc05dc199967134746b5f77a2797 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 11 Nov 2026 21:08:01 +0000 Subject: [PATCH] Remove obsolete Cupertino motion fixtures Keep floating tab motion coverage aligned with the app's Material-only UI and update the cleanup note with the focused verification already completed. --- .../material-cleanup-shared-ui-primitives.md | 8 +- .../ui/adaptive/floating_tab_motion_test.dart | 393 +++++++++--------- 2 files changed, 193 insertions(+), 208 deletions(-) diff --git a/app/notes/material-cleanup-shared-ui-primitives.md b/app/notes/material-cleanup-shared-ui-primitives.md index be20f20b..31db790e 100644 --- a/app/notes/material-cleanup-shared-ui-primitives.md +++ b/app/notes/material-cleanup-shared-ui-primitives.md @@ -13,9 +13,9 @@ 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 - provide MaterialLocalizations after the app became Material-only. Those - alternate-host cases remain for the manager's consolidated test cleanup. +- Removed the obsolete CupertinoApp variants from + `floating_tab_motion_test.dart`; the Material motion coverage now runs under + `MaterialApp` only. Focused rerun of the floating-tab, segmented-bar, and + run-path tests: 16 passed, 0 failed. - No browser capture was performed; these changes preserve existing Material geometry and interaction paths rather than redesigning visuals. diff --git a/app/test/ui/adaptive/floating_tab_motion_test.dart b/app/test/ui/adaptive/floating_tab_motion_test.dart index 0c8fae42..5f5dba9b 100644 --- a/app/test/ui/adaptive/floating_tab_motion_test.dart +++ b/app/test/ui/adaptive/floating_tab_motion_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'; @@ -39,25 +38,18 @@ void main() { addTearDown(tester.view.reset); } - Widget app(bool cupertino, Widget body) => cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: body)) - : MaterialApp(home: Scaffold(body: body)); + Widget app(Widget body) => MaterialApp(home: Scaffold(body: body)); /// A bar of [count] tabs whose tap selects. - Future pumpBar( - WidgetTester tester, { - required bool cupertino, - int count = 3, - }) async { + Future pumpBar(WidgetTester tester, {int count = 3}) async { var selected = 0; await tester.pumpWidget( app( - cupertino, StatefulBuilder( builder: (context, setState) => Align( alignment: Alignment.bottomCenter, child: FloatingDestinationBar( - cupertino: cupertino, + cupertino: false, currentIndex: selected, onTap: (index) => setState(() => selected = index), items: items(count), @@ -102,205 +94,198 @@ void main() { return (decoration! as ShapeDecoration).color!.a; } - for (final cupertino in [false, true]) { - final host = cupertino ? 'Cupertino' : 'Material'; - final size = FloatingDestinationBar.buttonSize(cupertino: cupertino); - final iconSize = cupertino - ? FloatingDestinationBar.cupertinoIconSize - : FloatingDestinationBar.materialIconSize; + final host = 'Material'; + final size = FloatingDestinationBar.buttonSize(cupertino: false); + final iconSize = FloatingDestinationBar.materialIconSize; - testWidgets('$host: each button pops in on its own, staggered, from ' - '0.6 to full size', (tester) async { - animate(tester, on: true); - await pumpBar(tester, cupertino: cupertino); - for (var index = 0; index < 3; index += 1) { - final tab = find.byKey(tabKey(index)); - expect(opacityOf(tester, tab), 0); - final rest = index == 0 - ? FloatingDestinationBar.selectedButtonSize(cupertino: cupertino) - : size; - expect(widthOf(tester, tab), moreOrLessEquals(rest * 0.6)); - } - await tester.pump(const Duration(milliseconds: 130)); - final first = widthOf(tester, find.byKey(tabKey(0))); - final last = widthOf(tester, find.byKey(tabKey(2))); - expect(first, greaterThan(last + 4), reason: 'staggered'); - expect(opacityOf(tester, find.byKey(tabKey(0))), greaterThan(0.9)); - expect(opacityOf(tester, find.byKey(tabKey(2))), lessThan(0.2)); - await tester.pumpAndSettle(); - for (var index = 0; index < 3; index += 1) { - final tab = find.byKey(tabKey(index)); - expect(opacityOf(tester, tab), 1); - // Tab 0 is selected, so it settles at the larger size. - expect( - widthOf(tester, tab), - index == 0 - ? FloatingDestinationBar.selectedButtonSize(cupertino: cupertino) - : size, - ); - } - }); - - testWidgets('$host: the entrance does not replay when the selection ' - 'changes', (tester) async { - animate(tester, on: true); - await pumpBar(tester, cupertino: cupertino); - await tester.pumpAndSettle(); - for (final target in [1, 2, 0]) { - await tester.tap(find.byKey(tabKey(target))); - for (var frame = 0; frame < 12; frame += 1) { - await tester.pump(const Duration(milliseconds: 25)); - for (var index = 0; index < 3; index += 1) { - final tab = find.byKey(tabKey(index)); - expect(opacityOf(tester, tab), 1, reason: 'tab $index faded'); - // The selection grows and shrinks buttons between their two - // sizes and the press sinks the tapped one a little; a replayed - // pop would start at 0.6. - expect( - widthOf(tester, tab), - greaterThan(size * 0.9), - reason: 'tab $index popped again', - ); - } - } - await tester.pumpAndSettle(); - } - }); - - testWidgets('$host: a new set of tabs pops in again', (tester) async { - animate(tester, on: true); - var count = 3; - late StateSetter update; - await tester.pumpWidget( - app( - cupertino, - StatefulBuilder( - builder: (context, setState) { - update = setState; - return Align( - alignment: Alignment.bottomCenter, - child: FloatingDestinationBar( - cupertino: cupertino, - currentIndex: 0, - onTap: (_) {}, - items: items(count), - ), - ); - }, - ), - ), - ); - await tester.pumpAndSettle(); - expect(opacityOf(tester, find.byKey(tabKey(2))), 1); - update(() => count = 4); - await tester.pump(); - expect(opacityOf(tester, find.byKey(tabKey(3))), 0); - expect(opacityOf(tester, find.byKey(tabKey(2))), 0); - await tester.pumpAndSettle(); - expect(opacityOf(tester, find.byKey(tabKey(3))), 1); - expect(widthOf(tester, find.byKey(tabKey(3))), size); - }); - - testWidgets('$host: the selection tint cross-fades to the new button, ' - 'whose icon takes the selected colour and bounces', (tester) async { - animate(tester, on: true); - await pumpBar(tester, cupertino: cupertino); - await tester.pumpAndSettle(); - final tint = fillAlpha(tester, 0); - expect(tint, greaterThan(0.1)); - expect(fillAlpha(tester, 1), 0); - expect(fillAlpha(tester, 2), 0); - - await tester.tap(find.byKey(tabKey(2))); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 80)); - expect(fillAlpha(tester, 2), inExclusiveRange(0, tint)); - expect(fillAlpha(tester, 0), inExclusiveRange(0, tint)); - // The icon grows within its button (which the tap's press sinks). - expect( - iconWidth(tester, 2) * size / widthOf(tester, find.byKey(tabKey(2))), - greaterThan(iconSize * 1.04), - ); - expect(iconWidth(tester, 1), moreOrLessEquals(iconSize)); - - await tester.pumpAndSettle(); - expect(fillAlpha(tester, 2), tint); - expect(fillAlpha(tester, 0), 0); - // At rest the selected icon is a little larger than the others. - expect( - iconWidth(tester, 2), - moreOrLessEquals( - iconSize * - FloatingDestinationBar.selectedButtonSize(cupertino: cupertino) / - FloatingDestinationBar.buttonSize(cupertino: cupertino), - ), - ); - expect(iconWidth(tester, 0), moreOrLessEquals(iconSize)); - expect(iconWidth(tester, 1), moreOrLessEquals(iconSize)); - final context = tester.element(find.byKey(tabKey(2))); - final selectedColour = cupertino - ? CupertinoTheme.of(context).primaryColor - : Theme.of(context).colorScheme.onSecondaryContainer; - expect( - IconTheme.of(tester.element(find.byIcon(icons[2]))).color, - isSameColorAs(selectedColour), - ); - expect( - IconTheme.of(tester.element(find.byIcon(icons[0]))).color, - isNot(isSameColorAs(selectedColour)), - ); - }); - - testWidgets('$host: a press sinks the button and it springs back', ( - tester, - ) async { - animate(tester, on: true); - await pumpBar(tester, cupertino: cupertino); - await tester.pumpAndSettle(); - final tab = find.byKey(tabKey(1)); - final gesture = await tester.startGesture(tester.getCenter(tab)); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 120)); - expect(widthOf(tester, tab), lessThan(size * 0.97)); - // Tab 0 is selected, so it is the larger button; the press leaves it. - expect( - widthOf(tester, find.byKey(tabKey(0))), - FloatingDestinationBar.selectedButtonSize(cupertino: cupertino), - ); - await gesture.up(); - await tester.pumpAndSettle(); - // The tap selected it: it springs back to the selected size. + testWidgets('$host: each button pops in on its own, staggered, from ' + '0.6 to full size', (tester) async { + animate(tester, on: true); + await pumpBar(tester); + for (var index = 0; index < 3; index += 1) { + final tab = find.byKey(tabKey(index)); + expect(opacityOf(tester, tab), 0); + final rest = index == 0 + ? FloatingDestinationBar.selectedButtonSize(cupertino: false) + : size; + expect(widthOf(tester, tab), moreOrLessEquals(rest * 0.6)); + } + await tester.pump(const Duration(milliseconds: 130)); + final first = widthOf(tester, find.byKey(tabKey(0))); + final last = widthOf(tester, find.byKey(tabKey(2))); + expect(first, greaterThan(last + 4), reason: 'staggered'); + expect(opacityOf(tester, find.byKey(tabKey(0))), greaterThan(0.9)); + expect(opacityOf(tester, find.byKey(tabKey(2))), lessThan(0.2)); + await tester.pumpAndSettle(); + for (var index = 0; index < 3; index += 1) { + final tab = find.byKey(tabKey(index)); + expect(opacityOf(tester, tab), 1); + // Tab 0 is selected, so it settles at the larger size. expect( widthOf(tester, tab), - FloatingDestinationBar.selectedButtonSize(cupertino: cupertino), + index == 0 + ? FloatingDestinationBar.selectedButtonSize(cupertino: false) + : size, ); - }); + } + }); - testWidgets('$host: under reduced motion the tint jumps and the buttons ' - 'neither pop nor bounce', (tester) async { - animate(tester, on: false); - await pumpBar(tester, cupertino: cupertino); - await tester.pump(); - expect(opacityOf(tester, find.byKey(tabKey(1))), 1); - expect(widthOf(tester, find.byKey(tabKey(1))), size); - final tint = fillAlpha(tester, 0); - await tester.tap(find.byKey(tabKey(2))); - await tester.pump(); - await tester.pump(); - expect(fillAlpha(tester, 2), tint); - expect(fillAlpha(tester, 0), 0); - // No bounce, and the selected icon jumps straight to its larger size. - expect( - iconWidth(tester, 2), - moreOrLessEquals( - iconSize * - FloatingDestinationBar.selectedButtonSize(cupertino: cupertino) / - FloatingDestinationBar.buttonSize(cupertino: cupertino), + testWidgets('$host: the entrance does not replay when the selection ' + 'changes', (tester) async { + animate(tester, on: true); + await pumpBar(tester); + await tester.pumpAndSettle(); + for (final target in [1, 2, 0]) { + await tester.tap(find.byKey(tabKey(target))); + for (var frame = 0; frame < 12; frame += 1) { + await tester.pump(const Duration(milliseconds: 25)); + for (var index = 0; index < 3; index += 1) { + final tab = find.byKey(tabKey(index)); + expect(opacityOf(tester, tab), 1, reason: 'tab $index faded'); + // The selection grows and shrinks buttons between their two + // sizes and the press sinks the tapped one a little; a replayed + // pop would start at 0.6. + expect( + widthOf(tester, tab), + greaterThan(size * 0.9), + reason: 'tab $index popped again', + ); + } + } + await tester.pumpAndSettle(); + } + }); + + testWidgets('$host: a new set of tabs pops in again', (tester) async { + animate(tester, on: true); + var count = 3; + late StateSetter update; + await tester.pumpWidget( + app( + StatefulBuilder( + builder: (context, setState) { + update = setState; + return Align( + alignment: Alignment.bottomCenter, + child: FloatingDestinationBar( + cupertino: false, + currentIndex: 0, + onTap: (_) {}, + items: items(count), + ), + ); + }, ), - ); - expect(iconWidth(tester, 0), moreOrLessEquals(iconSize)); - }); - } + ), + ); + await tester.pumpAndSettle(); + expect(opacityOf(tester, find.byKey(tabKey(2))), 1); + update(() => count = 4); + await tester.pump(); + expect(opacityOf(tester, find.byKey(tabKey(3))), 0); + expect(opacityOf(tester, find.byKey(tabKey(2))), 0); + await tester.pumpAndSettle(); + expect(opacityOf(tester, find.byKey(tabKey(3))), 1); + expect(widthOf(tester, find.byKey(tabKey(3))), size); + }); + + testWidgets('$host: the selection tint cross-fades to the new button, ' + 'whose icon takes the selected colour and bounces', (tester) async { + animate(tester, on: true); + await pumpBar(tester); + await tester.pumpAndSettle(); + final tint = fillAlpha(tester, 0); + expect(tint, greaterThan(0.1)); + expect(fillAlpha(tester, 1), 0); + expect(fillAlpha(tester, 2), 0); + + await tester.tap(find.byKey(tabKey(2))); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 80)); + expect(fillAlpha(tester, 2), inExclusiveRange(0, tint)); + expect(fillAlpha(tester, 0), inExclusiveRange(0, tint)); + // The icon grows within its button (which the tap's press sinks). + expect( + iconWidth(tester, 2) * size / widthOf(tester, find.byKey(tabKey(2))), + greaterThan(iconSize * 1.04), + ); + expect(iconWidth(tester, 1), moreOrLessEquals(iconSize)); + + await tester.pumpAndSettle(); + expect(fillAlpha(tester, 2), tint); + expect(fillAlpha(tester, 0), 0); + // At rest the selected icon is a little larger than the others. + expect( + iconWidth(tester, 2), + moreOrLessEquals( + iconSize * + FloatingDestinationBar.selectedButtonSize(cupertino: false) / + FloatingDestinationBar.buttonSize(cupertino: false), + ), + ); + expect(iconWidth(tester, 0), moreOrLessEquals(iconSize)); + expect(iconWidth(tester, 1), moreOrLessEquals(iconSize)); + final context = tester.element(find.byKey(tabKey(2))); + final selectedColour = Theme.of(context).colorScheme.onSecondaryContainer; + expect( + IconTheme.of(tester.element(find.byIcon(icons[2]))).color, + isSameColorAs(selectedColour), + ); + expect( + IconTheme.of(tester.element(find.byIcon(icons[0]))).color, + isNot(isSameColorAs(selectedColour)), + ); + }); + + testWidgets('$host: a press sinks the button and it springs back', ( + tester, + ) async { + animate(tester, on: true); + await pumpBar(tester); + await tester.pumpAndSettle(); + final tab = find.byKey(tabKey(1)); + final gesture = await tester.startGesture(tester.getCenter(tab)); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 120)); + expect(widthOf(tester, tab), lessThan(size * 0.97)); + // Tab 0 is selected, so it is the larger button; the press leaves it. + expect( + widthOf(tester, find.byKey(tabKey(0))), + FloatingDestinationBar.selectedButtonSize(cupertino: false), + ); + await gesture.up(); + await tester.pumpAndSettle(); + // The tap selected it: it springs back to the selected size. + expect( + widthOf(tester, tab), + FloatingDestinationBar.selectedButtonSize(cupertino: false), + ); + }); + + testWidgets('$host: under reduced motion the tint jumps and the buttons ' + 'neither pop nor bounce', (tester) async { + animate(tester, on: false); + await pumpBar(tester); + await tester.pump(); + expect(opacityOf(tester, find.byKey(tabKey(1))), 1); + expect(widthOf(tester, find.byKey(tabKey(1))), size); + final tint = fillAlpha(tester, 0); + await tester.tap(find.byKey(tabKey(2))); + await tester.pump(); + await tester.pump(); + expect(fillAlpha(tester, 2), tint); + expect(fillAlpha(tester, 0), 0); + // No bounce, and the selected icon jumps straight to its larger size. + expect( + iconWidth(tester, 2), + moreOrLessEquals( + iconSize * + FloatingDestinationBar.selectedButtonSize(cupertino: false) / + FloatingDestinationBar.buttonSize(cupertino: false), + ), + ); + expect(iconWidth(tester, 0), moreOrLessEquals(iconSize)); + }); testWidgets('switching the shell tabs never replays the main ' "bar's entrance", (tester) async {