Files
SpotiFLAC-Mobile/test/app_progress_indicator_test.dart
zarzet 962e582acc chore(flutter): move to Flutter 3.50.0 and the material_ui packages
Flutter 3.50 deprecates its built-in Material and Cupertino libraries in
favour of the material_ui and cupertino_ui packages. The imports move
with the official fix (dart fix, migrate_design_widgets); the app's old
two-library theme bridge collapses into one Theme type.

- MaterialExpressiveScope keeps the complete host theme nearest its
  child. The reduced copy made for the expressive widgets now shares the
  app's Theme type and would hide component themes and extensions.
- LegacyThemeBrightness hands the brightness to the glass package, which
  still reads Flutter's built-in theme.
- appLocalizationsDelegates lists the material_ui localization delegates;
  the generated list still names the built-in ones.
- Tests: findByTooltip and pageBack replace the flutter_test helpers that
  only know the built-in widgets, and several tests that had gone stale
  against earlier app changes are repaired.
2026-11-15 23:33:29 +07:00

49 lines
1.6 KiB
Dart

import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mornye/theme/app_theme.dart';
import 'package:mornye/widgets/app_progress_indicator.dart';
void main() {
for (final circular in [false, true]) {
testWidgets('${circular ? 'circular' : 'linear'} wave only ticks while '
'it is drawn wavy', (tester) async {
final progress = ValueNotifier<double?>(null);
addTearDown(progress.dispose);
await tester.pumpWidget(
MaterialApp(
theme: AppTheme.light(),
home: Scaffold(
body: Center(
child: SizedBox(
width: 200,
height: 48,
child: ValueListenableBuilder(
valueListenable: progress,
builder: (context, value, _) => circular
? AppProgressIndicator.circular(value: value)
: AppProgressIndicator.linear(value: value),
),
),
),
),
),
);
Future<bool> ticks(double? value) async {
progress.value = value;
await tester.pump(const Duration(milliseconds: 16));
await tester.pump(const Duration(milliseconds: 16));
return tester.binding.hasScheduledFrame;
}
for (final value in [0.0, 0.05, 0.1, 0.95, 0.99, 1.0]) {
expect(await ticks(value), isFalse, reason: 'value $value');
}
for (final value in [null, 0.11, 0.5, 0.94]) {
expect(await ticks(value), isTrue, reason: 'value $value');
}
expect(await ticks(0.05), isFalse);
});
}
}