diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-15 12:29:41 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-09-15 17:24:42 -0300 |
| commit | 8b0bed0427064794725f95cb7b020d7d96956975 (patch) | |
| tree | e44dad51729bafd8a46a386af4a20674fc36c9d8 /test/pdf.zig | |
| parent | a624a56e289e4a02a411f83741f0f2c9fc0f0b2e (diff) | |
| download | pardes-8b0bed0427064794725f95cb7b020d7d96956975.tar.gz pardes-8b0bed0427064794725f95cb7b020d7d96956975.zip | |
Preserve selections when navigating jump history
Diffstat (limited to 'test/pdf.zig')
| -rw-r--r-- | test/pdf.zig | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/pdf.zig b/test/pdf.zig index a5720f3f..4c0daf34 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -1629,7 +1629,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { p.scratch.allocator(), panes.Pdf.highlightInput(p, 0, pane), ); - const page_highlights = decorated.forPage(pv.page, pv.page); + const page_highlights = decorated.forPage(pv.page); try std.testing.expectEqual(pdf_impl.HighlightKind.custom, page_highlights[0].kind); try std.testing.expectEqual(pdf_impl.HighlightKind.selection, page_highlights[page_highlights.len - 1].kind); _ = frame.reset(.retain_capacity); @@ -1672,7 +1672,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { pv, p.scratch.allocator(), panes.Pdf.highlightInput(p, 0, pane), - )).items; + )).forPage(pv.page); try std.testing.expect(highlights.len > 1); try std.testing.expectEqual(pdf_impl.HighlightKind.search, highlights[0].kind); try std.testing.expectEqual(pdf_impl.HighlightKind.selection, highlights[highlights.len - 1].kind); @@ -1814,9 +1814,13 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { const saved_query = try gpa.dupe(u8, pv.search_query); defer gpa.free(saved_query); + const saved_selection = try gpa.dupe(u8, pv.selection_text); + defer gpa.free(saved_selection); + const selected_page = pv.selection_page; panes.Pdf.setPage(p, pane, 1); - try std.testing.expect(pv.selection == null); - try std.testing.expectEqual(@as(usize, 0), pv.selection_text.len); + try std.testing.expect(pv.selection != null); + try std.testing.expectEqual(selected_page, pv.selection_page); + try std.testing.expectEqualStrings(saved_selection, pv.selection_text); try std.testing.expectEqualStrings(saved_query, pv.search_query); } |
