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.
200 lines
6.8 KiB
Dart
200 lines
6.8 KiB
Dart
import 'package:cutdex/app/editor_theme.dart';
|
|
import 'package:cutdex/features/preview/preview_panel.dart';
|
|
import 'package:cutdex/features/properties/effect_properties.dart';
|
|
import 'package:cutdex/features/properties/effect_labels.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(
|
|
'blur 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;
|
|
ClipEffectStack current() {
|
|
final query = view.version.kernelVersion.query();
|
|
final handle = query.elementById(clip)!;
|
|
return ClipEffectStack(
|
|
query.element(handle),
|
|
view.playheadTick - query.absoluteStart(handle),
|
|
);
|
|
}
|
|
|
|
for (final id in ['a', 'b']) {
|
|
commands.addEffect(
|
|
sequence: sequence,
|
|
clip: clip,
|
|
tick: 0,
|
|
effectId: id,
|
|
type: ClipEffectType.dropShadow,
|
|
);
|
|
}
|
|
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: EffectProperties(
|
|
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('effect-settings-a')));
|
|
await settle();
|
|
await tester.tap(find.byKey(const ValueKey('effect-a-blur-key')));
|
|
await settle();
|
|
final blurId = const EffectParameterTarget('a', 'blur').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('effect-a-blur')),
|
|
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['blur'], 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['blur'], 8);
|
|
expect(current().layers.first.values['blur'], closeTo(14, .001));
|
|
await settle();
|
|
await tester.pumpWidget(const SizedBox());
|
|
},
|
|
);
|
|
|
|
for (final type in ClipEffectType.values) {
|
|
testWidgets('${type.name} exposes valid controls at 240 width', (
|
|
tester,
|
|
) async {
|
|
final f = (await tester.runAsync(
|
|
() => createPreviewFixture(Uri.file('/test/video.mov')),
|
|
))!;
|
|
addTearDown(
|
|
() => tester.runAsync(() async {
|
|
await f.workspace.close();
|
|
await f.directory.delete(recursive: true);
|
|
}),
|
|
);
|
|
final sequence = SequenceId('one'), clip = ElementId('clip');
|
|
f.timeline.commands.addEffect(
|
|
sequence: sequence,
|
|
clip: clip,
|
|
tick: 0,
|
|
effectId: 'test',
|
|
type: type,
|
|
);
|
|
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: EffectProperties(
|
|
projectId: project,
|
|
timelineId: 'project',
|
|
session: f.timeline,
|
|
sequence: sequence,
|
|
clip: clip,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.runAsync(f.timeline.flush);
|
|
await tester.pumpAndSettle();
|
|
await tester.tap(find.byKey(const ValueKey('effect-settings-test')));
|
|
await tester.runAsync(f.timeline.flush);
|
|
await tester.pumpAndSettle();
|
|
expect(find.byKey(const ValueKey('effect-editor-test')), findsOneWidget);
|
|
expect(
|
|
find.text(type.label(tester.element(find.byType(EffectProperties)))),
|
|
findsWidgets,
|
|
);
|
|
expect(tester.takeException(), isNull);
|
|
await tester.runAsync(f.timeline.flush);
|
|
await tester.pumpWidget(const SizedBox());
|
|
});
|
|
}
|
|
}
|