feat(workspace): refresh desktop editing experience and prepare 0.1.2
Gitea CI / Build Android APK (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 0s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Check code and tests (pull_request) Canceled after 6m29s
Gitea CI / Build Android APK (pull_request) Canceled after 0s
Gitea CI / Build Windows x64 app (pull_request) Canceled after 0s
Gitea CI / Audit and package Windows x64 (pull_request) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s
Gitea CI / Check code and tests (pull_request) Canceled after 6m29s
This commit is contained in:
1 parent
aa5255d1e4
commit
2e0033ce2d
260 files changed
+43963
-5591
No files matched your search
@@ -0,0 +1,232 @@
|
||||
import 'package:cutdex/app/editor_theme.dart';
|
||||
import 'package:cutdex/features/preview/preview_panel.dart';
|
||||
import 'package:cutdex/features/properties/picture_properties.dart';
|
||||
import 'package:cutdex/features/properties/audio_properties.dart';
|
||||
import 'package:cutdex/features/properties/speed_properties.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex/l10n/app_localizations.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(
|
||||
'audio and speed controls fit desktop group headers at narrow widths',
|
||||
(tester) async {
|
||||
final f = (await tester.runAsync(
|
||||
() => createPreviewFixture(Uri.file('/test/video.mov'), hasAudio: true),
|
||||
))!;
|
||||
addTearDown(
|
||||
() => tester.runAsync(() async {
|
||||
await f.workspace.close();
|
||||
await f.directory.delete(recursive: true);
|
||||
}),
|
||||
);
|
||||
final query = f.timeline
|
||||
.view(SequenceId('one'))
|
||||
.version
|
||||
.kernelVersion
|
||||
.query();
|
||||
final clip = query.element(query.elementById(ElementId('clip'))!);
|
||||
for (final width in [220.0, 280.0, 360.0]) {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
locale: const Locale('zh'),
|
||||
theme: AppTheme.propertiesPanelTheme(
|
||||
EditorTheme.desktop(EditorTheme.penDark),
|
||||
),
|
||||
home: Scaffold(
|
||||
body: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
AudioProperties(
|
||||
session: f.timeline,
|
||||
sequence: SequenceId('one'),
|
||||
clip: clip,
|
||||
hasAudio: true,
|
||||
),
|
||||
SpeedProperties(
|
||||
session: f.timeline,
|
||||
sequence: SequenceId('one'),
|
||||
clip: clip.id,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final field = find.descendant(
|
||||
of: find.byKey(const Key('audio-db')),
|
||||
matching: find.byType(TextField),
|
||||
);
|
||||
expect(tester.getSize(field).height, 28);
|
||||
expect(
|
||||
tester.getRect(find.byKey(const Key('audio-key'))).bottom,
|
||||
tester.getRect(field).top - 4,
|
||||
);
|
||||
expect(find.byType(AppPropertyGroup), findsNWidgets(2));
|
||||
expect(tester.takeException(), isNull);
|
||||
}
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('desktop transform grid fits narrow panels in all six themes', (
|
||||
tester,
|
||||
) async {
|
||||
final f = (await tester.runAsync(
|
||||
() =>
|
||||
createPreviewFixture(Uri.file('/test/photo.png'), mediaType: 'image'),
|
||||
))!;
|
||||
addTearDown(
|
||||
() => tester.runAsync(() async {
|
||||
await f.workspace.close();
|
||||
await f.directory.delete(recursive: true);
|
||||
}),
|
||||
);
|
||||
final project = f.workspace.project!.info.id;
|
||||
final query = f.timeline
|
||||
.view(SequenceId('one'))
|
||||
.version
|
||||
.kernelVersion
|
||||
.query();
|
||||
final clip = query.element(query.elementById(ElementId('clip'))!);
|
||||
final container = ProviderContainer(
|
||||
overrides: [
|
||||
editorPreviewProvider(project, 'project').overrideWith((ref) => null),
|
||||
],
|
||||
);
|
||||
addTearDown(container.dispose);
|
||||
Finder input(String name) => find.descendant(
|
||||
of: find.byKey(ValueKey('picture-$name')),
|
||||
matching: find.byType(TextField),
|
||||
);
|
||||
for (final palette in AppPalette.values) {
|
||||
for (final brightness in Brightness.values) {
|
||||
for (final (width, locale) in [
|
||||
(220.0, 'de'),
|
||||
(280.0, 'zh'),
|
||||
(360.0, 'en'),
|
||||
]) {
|
||||
await tester.pumpWidget(
|
||||
UncontrolledProviderScope(
|
||||
container: container,
|
||||
child: MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
locale: Locale(locale),
|
||||
theme: AppTheme.propertiesPanelTheme(
|
||||
EditorTheme.desktop(
|
||||
EditorTheme.forPalette(palette, brightness),
|
||||
),
|
||||
),
|
||||
home: Scaffold(
|
||||
body: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
child: SingleChildScrollView(
|
||||
child: PictureProperties(
|
||||
projectId: project,
|
||||
timelineId: 'project',
|
||||
session: f.timeline,
|
||||
sequence: SequenceId('one'),
|
||||
clip: clip,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
for (final name in ['x', 'y', 'scale-x', 'scale-y', 'rotation']) {
|
||||
expect(tester.getSize(input(name)).height, 28);
|
||||
}
|
||||
expect(tester.getRect(input('x')).left, 12);
|
||||
expect(tester.getRect(input('x')).width, (width - 28) / 2);
|
||||
for (final name in ['x', 'y', 'scale-x', 'scale-y', 'rotation']) {
|
||||
final field = tester.widget<TextField>(input(name));
|
||||
expect(field.decoration!.prefixIcon, isNotNull);
|
||||
}
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const ValueKey('picture-rotation')),
|
||||
matching: find.byIcon(AppIcons.angle),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
final xLabel = find.descendant(
|
||||
of: find.byKey(const ValueKey('picture-x')),
|
||||
matching: find.text('X'),
|
||||
);
|
||||
expect(
|
||||
tester.getRect(xLabel).center.dy,
|
||||
tester.getRect(input('x')).center.dy,
|
||||
);
|
||||
final right = tester
|
||||
.getRect(find.byKey(const ValueKey('picture-key-position')))
|
||||
.right;
|
||||
for (final channel in ['position', 'scale', 'rotation']) {
|
||||
final action = find.byKey(ValueKey('picture-key-$channel'));
|
||||
expect(tester.getSize(action), const Size.square(24));
|
||||
expect(tester.getRect(action).right, right);
|
||||
final field = input(
|
||||
channel == 'position'
|
||||
? 'x'
|
||||
: channel == 'scale'
|
||||
? 'scale-x'
|
||||
: 'rotation',
|
||||
);
|
||||
expect(
|
||||
tester.getRect(action).bottom,
|
||||
tester.getRect(field).top - 4,
|
||||
);
|
||||
}
|
||||
expect(right, width - 12);
|
||||
expect(
|
||||
tester.getRect(input('x')).left,
|
||||
tester.getRect(input('rotation')).left,
|
||||
);
|
||||
if (width >= 220) {
|
||||
expect(
|
||||
tester.getCenter(input('x')).dy,
|
||||
tester.getCenter(input('y')).dy,
|
||||
);
|
||||
expect(
|
||||
tester.getCenter(input('scale-x')).dy,
|
||||
tester.getCenter(input('scale-y')).dy,
|
||||
);
|
||||
expect(
|
||||
tester.getRect(input('rotation')).top -
|
||||
tester.getRect(input('scale-x')).bottom,
|
||||
40,
|
||||
);
|
||||
}
|
||||
expect(
|
||||
tester.takeException(),
|
||||
isNull,
|
||||
reason: '$palette $brightness $locale $width',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user