Remove Cupertino branches from Settings
Keep the Material-only settings implementation and its focused tests while preserving public cupertino parameters for later cleanup. This removes unreachable platform-specific widgets and test variants without changing the Material path.
This commit is contained in:
@@ -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/settings/settings_animation_section.dart';
|
||||
@@ -18,55 +17,42 @@ class _Store implements QuickSwitchAnimationStore {
|
||||
}
|
||||
|
||||
void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets('chooses and saves quick switch animation ($cupertino)', (
|
||||
tester,
|
||||
) async {
|
||||
final store = _Store();
|
||||
final controller = QuickSwitchAnimationController(store: store);
|
||||
final speed = AnimationSpeedController();
|
||||
final child = SettingsAnimationSection(
|
||||
controller: speed,
|
||||
quickSwitchController: controller,
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(
|
||||
home: CupertinoPageScaffold(
|
||||
child: SingleChildScrollView(child: child),
|
||||
),
|
||||
)
|
||||
: MaterialApp(
|
||||
home: Scaffold(body: SingleChildScrollView(child: child)),
|
||||
),
|
||||
);
|
||||
expect(find.text('Quick switch animation'), findsOneWidget);
|
||||
expect(
|
||||
cupertino ? find.byType(CupertinoSlider) : find.byType(Slider),
|
||||
findsOneWidget,
|
||||
);
|
||||
await tester.tap(find.text('Tape'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Card deck').last);
|
||||
await tester.pumpAndSettle();
|
||||
expect(controller.value, QuickSwitchAnimation.cardStack);
|
||||
expect(store.saved, 'cardStack');
|
||||
expect(
|
||||
find.text(QuickSwitchAnimation.cardStack.description),
|
||||
findsOneWidget,
|
||||
);
|
||||
store.success = false;
|
||||
await tester.tap(find.text('Card deck'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Swap').last);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
find.text('Could not save; applies until reload.'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
controller.dispose();
|
||||
speed.dispose();
|
||||
});
|
||||
}
|
||||
testWidgets('chooses and saves quick switch animation', (tester) async {
|
||||
final store = _Store();
|
||||
final controller = QuickSwitchAnimationController(store: store);
|
||||
final speed = AnimationSpeedController();
|
||||
final child = SettingsAnimationSection(
|
||||
controller: speed,
|
||||
quickSwitchController: controller,
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(body: SingleChildScrollView(child: child)),
|
||||
),
|
||||
);
|
||||
expect(find.text('Quick switch animation'), findsOneWidget);
|
||||
expect(find.byType(Slider), findsOneWidget);
|
||||
await tester.tap(find.text('Tape'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Card deck').last);
|
||||
await tester.pumpAndSettle();
|
||||
expect(controller.value, QuickSwitchAnimation.cardStack);
|
||||
expect(store.saved, 'cardStack');
|
||||
expect(
|
||||
find.text(QuickSwitchAnimation.cardStack.description),
|
||||
findsOneWidget,
|
||||
);
|
||||
store.success = false;
|
||||
await tester.tap(find.text('Card deck'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Swap').last);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
find.text('Could not save; applies until reload.'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
controller.dispose();
|
||||
speed.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user