mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-21 20:00:49 +01:00
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.
52 lines
1.7 KiB
Dart
52 lines
1.7 KiB
Dart
import 'package:flutter/gestures.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/theme/mornye_theme.dart';
|
|
import 'package:mornye/utils/desktop_platform.dart';
|
|
|
|
void main() {
|
|
tearDown(() => debugDesktopPlatformOverride = null);
|
|
|
|
for (final (style, delay) in [('Material', 500), ('Mornye', 800)]) {
|
|
ThemeData theme() => style == 'Mornye'
|
|
? MornyeTheme.build(Brightness.light)
|
|
: AppTheme.light();
|
|
|
|
testWidgets('$style desktop tooltips wait $delay ms for a hover', (
|
|
tester,
|
|
) async {
|
|
debugDesktopPlatformOverride = true;
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: theme(),
|
|
home: const Scaffold(
|
|
body: Center(
|
|
child: Tooltip(message: 'Shuffle', child: Icon(Icons.shuffle)),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
|
|
addTearDown(mouse.removePointer);
|
|
await mouse.addPointer(location: Offset.zero);
|
|
await mouse.moveTo(tester.getCenter(find.byIcon(Icons.shuffle)));
|
|
await tester.pump();
|
|
|
|
await tester.pump(Duration(milliseconds: delay - 100));
|
|
expect(find.text('Shuffle'), findsNothing);
|
|
await tester.pump(const Duration(milliseconds: 150));
|
|
await tester.pump(const Duration(milliseconds: 200));
|
|
expect(find.text('Shuffle'), findsOneWidget);
|
|
|
|
await mouse.moveTo(Offset.zero);
|
|
await tester.pumpAndSettle();
|
|
});
|
|
|
|
test('$style phones keep the platform tooltip timing', () {
|
|
debugDesktopPlatformOverride = false;
|
|
expect(theme().tooltipTheme.waitDuration, isNull);
|
|
});
|
|
}
|
|
}
|