Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
116 lines
3.8 KiB
Dart
116 lines
3.8 KiB
Dart
import 'package:cutdex/app/editor_theme.dart';
|
|
import 'package:cutdex/features/preview/fullscreen_playback_bar.dart';
|
|
import 'package:cutdex/l10n/l10n.dart';
|
|
import 'package:cutdex_core/timeline/model.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
testWidgets(
|
|
'fullscreen transport previews during dragging and settles on release',
|
|
(tester) async {
|
|
final seeks = <int>[];
|
|
final updates = <int>[];
|
|
final ends = <int>[];
|
|
var starts = 0;
|
|
var plays = 0;
|
|
var exits = 0;
|
|
const second = TimelineClock.ticksPerSecond;
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: EditorTheme.penDark,
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
locale: const Locale('en'),
|
|
home: Scaffold(
|
|
body: Center(
|
|
child: SizedBox(
|
|
width: 560,
|
|
child: FullscreenPlaybackBar(
|
|
positionTick: second,
|
|
durationTick: 48 * 60 * second,
|
|
frameTick: second ~/ 30,
|
|
playing: false,
|
|
onPlayPause: () => plays++,
|
|
onSeek: seeks.add,
|
|
onExit: () => exits++,
|
|
onScrubStart: () => starts++,
|
|
onScrubUpdate: updates.add,
|
|
onScrubEnd: ends.add,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
expect(find.text('00:01'), findsOneWidget);
|
|
expect(find.text('-47:59'), findsOneWidget);
|
|
await tester.tap(find.byTooltip('Play'));
|
|
await tester.tap(find.byTooltip('Exit fullscreen'));
|
|
expect(plays, 1);
|
|
expect(exits, 1);
|
|
await tester.tap(find.byTooltip('Previous frame'));
|
|
await tester.tap(find.byTooltip('Next frame'));
|
|
expect(seeks, [second - second ~/ 30, second + second ~/ 30]);
|
|
seeks.clear();
|
|
final rect = tester.getRect(find.byKey(const Key('fullscreen-progress')));
|
|
final gesture = await tester.startGesture(
|
|
Offset(rect.left + 20, rect.center.dy),
|
|
);
|
|
await gesture.moveTo(rect.center);
|
|
await tester.pump();
|
|
expect(seeks, isEmpty);
|
|
expect(starts, 1);
|
|
expect(updates, isNotEmpty);
|
|
expect(updates.last, closeTo(24 * 60 * second, second));
|
|
expect(ends, isEmpty);
|
|
await gesture.up();
|
|
await tester.pump();
|
|
expect(ends, hasLength(1));
|
|
expect(ends.single, closeTo(24 * 60 * second, second));
|
|
await tester.tap(find.byTooltip('Go to start'));
|
|
expect(seeks.last, 0);
|
|
expect(tester.takeException(), isNull);
|
|
},
|
|
);
|
|
|
|
testWidgets('empty fullscreen transport stays usable at narrow widths', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
locale: const Locale('en'),
|
|
home: Scaffold(
|
|
body: Center(
|
|
child: SizedBox(
|
|
width: 280,
|
|
child: FullscreenPlaybackBar(
|
|
positionTick: 0,
|
|
durationTick: 0,
|
|
frameTick: TimelineClock.ticksPerSecond ~/ 30,
|
|
playing: false,
|
|
onPlayPause: null,
|
|
onSeek: null,
|
|
onExit: () {},
|
|
onScrubStart: null,
|
|
onScrubUpdate: null,
|
|
onScrubEnd: null,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
expect(tester.widget<Slider>(find.byType(Slider)).onChanged, isNull);
|
|
expect(
|
|
tester
|
|
.widget<IconButton>(find.byKey(const Key('preview-fullscreen')))
|
|
.onPressed,
|
|
isNotNull,
|
|
);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
}
|