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,156 @@
|
||||
import 'package:cutdex/app/editor_theme.dart';
|
||||
import 'package:cutdex/features/preview/preview_panel.dart';
|
||||
import 'package:cutdex/features/properties/stroke_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_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(
|
||||
'stroke weight input and keyframe control edit only the selected property',
|
||||
(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');
|
||||
final view = f.timeline.view(sequence);
|
||||
final commands = f.timeline.commands;
|
||||
ClipStrokeStack current() {
|
||||
final query = view.version.kernelVersion.query();
|
||||
final handle = query.elementById(clip)!;
|
||||
return ClipStrokeStack(
|
||||
query.element(handle),
|
||||
view.playheadTick - query.absoluteStart(handle),
|
||||
);
|
||||
}
|
||||
|
||||
for (final id in ['a', 'b']) {
|
||||
commands.addStroke(
|
||||
sequence: sequence,
|
||||
clip: clip,
|
||||
tick: 0,
|
||||
strokeId: id,
|
||||
);
|
||||
}
|
||||
final project = f.workspace.project!.info.id;
|
||||
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: StrokeProperties(
|
||||
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();
|
||||
await tester.tap(find.byKey(const ValueKey('stroke-settings-a')));
|
||||
await settle();
|
||||
await tester.tap(find.byKey(const ValueKey('stroke-a-width-key')));
|
||||
await settle();
|
||||
final blurId = const StrokeParameterTarget('a', 'width').parameterId;
|
||||
expect(current().record.parameters?[blurId]?.length, 1);
|
||||
for (final id in current().parameterIds.where((id) => id != blurId)) {
|
||||
expect(current().record.parameters?[id]?.length, 0);
|
||||
}
|
||||
view.seekTo(TimelineClock.ticksPerSecond);
|
||||
await settle();
|
||||
final input = find.descendant(
|
||||
of: find.byKey(const ValueKey('stroke-a-width')),
|
||||
matching: find.byType(TextField),
|
||||
);
|
||||
await tester.enterText(input, '20');
|
||||
await tester.testTextInput.receiveAction(TextInputAction.done);
|
||||
await settle();
|
||||
expect(current().record.parameters?[blurId]?.length, 2);
|
||||
expect(current().layers.first.values['width'], 20);
|
||||
for (final id in current().parameterIds.where((id) => id != blurId)) {
|
||||
expect(current().record.parameters?[id]?.length, 0);
|
||||
}
|
||||
view.seekTo(TimelineClock.ticksPerSecond ~/ 2);
|
||||
expect(current().layers.last.values['width'], 1);
|
||||
expect(current().layers.first.values['width'], closeTo(10.5, .001));
|
||||
await settle();
|
||||
// Structural selectors and dash fields update statically without keyframe controls.
|
||||
await tester.tap(find.byKey(const ValueKey('stroke-a-alignment')));
|
||||
await settle();
|
||||
await tester.tap(find.text('外侧').last);
|
||||
await settle();
|
||||
expect(current().layers.first.alignment, ClipStrokeAlignment.outside);
|
||||
expect(
|
||||
find.byKey(const ValueKey('stroke-a-alignment-key')),
|
||||
findsNothing,
|
||||
);
|
||||
await tester.tap(find.byKey(const ValueKey('stroke-a-style')));
|
||||
await settle();
|
||||
await tester.tap(find.text('虚线').last);
|
||||
await settle();
|
||||
expect(find.byKey(const ValueKey('stroke-a-dashLength')), findsOneWidget);
|
||||
expect(
|
||||
find.byKey(const ValueKey('stroke-a-dashLength-key')),
|
||||
findsNothing,
|
||||
);
|
||||
expect(find.textContaining('px'), findsNothing);
|
||||
await tester.tap(find.byKey(const ValueKey('stroke-editor-close-a')));
|
||||
await settle();
|
||||
await tester.tap(find.byKey(const ValueKey('stroke-enabled-a')));
|
||||
await settle();
|
||||
expect(current().layers.first.enabled, isFalse);
|
||||
await tester.tap(find.byKey(const ValueKey('stroke-add')));
|
||||
await settle();
|
||||
expect(current().layers.length, 3);
|
||||
await tester.tap(find.byKey(const ValueKey('stroke-remove-a')));
|
||||
await settle();
|
||||
expect(current().layers.map((l) => l.id), isNot(contains('a')));
|
||||
expect(current().record.parameters?[blurId], isNull);
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user