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
@@ -0,0 +1,125 @@
|
||||
import 'package:cutdex/app/shells/desktop_window_frame.dart';
|
||||
import 'package:cutdex/features/projects/project_tabs_bar.dart';
|
||||
import 'package:cutdex/integrations/platform/editor_window_chrome.dart';
|
||||
import 'package:cutdex/l10n/app_localizations.dart';
|
||||
import 'package:cutdex/workspace/project_state.dart';
|
||||
import 'package:cutdex_native/cutdex_native.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'header separates native buttons from project entry and uses equal margins',
|
||||
(tester) async {
|
||||
const width = 720.0;
|
||||
const captionWidth = 132.0;
|
||||
for (final platform in [TargetPlatform.macOS, TargetPlatform.windows]) {
|
||||
for (final integrated in [false, true]) {
|
||||
debugDefaultTargetPlatformOverride = platform;
|
||||
final caption = integrated && platform == TargetPlatform.windows;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: AppTheme.desktopWorkspaceTheme(AppTheme.penDark),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Scaffold(
|
||||
body: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
height: 120,
|
||||
child: WindowHeaderLayout(
|
||||
captionBounds: caption
|
||||
? const Rect.fromLTWH(
|
||||
width - captionWidth,
|
||||
0,
|
||||
captionWidth,
|
||||
44,
|
||||
)
|
||||
: Rect.zero,
|
||||
child: DesktopWindowFrame(
|
||||
integratedTitlebar: integrated,
|
||||
headerControls: const SizedBox.shrink(),
|
||||
projectTabs: ProjectTabsBar(
|
||||
projects: const [
|
||||
RecentProject(id: 'one', name: 'One', path: '/one'),
|
||||
],
|
||||
recent: const [],
|
||||
selectedId: 'one',
|
||||
leadingActions: [
|
||||
IconButton(
|
||||
key: const Key('header-sidebar-action'),
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.menu, size: 16),
|
||||
),
|
||||
],
|
||||
trailingActions: [
|
||||
IconButton(
|
||||
key: const Key('header-task-action'),
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.task_alt, size: 16),
|
||||
),
|
||||
],
|
||||
onSelect: (_) {},
|
||||
onClose: (_) {},
|
||||
onCreate: () {},
|
||||
onOpen: () {},
|
||||
onRename: (_) {},
|
||||
),
|
||||
onHomePressed: () {},
|
||||
onSettingsPressed: () {},
|
||||
child: const SizedBox.shrink(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final entry = tester.getRect(
|
||||
find.byKey(const Key('project-tabs-projects')),
|
||||
);
|
||||
final sidebar = tester.getRect(
|
||||
find.byKey(const Key('header-sidebar-action')),
|
||||
);
|
||||
final list = tester.getRect(
|
||||
find.byKey(const Key('project-tabs-list')),
|
||||
);
|
||||
final task = tester.getRect(
|
||||
find.byKey(const Key('header-task-action')),
|
||||
);
|
||||
final start = integrated ? EditorWindowChrome.leadingWidth : 0.0;
|
||||
final end = caption ? width - captionWidth : width;
|
||||
final macButtons = integrated && platform == TargetPlatform.macOS;
|
||||
expect(
|
||||
sidebar.left - start,
|
||||
12,
|
||||
reason: '$platform integrated=$integrated left',
|
||||
);
|
||||
expect(
|
||||
end - task.right,
|
||||
12,
|
||||
reason: '$platform integrated=$integrated right',
|
||||
);
|
||||
if (macButtons) {
|
||||
expect(sidebar.left, 80);
|
||||
// The last native button is centered at 59 with a 14px frame.
|
||||
expect(sidebar.left - (59 + 14 / 2), 14);
|
||||
}
|
||||
expect(entry.center.dy, 22);
|
||||
expect(sidebar.center.dy, 22);
|
||||
expect(entry.left - sidebar.right, AppProjectTabMetrics.gap);
|
||||
expect(list.center.dy, 22);
|
||||
expect(task.center.dy, 22);
|
||||
expect(task.left - list.right, AppProjectTabMetrics.gap);
|
||||
expect(task.size, const Size.square(AppProjectTabMetrics.height));
|
||||
expect(tester.takeException(), isNull);
|
||||
}
|
||||
}
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user