Files
pipelines/app/test/features/settings/settings_animation_section_test.dart
alan a7c41063fa 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.
2026-11-11 05:05:57 +00:00

48 lines
1.5 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/settings/settings_animation_section.dart';
import 'package:pipelines_app/ui/motion/animation_speed.dart';
class _Store implements AnimationSpeedStore {
double? saved;
@override
Future<double?> load() async => saved;
@override
Future<bool> save(double speed) async {
saved = speed;
return true;
}
}
void main() {
tearDown(() => timeDilation = 1);
testWidgets(
'layout slider updates global speed and Reset restores normal',
(tester) async {
final store = _Store();
final controller = AnimationSpeedController(store: store);
final section = SettingsAnimationSection(controller: controller);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(body: SingleChildScrollView(child: section)),
),
);
final slider = tester.widget<Slider>(find.byType(Slider));
slider.onChanged!(1.8);
slider.onChangeEnd!(1.8);
await tester.pump();
expect(find.text('1.8×'), findsWidgets);
expect(timeDilation, closeTo(1 / 1.8, 0.001));
expect(store.saved, 1.8);
await tester.tap(find.text('Reset'));
await tester.pump();
expect(controller.speed, 1);
expect(timeDilation, 1);
expect(store.saved, 1);
expect(tester.takeException(), isNull);
controller.dispose();
},
);
}