Files
BadNote/test/stroke_predictor_test.dart
Akiba So d346cc2670
All checks were successful
CI / Windows build (push) Successful in 14m22s
feat: unified shell, diagnostics pack, native Office, sticky board
Make Surface remote debugging and classroom workflows viable: always-on
structured logs with one-click zip export, a single AppShell chrome,
OOXML PPTX/DOCX annotation without LibreOffice, and a first-class sticky
board. Also drop spike/legacy ink widgets and tighten pen feel
(predictor, PenInfoHistory, page-tile layer).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-05 17:55:27 +08:00

29 lines
846 B
Dart

import 'dart:ui';
import 'package:flutter_test/flutter_test.dart';
import 'package:badnote/editor/engine/stroke_predictor.dart';
void main() {
test('StrokePredictor projects ahead when velocity is high', () {
final p = StrokePredictor(lookaheadMs: 16);
final t0 = DateTime.utc(2026, 1, 1, 0, 0, 0, 0);
expect(p.observe(const Offset(0, 0), 0.5, at: t0), isNull);
final tip = p.observe(
const Offset(10, 0),
0.5,
at: t0.add(const Duration(milliseconds: 8)),
);
// 10px / 8ms ≈ 1250 px/s → 16ms lookahead ≈ 20px ahead
expect(tip, isNotNull);
expect(tip!.offset.dx, greaterThan(10));
});
test('StrokePredictor resets cleanly', () {
final p = StrokePredictor();
p.observe(const Offset(0, 0), 0.4);
p.reset();
expect(p.observe(const Offset(1, 1), 0.4), isNull);
});
}