feat: Implement note positioning logic and tests for position conversion

This commit is contained in:
2026-05-22 17:31:40 +02:00
parent cdfd4f9342
commit 729e575a60
6 changed files with 228 additions and 87 deletions
+23
View File
@@ -0,0 +1,23 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:notas/data/note_positioning.dart';
void main() {
test('converts between stored and displayed positions', () {
expect(toStoredNotePosition(1500.5), 15005);
expect(fromStoredNotePosition(15005), 1500.5);
});
test('supports descending gaps and rebalance', () {
expect(nextTopNotePosition(<int>[0, 10000, 20000]), 30000);
expect(
midpointNotePosition(higherPosition: 20000, lowerPosition: 10000),
15000,
);
expect(
midpointNotePosition(higherPosition: 2, lowerPosition: 1),
isNull,
);
expect(rebalanceNotePositions(3), <int>[20000, 10000, 0]);
});
}