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
124 lines
4.3 KiB
Dart
124 lines
4.3 KiB
Dart
import 'package:cutdex/app/editor_theme.dart';
|
|
import 'package:cutdex/features/preview/preview_panel.dart';
|
|
import 'package:cutdex/features/properties/distortion_properties.dart';
|
|
import 'package:cutdex/l10n/app_localizations.dart';
|
|
import 'package:cutdex_core/editor.dart';
|
|
import 'package:cutdex_core/timeline/model.dart';
|
|
import 'package:cutdex_core/timeline/engine.dart';
|
|
import 'package:cutdex_ui/theme.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'support/preview_fixture.dart';
|
|
|
|
void main() {
|
|
testWidgets(
|
|
'four corner fields use paired keys; reset preserves animation; no px',
|
|
(tester) async {
|
|
final f = (await tester.runAsync(
|
|
() => createPreviewFixture(
|
|
Uri.file('/test/video.mov'),
|
|
clipDuration: RationalTime.seconds(5),
|
|
),
|
|
))!;
|
|
addTearDown(
|
|
() => tester.runAsync(() async {
|
|
await f.workspace.close();
|
|
await f.directory.delete(recursive: true);
|
|
}),
|
|
);
|
|
final sequence = SequenceId('one'),
|
|
clip = ElementId('clip'),
|
|
project = f.workspace.project!.info.id;
|
|
final view = f.timeline.view(sequence);
|
|
ElementRecord record() {
|
|
final q = view.version.kernelVersion.query();
|
|
return q.element(q.elementById(clip)!);
|
|
}
|
|
|
|
await tester.pumpWidget(
|
|
ProviderScope(
|
|
overrides: [
|
|
editorPreviewProvider(
|
|
project,
|
|
'project',
|
|
).overrideWith((ref) => null),
|
|
],
|
|
child: MaterialApp(
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
locale: const Locale('zh'),
|
|
theme: AppTheme.propertiesPanelTheme(
|
|
EditorTheme.desktop(EditorTheme.penDark),
|
|
),
|
|
home: Scaffold(
|
|
body: Align(
|
|
alignment: Alignment.topRight,
|
|
child: SizedBox(
|
|
width: 240,
|
|
child: SingleChildScrollView(
|
|
child: DistortionProperties(
|
|
projectId: project,
|
|
timelineId: 'project',
|
|
session: f.timeline,
|
|
sequence: sequence,
|
|
clip: clip,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
Future<void> settle() async {
|
|
await tester.pump();
|
|
await tester.runAsync(f.timeline.flush);
|
|
await tester.pumpAndSettle();
|
|
expect(tester.takeException(), isNull);
|
|
}
|
|
|
|
await settle();
|
|
expect(find.text('变形'), findsOneWidget);
|
|
expect(find.text('px'), findsNothing);
|
|
expect(find.text('X'), findsNWidgets(4));
|
|
expect(find.text('Y'), findsNWidgets(4));
|
|
expect(find.byType(TextField), findsNWidgets(8));
|
|
final key = find.byKey(const ValueKey('distortion-topLeft-key'));
|
|
await tester.tap(key);
|
|
await settle();
|
|
for (final id in ClipDistortion.ids.take(2)) {
|
|
expect(record().parameters![id]!.length, 1);
|
|
}
|
|
view.seekTo(TimelineClock.ticksPerSecond);
|
|
await settle();
|
|
final input = find.descendant(
|
|
of: find.byKey(const ValueKey('distortion-topLeft-y')),
|
|
matching: find.byType(TextField),
|
|
);
|
|
await tester.enterText(input, '20');
|
|
await tester.testTextInput.receiveAction(TextInputAction.done);
|
|
await settle();
|
|
for (final id in ClipDistortion.ids.take(2)) {
|
|
expect(record().parameters![id]!.length, 2);
|
|
}
|
|
final y = record().parameters![ClipDistortion.ids[1]]!;
|
|
expect(y.valueAt(TimelineClock.ticksPerSecond), greaterThan(0));
|
|
for (final id in ClipDistortion.ids.skip(2)) {
|
|
expect(record().parameters?[id]?.length ?? 0, 0);
|
|
}
|
|
await tester.tap(find.byKey(const ValueKey('distortion-reset')));
|
|
await settle();
|
|
expect(record().parameters![ClipDistortion.ids[1]]!.length, 2);
|
|
expect(
|
|
record().parameters![ClipDistortion.ids[1]]!.valueAt(
|
|
TimelineClock.ticksPerSecond,
|
|
),
|
|
0,
|
|
);
|
|
await tester.pumpWidget(const SizedBox());
|
|
},
|
|
);
|
|
}
|