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
+40 -77
View File
@@ -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<Text>(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<Text>(find.text('Title')).style?.fontWeight,
FontWeight.w600,
);
});
}