test / unit + widget + golden + a11y (push) Failing after 28s
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 1m2s
Pre-push hook split the cascaded `..increase()..increase()` chain onto separate lines; landing the formatter's choice. Co-Authored-By: Claude <noreply@anthropic.com>
63 lines
1.5 KiB
Dart
63 lines
1.5 KiB
Dart
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);
|
|
});
|
|
});
|
|
}
|