Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
233 lines
8.1 KiB
Dart
233 lines
8.1 KiB
Dart
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());
|
|
});
|
|
}
|