feat(annotations): resize and move annotations in document view #235

Merged
marcel merged 25 commits from feat/issue-233-annotation-resize-move into main 2026-04-14 14:55:28 +02:00
Showing only changes of commit 72700bd28f - Show all commits

View File

@@ -121,6 +121,53 @@ class MigrationIntegrationTest {
assertThat(rows2).isEqualTo(1);
}
// ─── V33: chk_annotation_bounds CHECK constraint ─────────────────────────
@Test
void v33_boundsCheckConstraint_rejectsXAboveOne() {
UUID docId = createDocument();
assertThatThrownBy(() ->
jdbc.update(
"""
INSERT INTO document_annotations
(id, document_id, page_number, x, y, width, height, color)
VALUES (gen_random_uuid(), ?, 1, 1.5, 0.1, 0.3, 0.1, '#ff0000')
""",
docId)
).isInstanceOf(DataIntegrityViolationException.class);
}
@Test
void v33_boundsCheckConstraint_rejectsHeightBelowMinimum() {
UUID docId = createDocument();
assertThatThrownBy(() ->
jdbc.update(
"""
INSERT INTO document_annotations
(id, document_id, page_number, x, y, width, height, color)
VALUES (gen_random_uuid(), ?, 1, 0.1, 0.1, 0.3, 0.005, '#ff0000')
""",
docId)
).isInstanceOf(DataIntegrityViolationException.class);
}
@Test
void v33_boundsCheckConstraint_acceptsValidAnnotation() {
UUID docId = createDocument();
int rows = jdbc.update(
"""
INSERT INTO document_annotations
(id, document_id, page_number, x, y, width, height, color)
VALUES (gen_random_uuid(), ?, 1, 0.1, 0.1, 0.3, 0.1, '#ff0000')
""",
docId);
assertThat(rows).isEqualTo(1);
}
// ─── helpers ─────────────────────────────────────────────────────────────
private UUID createDocument() {