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
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:
1 parent
aa5255d1e4
commit
2e0033ce2d
260 files changed
+43963
-5591
No files matched your search
@@ -7,6 +7,167 @@ import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('slider density follows inspector and desktop contexts', (
|
||||
tester,
|
||||
) async {
|
||||
final desktop = AppTheme.desktopWorkspaceTheme(AppTheme.penDark);
|
||||
for (final (theme, height) in [
|
||||
(AppTheme.propertiesPanelTheme(desktop), 28.0),
|
||||
(desktop, 36.0),
|
||||
(
|
||||
AppTheme.propertiesPanelTheme(AppTheme.penDark),
|
||||
AppControlSize.standard,
|
||||
),
|
||||
]) {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: theme,
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: 220,
|
||||
child: AppSlider(value: .5, onChanged: (_) {}),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(tester.getSize(find.byType(AppSlider)).height, height);
|
||||
expect(tester.takeException(), isNull);
|
||||
}
|
||||
});
|
||||
|
||||
test(
|
||||
'inspector density leaves general desktop and touch inputs unchanged',
|
||||
() {
|
||||
final desktop = AppTheme.desktopWorkspaceTheme(AppTheme.penDark);
|
||||
final inspector = AppTheme.propertiesPanelTheme(desktop);
|
||||
expect(desktop.inputDecorationTheme.constraints!.minHeight, 36);
|
||||
expect(inspector.inputDecorationTheme.constraints!.minHeight, 28);
|
||||
expect(inspector.textTheme.bodyMedium!.fontSize, 13);
|
||||
expect(inspector.textTheme.bodySmall!.fontSize, 12);
|
||||
expect(
|
||||
inspector.iconButtonTheme.style!.fixedSize!.resolve({}),
|
||||
const Size.square(24),
|
||||
);
|
||||
expect(desktop.extension<InspectorControlDensity>(), isNull);
|
||||
expect(inspector.extension<InspectorControlDensity>(), isNotNull);
|
||||
final dialog = AppTheme.dialogContentTheme(inspector);
|
||||
expect(dialog.extension<InspectorControlDensity>(), isNull);
|
||||
expect(dialog.inputDecorationTheme.constraints!.minHeight, 36);
|
||||
expect(dialog.textTheme.bodyMedium!.fontSize, 14);
|
||||
final touch = AppTheme.propertiesPanelTheme(AppTheme.penDark);
|
||||
expect(touch.extension<InspectorControlDensity>(), isNull);
|
||||
expect(
|
||||
touch.iconButtonTheme.style!.fixedSize!.resolve({}),
|
||||
const Size.square(28),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('multiline input keeps its first line near the top', (
|
||||
tester,
|
||||
) async {
|
||||
final controller = TextEditingController(text: 'First\nSecond');
|
||||
addTearDown(controller.dispose);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: AppTheme.desktopWorkspaceTheme(AppTheme.penDark),
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: 240,
|
||||
height: 100,
|
||||
child: AppTextField(
|
||||
controller: controller,
|
||||
minLines: 3,
|
||||
maxLines: 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final editable = tester
|
||||
.state<EditableTextState>(find.byType(EditableText))
|
||||
.renderEditable;
|
||||
final caret = editable.getLocalRectForCaret(const TextPosition(offset: 0));
|
||||
expect(
|
||||
editable.localToGlobal(caret.center).dy -
|
||||
tester.getTopLeft(find.byType(TextField)).dy,
|
||||
lessThan(25),
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
});
|
||||
|
||||
testWidgets('labelled single-line inputs keep text and caret centered', (
|
||||
tester,
|
||||
) async {
|
||||
final controller = TextEditingController(text: '125');
|
||||
addTearDown(controller.dispose);
|
||||
for (final brightness in Brightness.values) {
|
||||
for (final desktop in [false, true]) {
|
||||
final base = AppTheme.forPalette(AppPalette.graphite, brightness);
|
||||
final theme = AppTheme.propertiesPanelTheme(
|
||||
desktop ? AppTheme.desktopWorkspaceTheme(base) : base,
|
||||
);
|
||||
final height = desktop
|
||||
? AppInspectorMetrics.input
|
||||
: AppControlSize.propertyControl;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: theme,
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: 240,
|
||||
height: height,
|
||||
child: AppTextField(
|
||||
controller: controller,
|
||||
label: 'W',
|
||||
unit: '%',
|
||||
hintText: 'Value',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final field = find.byType(TextField);
|
||||
final label = find.text('W');
|
||||
expect(
|
||||
tester.getRect(label).center.dy,
|
||||
tester.getRect(field).center.dy,
|
||||
);
|
||||
expect(
|
||||
tester.widget<TextField>(field).decoration!.prefixIcon,
|
||||
isNotNull,
|
||||
);
|
||||
for (final text in ['', '125', '项目']) {
|
||||
await tester.enterText(field, text);
|
||||
await tester.pump();
|
||||
final editable = tester
|
||||
.state<EditableTextState>(find.byType(EditableText))
|
||||
.renderEditable;
|
||||
final caret = editable.getLocalRectForCaret(
|
||||
TextPosition(offset: text.length),
|
||||
);
|
||||
expect(
|
||||
editable.localToGlobal(caret.center).dy,
|
||||
closeTo(tester.getCenter(field).dy, 1),
|
||||
);
|
||||
expect(tester.getSize(field).height, height);
|
||||
expect(tester.takeException(), isNull);
|
||||
}
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('Icon button states use translucent ink without stacking selection', () {
|
||||
final style = AppTheme.penDark.iconButtonTheme.style!;
|
||||
const ink = Color(0xFFFCFCFC);
|
||||
|
||||
Reference in new issue
Block a user