mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-28 23:25:52 +01:00
Rename the Dart package, Android and iOS identifiers, Rust crates, native libraries, and Discord plugin. Preserve legacy data readers and compatibility aliases. Update localized branding, documentation, artwork, build tooling, and release artifacts. Route Telegram release notifications to @mornyeupdates and link @mornyecommunity.
85 lines
2.6 KiB
Dart
85 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:material_3_expressive/material_3_expressive.dart';
|
|
import 'package:mornye/theme/app_motion.dart';
|
|
import 'package:mornye/theme/app_theme.dart';
|
|
import 'package:mornye/theme/mornye_theme.dart';
|
|
|
|
void main() {
|
|
test('spring curves start at rest and settle within their duration', () {
|
|
for (final spring in [
|
|
M3EMotion.expressiveSpatialFast,
|
|
M3EMotion.expressiveSpatialDefault,
|
|
M3EMotion.expressiveSpatialSlow,
|
|
M3EMotion.effectsFast,
|
|
M3EMotion.effectsDefault,
|
|
]) {
|
|
final curve = SpringCurve(spring);
|
|
expect(curve.transform(0), 0);
|
|
expect(curve.transform(1), 1);
|
|
expect(curve.transform(0.98), closeTo(1, 0.01));
|
|
expect(curve.duration.inMilliseconds, inInclusiveRange(100, 1200));
|
|
}
|
|
});
|
|
|
|
test('spatial springs overshoot while effects springs do not', () {
|
|
double peak(SpringCurve curve) => [
|
|
for (var t = 0.0; t <= 1; t += 0.01) curve.transform(t),
|
|
].reduce((a, b) => a > b ? a : b);
|
|
|
|
expect(
|
|
peak(SpringCurve(M3EMotion.expressiveSpatialDefault)),
|
|
greaterThan(1),
|
|
);
|
|
expect(peak(SpringCurve(M3EMotion.effectsDefault)), lessThanOrEqualTo(1));
|
|
});
|
|
|
|
Future<AppMotionSpec> resolve(
|
|
WidgetTester tester, {
|
|
required ThemeData theme,
|
|
bool reduceMotion = false,
|
|
}) async {
|
|
late AppMotionSpec spec;
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: theme,
|
|
home: MediaQuery(
|
|
data: MediaQueryData(disableAnimations: reduceMotion),
|
|
child: Builder(
|
|
builder: (context) {
|
|
spec = AppMotion.spatial(
|
|
context,
|
|
const AppMotionSpec(
|
|
Duration(milliseconds: 250),
|
|
Curves.easeOutCubic,
|
|
),
|
|
);
|
|
return const SizedBox();
|
|
},
|
|
),
|
|
),
|
|
),
|
|
);
|
|
// MaterialApp animates theme changes between pumps.
|
|
await tester.pumpAndSettle();
|
|
return spec;
|
|
}
|
|
|
|
testWidgets(
|
|
'Material uses springs; Mornye and reduced motion keep fallback',
|
|
(tester) async {
|
|
expect(
|
|
(await resolve(tester, theme: AppTheme.light())).curve,
|
|
isA<SpringCurve>(),
|
|
);
|
|
for (final spec in [
|
|
await resolve(tester, theme: MornyeTheme.build(Brightness.light)),
|
|
await resolve(tester, theme: AppTheme.light(), reduceMotion: true),
|
|
]) {
|
|
expect(spec.curve, Curves.easeOutCubic);
|
|
expect(spec.duration, const Duration(milliseconds: 250));
|
|
}
|
|
},
|
|
);
|
|
}
|