feat(inspector): edit animated effects, strokes and corner distortion
Replace the shadow-only inspector with layered effect and stroke controls and per-corner distortion editors. Share color inputs, layer rows, keyframe controls and property edit boundaries; keep nested selection menus within their property popover and update localized labels. Add property editing, preview interaction and benchmark comparison coverage. Validation: Dart analysis reports no issues and 160 targeted application tests pass. The macOS development app was rebuilt and visually checked during native rendering validation. Exclude local dependency override changes from the committed lockfile.
This commit is contained in:
1 parent
8d1f8db7e8
commit
789af7a68e
58 files changed
+6911
-1972
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_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/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