feat(workspace): 桌面工作区、主题与交互更新,发布 0.1.2
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
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
This commit was merged in pull request #13.
This commit is contained in:
1 parent
aa5255d1e4
commit
abc1868550
260 files changed
+43964
-5591
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import 'package:cutdex/app/adaptive/desktop_workspace_controller.dart';
|
||||
import 'package:cutdex/shared/layout/workspace_layout_metrics.dart';
|
||||
import 'package:cutdex/app/shells/desktop_workspace_shell.dart';
|
||||
import 'package:cutdex/workspace/workspace_mode.dart';
|
||||
import 'package:cutdex/features/editor/layouts/expanded_editor_layout.dart';
|
||||
@@ -6,66 +7,65 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'properties divider spans the preview card including its header',
|
||||
(tester) async {
|
||||
tester.view.physicalSize = const Size(1000, 800);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
var showProperties = true;
|
||||
late StateSetter update;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: StatefulBuilder(
|
||||
builder: (context, setState) {
|
||||
update = setState;
|
||||
return ExpandedEditorLayout(
|
||||
preview: const SizedBox.expand(key: Key('test-preview')),
|
||||
header: const SizedBox(height: 40, key: Key('test-header')),
|
||||
properties: const SizedBox.expand(),
|
||||
media: const SizedBox(),
|
||||
showMedia: false,
|
||||
showProperties: showProperties,
|
||||
timelineHeight: 200,
|
||||
onTimelineHeightChanged: (_) {},
|
||||
onTimelineHeightChangeEnd: () {},
|
||||
timeline: const SizedBox(),
|
||||
);
|
||||
},
|
||||
),
|
||||
testWidgets('inspector has an independent frame aligned with the preview', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(1000, 800);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
var showProperties = true;
|
||||
late StateSetter update;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: StatefulBuilder(
|
||||
builder: (context, setState) {
|
||||
update = setState;
|
||||
return ExpandedEditorLayout(
|
||||
preview: const SizedBox.expand(key: Key('test-preview')),
|
||||
header: const SizedBox(height: 40, key: Key('test-header')),
|
||||
properties: const SizedBox.expand(),
|
||||
media: const SizedBox(),
|
||||
showMedia: false,
|
||||
showProperties: showProperties,
|
||||
timelineHeight: 200,
|
||||
onTimelineHeightChanged: (_) {},
|
||||
onTimelineHeightChangeEnd: () {},
|
||||
timeline: const SizedBox(),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
final card = tester.getRect(find.byKey(const Key('editor-preview-card')));
|
||||
final divider = tester.getRect(
|
||||
find.byKey(const Key('editor-properties-divider')),
|
||||
);
|
||||
final properties = tester.getRect(
|
||||
find.byKey(const Key('editor-properties-region')),
|
||||
);
|
||||
final header = tester.getRect(find.byKey(const Key('test-header')));
|
||||
expect(divider.top, card.top + 1);
|
||||
expect(divider.bottom, card.bottom - 1);
|
||||
expect(properties.top, divider.top);
|
||||
expect(properties.bottom, divider.bottom);
|
||||
expect(header.right, divider.left);
|
||||
expect(properties.left, divider.right);
|
||||
final preview = tester.element(find.byKey(const Key('test-preview')));
|
||||
update(() => showProperties = false);
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('editor-properties-divider')), findsNothing);
|
||||
expect(
|
||||
tester.getRect(find.byKey(const Key('test-header'))).right,
|
||||
card.right - 1,
|
||||
);
|
||||
expect(
|
||||
tester.element(find.byKey(const Key('test-preview'))),
|
||||
same(preview),
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
},
|
||||
);
|
||||
testWidgets('preview and timeline cards resize through their 1 dp gap', (
|
||||
),
|
||||
);
|
||||
final card = tester.getRect(find.byKey(const Key('editor-preview-card')));
|
||||
final divider = tester.getRect(
|
||||
find.byKey(const Key('editor-properties-divider')),
|
||||
);
|
||||
final properties = tester.getRect(
|
||||
find.byKey(const Key('editor-properties-region')),
|
||||
);
|
||||
final header = tester.getRect(find.byKey(const Key('test-header')));
|
||||
expect(divider.top, card.top);
|
||||
expect(divider.bottom, card.bottom);
|
||||
expect(properties.top, divider.top);
|
||||
expect(properties.bottom, divider.bottom);
|
||||
expect(header.right, divider.left - 1);
|
||||
expect(properties.left, divider.right);
|
||||
final preview = tester.element(find.byKey(const Key('test-preview')));
|
||||
update(() => showProperties = false);
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('editor-properties-divider')), findsNothing);
|
||||
expect(
|
||||
tester.getRect(find.byKey(const Key('test-header'))).right,
|
||||
tester.getRect(find.byKey(const Key('editor-preview-card'))).right - 1,
|
||||
);
|
||||
expect(
|
||||
tester.element(find.byKey(const Key('test-preview'))),
|
||||
same(preview),
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
testWidgets('preview and timeline cards resize through their 6 dp gap', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(700, 800);
|
||||
@@ -101,9 +101,15 @@ void main() {
|
||||
Rect card(String name) =>
|
||||
tester.getRect(find.byKey(Key('editor-$name-card')));
|
||||
final timelineBefore = card('timeline');
|
||||
expect(timelineBefore.top - card('preview').bottom, 1);
|
||||
expect(
|
||||
timelineBefore.top - card('preview').bottom,
|
||||
WorkspaceLayoutMetrics.desktopSpacing,
|
||||
);
|
||||
final resize = find.byKey(const Key('editor-timeline-resize'));
|
||||
expect(tester.getSize(resize).height, 5);
|
||||
expect(
|
||||
tester.getSize(resize).height,
|
||||
WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||
);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('editor-timeline-card')),
|
||||
@@ -117,7 +123,10 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(card('timeline').height, timelineBefore.height + 80);
|
||||
expect(card('timeline').top - card('preview').bottom, 1);
|
||||
expect(
|
||||
card('timeline').top - card('preview').bottom,
|
||||
WorkspaceLayoutMetrics.desktopSpacing,
|
||||
);
|
||||
expect(saves, 1);
|
||||
await tester.dragFrom(
|
||||
tester.getCenter(resize) + const Offset(0, 2),
|
||||
@@ -127,7 +136,7 @@ void main() {
|
||||
expect(card('timeline').height, timelineBefore.height + 60);
|
||||
expect(saves, 2);
|
||||
await tester.dragFrom(
|
||||
tester.getCenter(resize) + const Offset(0, 3),
|
||||
tester.getCenter(resize) + const Offset(0, 6),
|
||||
const Offset(0, -30),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
@@ -175,15 +184,24 @@ void main() {
|
||||
final project = card('project');
|
||||
final editor = card('editor');
|
||||
final agent = card('agent');
|
||||
expect(editor.left - project.right, 1);
|
||||
expect(agent.left - editor.right, 1);
|
||||
expect(
|
||||
editor.left - project.right,
|
||||
WorkspaceLayoutMetrics.desktopSpacing,
|
||||
);
|
||||
expect(agent.left - editor.right, WorkspaceLayoutMetrics.desktopSpacing);
|
||||
expect(project.top, editor.top);
|
||||
expect(editor.bottom, agent.bottom);
|
||||
|
||||
final projectResize = find.byKey(const Key('project-sidebar-resize'));
|
||||
final agentResize = find.byKey(const Key('agent-panel-resize'));
|
||||
expect(tester.getSize(projectResize).width, 5);
|
||||
expect(tester.getSize(agentResize).width, 5);
|
||||
expect(
|
||||
tester.getSize(projectResize).width,
|
||||
WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||
);
|
||||
expect(
|
||||
tester.getSize(agentResize).width,
|
||||
WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||
);
|
||||
await tester.dragFrom(
|
||||
tester.getCenter(projectResize) + const Offset(-2, 0),
|
||||
const Offset(60, 0),
|
||||
@@ -199,7 +217,10 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(card('agent').width, agent.width + 80);
|
||||
expect(card('project').width, project.width + 60);
|
||||
expect(card('agent').left - card('editor').right, 1);
|
||||
expect(
|
||||
card('agent').left - card('editor').right,
|
||||
WorkspaceLayoutMetrics.desktopSpacing,
|
||||
);
|
||||
await tester.dragFrom(
|
||||
tester.getCenter(projectResize) + const Offset(2, 0),
|
||||
const Offset(-20, 0),
|
||||
@@ -213,13 +234,17 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(card('agent').width, agent.width + 60);
|
||||
await tester.dragFrom(
|
||||
tester.getCenter(projectResize) + const Offset(-3, 0),
|
||||
tester.getCenter(projectResize) + const Offset(-6, 0),
|
||||
const Offset(30, 0),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(card('project').width, project.width + 40);
|
||||
expect(card('editor').left - card('project').right, 1);
|
||||
expect(
|
||||
card('editor').left - card('project').right,
|
||||
WorkspaceLayoutMetrics.desktopSpacing,
|
||||
);
|
||||
|
||||
controller.setAgentVisible(true);
|
||||
update(() => mode = WorkspaceMode.cut);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('desktop-agent-card')), findsOneWidget);
|
||||
|
||||
Reference in new issue
Block a user