feat: Implement note positioning logic and tests for position conversion
This commit is contained in:
@@ -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]);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user