lift text-zoom into kernel, surface it in the palette (T-114)
test / unit + widget + golden + a11y (push) Failing after 30s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 1m1s

Workspace text-zoom (Ctrl +/-/0) was local state on _RootShellState,
reachable only via the keymap intent path. Lifted to a kernel TextZoom
ChangeNotifier so the new `view.zoomIn/Out/Reset` palette commands
mutate the same number the keymap does — closing T-114's "discoverable
in the palette" item.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-18 09:04:43 +02:00
co-authored by Claude
parent 6d4a642773
commit 044d1b2ff1
11 changed files with 174 additions and 9 deletions
+60
View File
@@ -0,0 +1,60 @@
import 'package:clide/kernel/src/text_zoom.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('TextZoom', () {
test('starts at 1.0', () {
expect(TextZoom().scale, 1.0);
});
test('increase adds one step, notifies listeners', () {
final z = TextZoom();
var calls = 0;
z.addListener(() => calls++);
z.increase();
expect(z.scale, closeTo(1.0 + TextZoom.stepScale, 1e-9));
expect(calls, 1);
});
test('decrease subtracts one step', () {
final z = TextZoom();
z.decrease();
expect(z.scale, closeTo(1.0 - TextZoom.stepScale, 1e-9));
});
test('reset jumps back to 1.0', () {
final z = TextZoom()..increase()..increase();
expect(z.scale, isNot(1.0));
z.reset();
expect(z.scale, 1.0);
});
test('clamps at minScale', () {
final z = TextZoom();
for (var i = 0; i < 100; i++) {
z.decrease();
}
expect(z.scale, TextZoom.minScale);
});
test('clamps at maxScale', () {
final z = TextZoom();
for (var i = 0; i < 100; i++) {
z.increase();
}
expect(z.scale, TextZoom.maxScale);
});
test('no-op increment does not notify', () {
final z = TextZoom();
for (var i = 0; i < 100; i++) {
z.increase();
}
// Already at max — the next increase shouldn't fire.
var calls = 0;
z.addListener(() => calls++);
z.increase();
expect(calls, 0);
});
});
}