refactor(desktop): reorganize workspace panels and navigation
Gitea CI / Windows x64 and Android (pull_request) Successful in 16m21s
Gitea CI / Gitea CI passed (pull_request) Successful in 3s

This commit is contained in:
lingjhf committed 2026-10-06 12:11:59 +08:00
1 parent 826745b407
commit 1f73765745
92 files changed
+5811 -2650

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
import 'package:cutdex/features/projects/project_switch_region.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
Widget region(String? pending) => Directionality(
textDirection: TextDirection.ltr,
child: ProjectSwitchRegion(
pendingProjectId: pending,
builder: (context, showDefaults) =>
Text(showDefaults ? 'defaults' : 'content'),
),
);
testWidgets(
'fast completion never displays defaults or waits for the timer',
(tester) async {
await tester.pumpWidget(region('A'));
expect(find.text('content'), findsOneWidget);
expect(
tester.widget<IgnorePointer>(find.byType(IgnorePointer)).ignoring,
isTrue,
);
await tester.pump(const Duration(milliseconds: 100));
await tester.pumpWidget(region(null));
expect(find.text('defaults'), findsNothing);
expect(
tester.widget<IgnorePointer>(find.byType(IgnorePointer)).ignoring,
isFalse,
);
await tester.pump(const Duration(milliseconds: 200));
expect(find.text('defaults'), findsNothing);
},
);
testWidgets(
'slow switches show defaults after 150ms and reset on a new target',
(tester) async {
await tester.pumpWidget(region('A'));
await tester.pump(const Duration(milliseconds: 149));
expect(find.text('defaults'), findsNothing);
await tester.pump(const Duration(milliseconds: 1));
expect(find.text('defaults'), findsOneWidget);
await tester.pumpWidget(region('B'));
expect(find.text('defaults'), findsNothing);
await tester.pump(const Duration(milliseconds: 150));
expect(find.text('defaults'), findsOneWidget);
await tester.pumpWidget(region(null));
expect(find.text('content'), findsOneWidget);
},
);
testWidgets('disposing during a switch cancels the pending timer', (
tester,
) async {
await tester.pumpWidget(region('A'));
await tester.pumpWidget(const SizedBox());
await tester.pump(const Duration(milliseconds: 200));
expect(tester.takeException(), isNull);
});
}