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

+52 -65
View File
@@ -23,8 +23,8 @@ import 'package:cutdex/workspace/projects.dart';
import 'package:cutdex/workspace/timeline_provider.dart';
import 'package:cutdex/workspace/project_state.dart';
import 'package:cutdex/workspace/persistence/recent_projects.dart';
import 'package:cutdex_ui/icons.dart';
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -534,19 +534,16 @@ void main() {
),
);
await tester.pumpAndSettle();
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: Offset.zero);
await mouse.moveTo(
tester.getCenter(find.byKey(const Key('projects-heading'))),
);
await tester.tap(find.byKey(const Key('project-tabs-projects')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('create-project')));
await mouse.removePointer();
await tester.tap(find.text('新建项目'));
await tester.pumpAndSettle();
expect(find.text('新建项目'), findsOneWidget);
expect(find.byType(TextFormField), findsOneWidget);
await tester.tap(find.text('取消'));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('sidebar-project-empty')));
await tester.tap(find.byKey(const Key('project-tabs-projects')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('project-menu-empty')));
await tester.pumpAndSettle();
expect(router.routeInformationProvider.value.uri.path, '/');
expect(find.text('项目中还没有时间线'), findsOneWidget);
@@ -564,60 +561,50 @@ void main() {
},
);
testWidgets('missing recent project stays visible and is dimmed', (
tester,
) async {
tester.platformDispatcher.localesTestValue = const [Locale('zh')];
addTearDown(tester.platformDispatcher.clearLocalesTestValue);
final container = ProviderContainer(
overrides: [
deviceExperienceProvider.overrideWithValue(DeviceExperience.desktop),
conversationRepositoryProvider.overrideWith(
(ref) async => EmptyConversationRepository(),
),
testWidgets(
'missing recent project is marked unavailable in the project menu',
(tester) async {
tester.platformDispatcher.localesTestValue = const [Locale('zh')];
addTearDown(tester.platformDispatcher.clearLocalesTestValue);
final container = ProviderContainer(
overrides: [
deviceExperienceProvider.overrideWithValue(DeviceExperience.desktop),
conversationRepositoryProvider.overrideWith(
(ref) async => EmptyConversationRepository(),
),
projectsProvider.overrideWith(_MissingProjects.new),
workspaceViewSettingsRepositoryProvider.overrideWithValue(
_ExpandedMissingProjectSettings(),
projectsProvider.overrideWith(_MissingProjects.new),
workspaceViewSettingsRepositoryProvider.overrideWithValue(
_ExpandedMissingProjectSettings(),
),
],
);
await tester.pumpWidget(
UncontrolledProviderScope(
container: container,
child: MaterialApp.router(
builder: (context, child) => ErrorNotificationHost(child: child!),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
locale: const Locale('zh'),
theme: EditorTheme.penDark,
routerConfig: container.read(appRouterProvider),
),
),
],
);
await tester.pumpWidget(
UncontrolledProviderScope(
container: container,
child: MaterialApp.router(
builder: (context, child) => ErrorNotificationHost(child: child!),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
locale: const Locale('zh'),
theme: EditorTheme.penDark,
routerConfig: container.read(appRouterProvider),
),
),
);
await tester.pumpAndSettle();
final tile = tester.widget<ListTile>(
find.byKey(const ValueKey('sidebar-project-missing')),
);
expect(tile.enabled, isTrue);
expect(tile.textColor, EditorTheme.penDark.disabledColor);
expect(
find.descendant(
of: find.byKey(const ValueKey('sidebar-project-missing')),
matching: find.byIcon(Icons.folder_off_outlined),
),
findsOneWidget,
);
expect(
find.descendant(
of: find.byKey(const ValueKey('sidebar-project-missing')),
matching: find.text('项目不可用'),
),
findsOneWidget,
);
await tester.pumpWidget(const SizedBox());
container.dispose();
});
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('project-tabs-projects')));
await tester.pumpAndSettle();
expect(
find.byKey(const ValueKey('project-menu-missing')),
findsOneWidget,
);
expect(find.byIcon(AppIcons.folderUnavailable), findsOneWidget);
expect(find.textContaining('项目不可用'), findsOneWidget);
await tester.pumpWidget(const SizedBox());
container.dispose();
},
);
testWidgets('project errors use a dismissible floating toast', (
tester,
@@ -651,10 +638,10 @@ void main() {
),
);
await tester.pumpAndSettle();
expect(find.byIcon(Icons.error_outline), findsOneWidget);
expect(find.byIcon(AppIcons.error), findsOneWidget);
expect(find.text('操作失败,请重试'), findsOneWidget);
expect(tester.getTopRight(find.byIcon(Icons.close)).dx, lessThan(1200));
await tester.tap(find.byIcon(Icons.close));
expect(tester.getTopRight(find.byIcon(AppIcons.close)).dx, lessThan(1200));
await tester.tap(find.byIcon(AppIcons.close));
await tester.pump(const Duration(milliseconds: 200));
expect(find.byKey(const Key('global-error-notification')), findsNothing);
await tester.pumpWidget(const SizedBox());