Move editor UI into the app and release verified Core dependencies (#14)
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
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
This commit was merged in pull request #14.
This commit is contained in:
1 parent
abc1868550
commit
06f1c26681
452 files changed
+43806
-2329
No files matched your search
@@ -0,0 +1,100 @@
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:timeline_ui_example/main.dart';
|
||||
|
||||
void main() {
|
||||
const second = TimelineClock.ticksPerSecond;
|
||||
final toggle = find.byKey(const Key('playback-toggle'));
|
||||
TimelineViewController controller(WidgetTester tester) => tester
|
||||
.widget<TimelineView>(find.byKey(const Key('timeline-surface')))
|
||||
.controller;
|
||||
|
||||
testWidgets('play, pause and resume advance only presentation time', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const TimelineExampleApp());
|
||||
final c = controller(tester);
|
||||
final original = c.version;
|
||||
c.seekTo(2 * second);
|
||||
await tester.tap(toggle);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(seconds: 2));
|
||||
expect(c.playheadTick, 4 * second);
|
||||
expect(find.byTooltip('暂停 / Pause'), findsOneWidget);
|
||||
await tester.tap(toggle);
|
||||
await tester.pump(const Duration(seconds: 3));
|
||||
expect(c.playheadTick, 4 * second);
|
||||
expect(find.byTooltip('播放 / Play'), findsOneWidget);
|
||||
await tester.tap(toggle);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
expect(c.playheadTick, 4 * second + second ~/ 2);
|
||||
expect(c.version, same(original));
|
||||
expect(c.canUndo, isFalse);
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('seek rebases playback; end pauses and play restarts', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const TimelineExampleApp());
|
||||
final c = controller(tester);
|
||||
final end = c.version.kernelVersion.query().storylineSpan(c.storyline);
|
||||
await tester.tap(toggle);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
c.seekTo(10 * second);
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
expect(c.playheadTick, 11 * second);
|
||||
c.seekTo(end - second ~/ 2);
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
expect(c.playheadTick, end);
|
||||
expect(find.byTooltip('播放 / Play'), findsOneWidget);
|
||||
await tester.pump(const Duration(seconds: 2));
|
||||
expect(c.playheadTick, end);
|
||||
await tester.tap(toggle);
|
||||
await tester.pump();
|
||||
expect(c.playheadTick, 0);
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
expect(c.playheadTick, second);
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
});
|
||||
|
||||
testWidgets('scene switch pauses the previous playhead', (tester) async {
|
||||
await tester.pumpWidget(const TimelineExampleApp());
|
||||
final short = controller(tester);
|
||||
await tester.tap(toggle);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
await tester.tap(find.byTooltip('切换场景 / Switch scene'));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 300));
|
||||
await tester.tap(find.text('3 小时 / 3 hours'));
|
||||
await tester.pump();
|
||||
final stopped = short.playheadTick;
|
||||
await tester.pumpAndSettle();
|
||||
expect(controller(tester), isNot(same(short)));
|
||||
expect(find.byTooltip('播放 / Play'), findsOneWidget);
|
||||
await tester.pump(const Duration(seconds: 2));
|
||||
expect(short.playheadTick, stopped);
|
||||
expect(controller(tester).playheadTick, 0);
|
||||
});
|
||||
|
||||
testWidgets('backgrounding pauses playback', (tester) async {
|
||||
await tester.pumpWidget(const TimelineExampleApp());
|
||||
final c = controller(tester);
|
||||
await tester.tap(toggle);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive);
|
||||
await tester.pump(const Duration(seconds: 2));
|
||||
expect(c.playheadTick, second);
|
||||
expect(find.byTooltip('播放 / Play'), findsOneWidget);
|
||||
tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed);
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
expect(c.playheadTick, second);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user