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

This commit is contained in:
lingjhf committed 2026-10-09 01:56:01 +08:00
1 parent aa5255d1e4
commit 2e0033ce2d
260 files changed
+43963 -5591

No files matched your search

+149
View File
@@ -1,4 +1,7 @@
import 'package:cutdex/app/editor_theme.dart';
import 'package:cutdex/features/properties/project_properties.dart';
import 'package:cutdex/features/properties/project_property_row.dart';
import 'package:cutdex_ui/theme.dart';
import 'dart:async';
@@ -16,6 +19,152 @@ import 'package:flutter_test/flutter_test.dart';
import 'support/preview_fixture.dart';
void main() {
testWidgets('desktop project values share a right edge across labels', (
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);
}),
);
for (final locale in ['en', 'zh', 'de']) {
for (final width in [220.0, 260.0, 320.0]) {
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
locale: Locale(locale),
theme: EditorTheme.desktop(EditorTheme.penLight),
home: Scaffold(
body: Align(
alignment: Alignment.topLeft,
child: SizedBox(
width: width,
height: 600,
child: ProjectProperties(session: f.timeline),
),
),
),
),
);
await tester.pumpAndSettle();
final panelRight = tester.getRect(find.byType(ProjectProperties)).right;
expect(
tester
.getSize(find.byKey(const ValueKey('project-settings-edit')))
.height,
28,
);
final rows = find.byWidgetPredicate(
(widget) => widget.runtimeType.toString() == '_Info',
);
expect(rows, findsNWidgets(7));
for (var i = 0; i < 7; i++) {
final label = find
.descendant(of: rows.at(i), matching: find.byType(Text))
.first;
final value = find
.descendant(of: rows.at(i), matching: find.byType(Text))
.last;
expect(tester.widget<Text>(value).textAlign, TextAlign.right);
expect(
tester.getTopLeft(label).dy,
closeTo(tester.getTopLeft(value).dy, .01),
);
expect(tester.getRect(label).left, AppInspectorMetrics.padding);
expect(
find.descendant(
of: rows.at(i),
matching: find.byType(ProjectPropertyRow),
),
findsOneWidget,
);
expect(
tester.getRect(value).right,
panelRight - AppInspectorMetrics.padding,
reason: '$locale at $width: ${tester.widget<Text>(value).data}',
);
}
expect(tester.takeException(), isNull);
}
}
await tester.pumpWidget(const SizedBox());
});
testWidgets(
'long desktop project metadata fits narrow panels in every theme',
(tester) async {
const name = '海边日落与城市漫游 · 旅行短片的最终版本 / Very long sequence name';
for (final palette in AppPalette.values) {
for (final brightness in Brightness.values) {
for (final width in [220.0, 280.0, 320.0]) {
await tester.pumpWidget(
MaterialApp(
theme: AppTheme.desktopWorkspaceTheme(
AppTheme.forPalette(palette, brightness),
),
home: Scaffold(
body: Align(
alignment: Alignment.topLeft,
child: SizedBox(
width: width,
child: const MediaQuery(
data: MediaQueryData(
textScaler: TextScaler.linear(1.3),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ProjectPropertyRow(label: '时间线名称', value: name),
ProjectPropertyRow(
label: '项目色彩空间',
value: 'HDR · Rec.2020 HLG',
),
ProjectPropertyRow(
label: '画布大小',
value: '3840 × 2160 px',
),
],
),
),
),
),
),
),
);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
for (final row in find.byType(ProjectPropertyRow).evaluate()) {
final texts = find.descendant(
of: find.byWidget(row.widget),
matching: find.byType(Text),
);
expect(tester.getRect(texts.first).left, 12);
expect(tester.getRect(texts.last).right, width - 12);
expect(
tester.getTopLeft(texts.first).dy,
closeTo(tester.getTopLeft(texts.last).dy, .01),
);
}
}
}
}
final tooltip = find.ancestor(
of: find.text(name),
matching: find.byType(Tooltip),
);
tester.state<TooltipState>(tooltip).ensureTooltipVisible();
await tester.pumpAndSettle();
expect(find.text(name), findsNWidgets(2));
await tester.pumpWidget(const SizedBox());
},
);
testWidgets('timeline switch does not expose the previous session', (
tester,
) async {