diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/behaviour/settings.zig | 4 | ||||
| -rw-r--r-- | test/column_drag.zig | 5 | ||||
| -rw-r--r-- | test/gui-goldens.txt | 1 | ||||
| -rw-r--r-- | test/mode.zig | 2 | ||||
| -rw-r--r-- | test/output.zig | 16 | ||||
| -rw-r--r-- | test/panes.zig | 44 | ||||
| -rw-r--r-- | test/pdf.zig | 4 | ||||
| -rw-r--r-- | test/process/window.zig | 10 | ||||
| -rw-r--r-- | test/snapshots/ttyhelp.golden | 14 | ||||
| -rw-r--r-- | test/snapshots/ttyhelp.snap | 6 |
10 files changed, 18 insertions, 88 deletions
diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig index 5ad4b7eb..3a9d42df 100644 --- a/test/behaviour/settings.zig +++ b/test/behaviour/settings.zig @@ -246,7 +246,9 @@ test "settings: every on/off setting the root ctl reads flips when its word is w if (!on) try std.testing.expect(!std.mem.endsWith(u8, after, " off")); flipped += 1; } - try std.testing.expect(flipped > 20); + // A floor, so a ctl that lists none fails: a bare session's on/off + // words, Colors to PagerColor, are ten. + try std.testing.expect(flipped >= 10); for ([_][]const u8{ "Colors off", "Wrap off", "Tagbottom on", "Debug on" }) |want| try std.testing.expectEqualStrings(want, try setting(&s, want[0..std.mem.indexOfScalar(u8, want, ' ').?])); try s.write("/ctl", "Theme acme\n"); diff --git a/test/column_drag.zig b/test/column_drag.zig index f8f6344b..0e92e125 100644 --- a/test/column_drag.zig +++ b/test/column_drag.zig @@ -45,7 +45,6 @@ test "column grip drag moves only its interval and keeps tag caret with the colu const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 180, .rows = 30 }); defer p.deinit(); _ = try p.setTestFile("body\n"); - p.presentation.enabled = false; p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 }; for (0..3) |_| { try std.testing.expect(p.executeBuiltinLine(p.active, "New")); @@ -125,7 +124,6 @@ test "column grip is separate from compact text and the resize seam" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 24 }); defer p.deinit(); _ = try p.setTestFile("body\n"); - p.presentation.enabled = false; p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 }; try std.testing.expect(p.executeBuiltinLine(0, "New")); try std.testing.expect(layout.splitColumn(p, p.active, p.active, false)); @@ -172,7 +170,6 @@ test "column grips stay blank, and muted across focus and hover until grabbed" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 20 }); defer p.deinit(); _ = try p.setTestFile("left\n"); - p.presentation.enabled = false; p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 }; try std.testing.expect(p.executeBuiltinLine(0, "New")); try std.testing.expect(layout.splitColumn(p, p.active, p.active, false)); @@ -209,7 +206,6 @@ test "column grip dropped in its own place moves the column's left edge" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 24 }); defer p.deinit(); _ = try p.setTestFile("body\n"); - p.presentation.enabled = false; try std.testing.expect(p.executeBuiltinLine(0, "New")); try std.testing.expect(layout.splitColumn(p, p.active, p.active, false)); p.update(.tick); @@ -273,7 +269,6 @@ test "column grip drag previews where the column lands, in the seam beside its r const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 24 }); defer p.deinit(); _ = try p.setTestFile("body\n"); - p.presentation.enabled = false; for (0..2) |_| { try std.testing.expect(p.executeBuiltinLine(p.active, "New")); try std.testing.expect(layout.splitColumn(p, p.active, p.active, false)); diff --git a/test/gui-goldens.txt b/test/gui-goldens.txt index 6b3960d8..1160cf92 100644 --- a/test/gui-goldens.txt +++ b/test/gui-goldens.txt @@ -14,4 +14,3 @@ 15-theme-acme-light 6e2ba713570d3d2baeaf927218d21f497a43b1d1fc59e7a3eff68f213e5cf7f7 16-debug 776b774f85219e9ced28168e0b90ef4473a8687d1cf14747d21b129dd5aaea98 17-terminal 5f192b2fff53c66d154f4ad310d07c168838172d85cc59ba0fd51720d6abba2e -18-mid-transition 14746e3f30abc862e3a25a5f6907d135898cb0f963436f4fe7cd6085eee9a874 diff --git a/test/mode.zig b/test/mode.zig index 463b2748..42e61c79 100644 --- a/test/mode.zig +++ b/test/mode.zig @@ -28,7 +28,6 @@ fn customTag(pane: *pardes.Pane, text: []const u8) !void { test "Mode cycles terminal modes and keeps legacy toggle and custom tags" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100 }); defer p.deinit(); - p.presentation.enabled = false; while (p.nextEffect()) |_| {} const pane = p.panes[0].?; try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); @@ -62,7 +61,6 @@ test "Mode from actual tag Exec preserves parked file and output insert transact for ([_]bool{ false, true }) |normal_tag| { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100 }); defer p.deinit(); - p.presentation.enabled = false; const pane = try p.setTestFile("ab\n"); if (output) pane.file.?.output = .{ .from = .search }; try std.testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagText(p, p.scratch.allocator(), pane), " Mode") == null); diff --git a/test/output.zig b/test/output.zig index e998ac66..c72668b4 100644 --- a/test/output.zig +++ b/test/output.zig @@ -94,7 +94,6 @@ test "output callers opt into location highlighting instead of matching prose co defer p.deinit(); p.locations_config.layout = .@"inline"; _ = try p.setTestFile("ordinary\n"); - p.presentation.enabled = false; if (origin == .cmd and origin.cmd == .LocationsConfig) { p.locations_config.context = 5; try std.testing.expect(p.executeBuiltinLine(0, "LocationsConfig")); @@ -125,7 +124,6 @@ test "location producers retain rendered location match and diagnostic styles" { defer p.deinit(); p.locations_config.layout = .@"inline"; _ = try p.setTestFile("ordinary\n"); - p.presentation.enabled = false; const diagnostic = origin == .query and origin.query == .diagnostics; const code = if (diagnostic) "warning: unused value" else "const value = 42;"; try panes.Output.fillResults(p, 0, "/", origin, "styles", try std.fmt.allocPrint(p.gpa, "source.zig:3:1-3 {s}\n", .{code}), null); @@ -549,7 +547,7 @@ test "Config with no startup file opens a pane of its name, and Save makes its d try std.testing.expectEqual(std.Io.File.Kind.directory, made.kind); } -test "a window's setting builtins (TaglineSize, Font, transitions) reach the report DumpConfig writes" { +test "a window's setting builtins (TaglineSize, Font) reach the report DumpConfig writes" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); defer p.deinit(); p.locations_config.layout = .@"inline"; @@ -586,14 +584,7 @@ test "a window's setting builtins (TaglineSize, Font, transitions) reach the rep try std.testing.expect(p.executeBuiltinLine(p.active, "DumpConfig")); const report = p.panes[p.active].?.file.?.content; // The toggles, Theme and Shell are test/behaviour/settings.zig's, through - // the root ctl; what is left is a window's (fonts, transitions). - const transition = if (!builtins.viewCapabilities(p).panel_transitions) - "PanelSlide unsupported\n" - else if (p.settings.panel_transition == .off) - "PanelSlide off\n" - else - try std.fmt.bufPrint(&buf, "{s} on\n", .{config.Runtime.findAction(.{ .transition = p.settings.panel_transition }).?.word}); - try std.testing.expect(std.mem.indexOf(u8, report, transition) != null); + // the root ctl; what is left is a window's (fonts). const tagline = if (!builtins.viewCapabilities(p).tagline_font_size) "TaglineSize unsupported\n" else @@ -653,7 +644,6 @@ test "LookNext/LookPrev skips formatted context and selects comment match locati const source = try p.setTestFile(text); p.gpa.free(source.file.?.path); source.file.?.path = try p.gpa.dupe(u8, "/look-walk-context.zig"); - p.presentation.enabled = false; p.locations_config = .{ .layout = .@"inline", .context = 1, .tscontext = true, .tslocations = tslocations }; const path = source.file.?.path; const input = try std.fmt.allocPrint(p.gpa, "{s}:4:9 {s}\n{s}:6:9 {s}\n", .{ @@ -1146,7 +1136,6 @@ test "LSP occurrence tint follows the supplied source span through context" { p.gpa.free(source.file.?.path); source.file.?.path = try p.gpa.dupe(u8, "/occurrence.zig"); p.locations_config = .{ .layout = .@"inline", .context = 1, .tscontext = true }; - p.presentation.enabled = false; var input: std.Io.Writer.Allocating = .init(p.gpa); defer input.deinit(); const start = std.mem.lastIndexOf(u8, snippet, "foo").?; @@ -1257,7 +1246,6 @@ test "stacked search and LSP results retain source tint navigation and dump owne defer p.deinit(); try std.testing.expectEqual(.stacked, p.locations_config.layout); p.locations_config = .{ .context = 1, .tscontext = true, .tslocations = visible }; - p.presentation.enabled = false; const source = try p.setTestFile(source_text); p.gpa.free(source.file.?.path); source.file.?.path = try p.gpa.dupe(u8, "/stacked-界.zig"); diff --git a/test/panes.zig b/test/panes.zig index 958c35a2..f3ae3cfc 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -2,7 +2,6 @@ const std = @import("std"); const pardes = @import("pardes"); const panes = pardes.panes; const layout = pardes.layout; -const animation = pardes.animation; const Pardes = pardes.Pardes; const Pane = pardes.Pane; const Key = pardes.Key; @@ -37,7 +36,6 @@ const TagLayerTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 16 }); defer p.deinit(); const pane = try p.setTestFile("body\n"); - p.presentation.enabled = false; p.settings.tag_bottom = bottom; p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 }; p.gpa.free(pane.file.?.path); @@ -72,33 +70,6 @@ const TagLayerTests = struct { try std.testing.expectEqual(@as(u16, 0), pane.tag_scroll); try std.testing.expectEqualStrings("body\n", pane.file.?.content); p.update(.{ .key = .{ .cp = Key.escape } }); - const rect = p.rects[0]; - const track: animation.Track = .{ - .serial = pane.serial, - .pane = 0, - .effect = .zoom, - .frame = 4, - .frame_count = 10, - .from = .{ .x = @as(f32, @floatFromInt(rect.x)) + 2, .y = @floatFromInt(rect.y), .w = @floatFromInt(rect.w - 4), .h = @floatFromInt(rect.h) }, - .to = .{ .x = @floatFromInt(rect.x), .y = @floatFromInt(rect.y), .w = @floatFromInt(rect.w), .h = @floatFromInt(rect.h) }, - }; - p.presentation.shown_tracks[0] = track; - p.presentation.pending = false; - const shown = track.presented(); - const source_y = @as(f32, @floatFromInt(layer.viewport.y)) + 0.5; - const painted_x = shown.x + (x / 10 - track.to.x) / track.to.w * shown.w; - const painted_y = shown.y + (source_y - track.to.y) / track.to.h * shown.h; - // Each is a first click, whatever cell the one before hit. - p.last_click = null; - for ([_]pardes.Mouse.Kind{ .press, .release }) |kind| { - var event = mouse(layer, x, kind); - // Hosts inverse the exact painted pixel into the tag envelope; - // physical routing still receives the original body-grid cell. - event.col = @intFromFloat(painted_x); - event.row = @intFromFloat(painted_y); - p.update(.{ .mouse = event }); - } - try std.testing.expectEqual(at, @as(usize, @intCast(pane.tag.cur_col))); } } @@ -106,7 +77,6 @@ const TagLayerTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 24 }); defer p.deinit(); _ = try p.setTestFile("body\n"); - p.presentation.enabled = false; p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 }; try std.testing.expect(p.executeBuiltinLine(0, "New")); const second = p.active; @@ -289,7 +259,6 @@ const TreeContextTests = struct { const pane = try p.setTestFile(content); p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/tree-context.zig"); - p.presentation.enabled = false; return pane; } @@ -486,7 +455,6 @@ const TtySelectionTests = struct { test "tty selection yields to a new modal cursor selection" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 12 }); defer p.deinit(); - p.presentation.enabled = false; const pane = p.panes[0].?; pane.tty_filter = false; while (p.nextEffect()) |_| {} @@ -514,7 +482,6 @@ const TtySelectionTests = struct { const pane = p.panes[0].?; pane.body.mode = .tty; pane.tty_filter = false; - p.presentation.enabled = false; while (p.nextEffect()) |_| {} p.update(.{ .output = .{ .pane = 0, .bytes = if (prompt) "\x1b]133;A\x07$ \x1b]133;B\x07abc" @@ -571,7 +538,6 @@ const TtySelectionTests = struct { for ([_]bool{ false, true }) |reports_mouse| { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 24 }); defer p.deinit(); - p.presentation.enabled = false; _ = pardes.exec.spawnTty(p, 0); for (p.panes[0..2]) |slot| { slot.?.body.mode = .tty; @@ -727,7 +693,6 @@ const ClickCursorTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 14 }); defer p.deinit(); const pane = try p.setTestFile("zero\none\ntwo\nthree\nalpha beta\nfive\ngamma delta\nseven\n" ++ std.mem.asBytes(&@as([20][5]u8, @splat("tail\n".*)))); - p.presentation.enabled = false; p.settings.wrap = false; var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); @@ -835,7 +800,6 @@ const TagNameTintTests = struct { p.custom_theme = theme; p.chrome_animation.snap(pardes.ChromeTheme.fromTheme(p.theme())); p.settings.focus_tint = false; - p.presentation.enabled = false; } fn check(p: *Pardes, id: usize, name: []const u8) !usize { @@ -1586,7 +1550,6 @@ test "a failed Save to another name leaves a clean named file clean" { test "unplaced terminal panes keep their allocated grid until placement" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 }); defer p.deinit(); - p.presentation.enabled = false; while (p.nextEffect()) |_| {} const id = p.freeSlot().?; const pane = try p.newShell(id, ""); @@ -1631,7 +1594,6 @@ test "document panes ignore terminal output without allocating terminal state" { test "removed and recycled pane slots have no stale geometry" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 }); defer p.deinit(); - p.presentation.enabled = false; const id = p.freeSlot().?; const original = try p.newDocPane(id); pardes.layout.insert(p, 0, 1, id); @@ -2123,7 +2085,6 @@ const OutputTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 40 }); defer p.deinit(); _ = try p.setTestFile("notes\n"); - p.presentation.enabled = false; try std.testing.expect(p.executeBuiltinLine(0, "Help")); const id = p.active; const help = p.panes[id].?; @@ -2200,7 +2161,6 @@ const OutputTests = struct { defer p.deinit(); p.locations_config.layout = .@"inline"; _ = try p.setTestFile("notes\n"); - p.presentation.enabled = false; try fillResults(p, 0, "/", .{ .query = .hover }, "", try p.gpa.dupe(u8, "first\nsecond\nthird\n"), null); const id = for (p.panes, 0..) |slot, id| { if (slot != null and slot.?.file != null and slot.?.file.?.output != null) break id; @@ -2210,7 +2170,7 @@ const OutputTests = struct { var frame: std.heap.ArenaAllocator = .init(std.testing.allocator); defer frame.deinit(); _ = try p.render(frame.allocator()); - p.acknowledgePanelPresentation(&.{}); + p.presented(); const rect = p.rects[id]; const x = rect.x + config.GUTTER + panes.File.gutterWidth(result); const y = bodyY(p, rect); @@ -3701,7 +3661,6 @@ test "Zig keywords keep every rendered byte colored across line-number widths" { pane.hscroll = view.horizontal; p.settings.colors = true; p.settings.wrap = view.wrap; - p.presentation.enabled = false; p.sync(); var frame = std.heap.ArenaAllocator.init(gpa); defer frame.deinit(); @@ -3825,7 +3784,6 @@ test { test "a terminal keeps its tag and two body rows through a squeeze, a drag and a smaller window; a text pane does not" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 }); defer p.deinit(); - p.presentation.enabled = false; p.sync(); while (p.nextEffect()) |_| {} const term = for (p.panes, 0..) |slot, i| { diff --git a/test/pdf.zig b/test/pdf.zig index 460a5734..af1f3095 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -46,7 +46,6 @@ const PdfLinkTests = struct { defer std.testing.allocator.free(path); const p = try Pardes.init(std.testing.allocator, .{ .file = path, .cols = 100, .rows = 36 }); p.native_images = true; - p.presentation.enabled = false; p.panes[0].?.pdf.?.fit = .height; return p; } @@ -2047,7 +2046,6 @@ test "PDF Back and Forward clear selections and land on recorded pages" { const p = try Pardes.init(std.testing.allocator, .{ .file = "docs/design.pdf", .cols = 80, .rows = 28 }); defer p.deinit(); p.native_images = true; - p.presentation.enabled = false; const pane = p.panes[0].?; const state = pane.pdf.?; try std.testing.expect(state.page_count > 1); @@ -2125,7 +2123,6 @@ test "a PDF's jumps: Back after a far jump returns to the exact offset, two plac const p = try Pardes.init(std.testing.allocator, .{ .file = jumpPdf(), .cols = 80, .rows = 28 }); defer p.deinit(); p.native_images = true; - p.presentation.enabled = false; const id = p.active; const pane = p.panes[id].?; const pv = pane.pdf.?; @@ -2166,7 +2163,6 @@ test "a PDF's jumps: JumpScope file keeps to the PDF, and a closed PDF reopens a const p = try Pardes.init(std.testing.allocator, .{ .file = path, .cols = 80, .rows = 28 }); defer p.deinit(); p.native_images = true; - p.presentation.enabled = false; try std.testing.expectEqual(config.Runtime.JumpScope.file, p.settings.jump_scope); const doc = p.active; const pane = p.panes[doc].?; diff --git a/test/process/window.zig b/test/process/window.zig index 49c2d4f0..144013e1 100644 --- a/test/process/window.zig +++ b/test/process/window.zig @@ -55,7 +55,7 @@ fn monkeyOne(gpa: std.mem.Allocator, exe: [:0]const u8, motion: []const u8, seed var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); const a = arena.allocator(); - const init = try std.fmt.allocPrint(a, "Shell /bin/sh\nMessageLinger 0\nMotion {s}\nPanelSlide\n", .{motion}); + const init = try std.fmt.allocPrint(a, "Shell /bin/sh\nMessageLinger 0\nMotion {s}\n", .{motion}); var d = try process.Detached.start(gpa, exe, "monkey", .{ .init = init, .grid = .{ 80, 28 }, .env = &.{ .{ "PARDES_TEST_CLOCK", "1" }, .{ "PARDES_TEST_PAD", "0" }, } }); @@ -240,8 +240,7 @@ fn goldens(gpa: std.mem.Allocator, exe: [:0]const u8) !void { .root = root, .file = root ++ "/shapes.zig", .init = "Shell /bin/sh\nTheme forge\nMessageLinger 0\n", - // The virtual clock: a transition's frames are the same frames on - // any machine, so one partway through can be hashed too. + // The virtual clock: the same frames on any machine. .grid = .{ 120, 40 }, .env = &.{ .{ "PARDES_TEST_CLOCK", "1" }, .{ "PARDES_TEST_PAD", "7" } }, }); @@ -339,11 +338,6 @@ fn goldens(gpa: std.mem.Allocator, exe: [:0]const u8) !void { if (process.nowMs() > deadline) return error.NoTerminalOutput; } try shot(&d, a, &results, keep, "17-terminal", "latest.ppm"); - // Partway through a transition: the panes, the picture among them, - // sliding over for a new column, frame 6 of PanelSlide's 12. - try f.write("/ctl", "PanelSlide\n"); - try f.write(f.at("/pane/{d}/exec", .{first}), "Newcol\n"); - try shot(&d, a, &results, keep, "18-mid-transition", "transition-6.ppm"); const goldens_path = "test/gui-goldens.txt"; if (std.mem.eql(u8, mode, "update")) { diff --git a/test/snapshots/ttyhelp.golden b/test/snapshots/ttyhelp.golden index 71545a43..f60fe579 100644 --- a/test/snapshots/ttyhelp.golden +++ b/test/snapshots/ttyhelp.golden @@ -33,12 +33,12 @@ |11: 6 SPC P ClipPasteBefore |12: 7 SPC R ClipReplace |13: 8 SPC Y ClipYankMain -|14: 9 SPC a a PanelAscii -|15: 10 SPC a c PanelCurtain -|16: 11 SPC a d PanelDissolve -|17: 12 SPC a e PanelEdges -|18: 13 SPC a f PanelFall -|19: 14 SPC a r PanelScramble -|20: 15 SPC a s PanelSlide +|14: 9 SPC c d Delcol +|15: 10 SPC c j Joincol topbar +|16: 11 SPC c n Newcol topbar +|17: 12 SPC d Del +|18: 13 SPC f c Config topbar +|19: 14 SPC f f Find topbar +|20: 15 SPC f g Grep topbar == snap leaderworks grid=100x31 cursor=7,6 |3: $ diff --git a/test/snapshots/ttyhelp.snap b/test/snapshots/ttyhelp.snap index 24399848..30148d6c 100644 --- a/test/snapshots/ttyhelp.snap +++ b/test/snapshots/ttyhelp.snap @@ -17,8 +17,8 @@ stable 600 10000 key space key ? # The bare-tty boot now opens an empty pane under the shell, so the index is -# half as tall and `SPC c n` is below its fold: wait on a row that is on -# screen. What the leader route produced is the snapshot below, not this. -wait 10000 SPC a a PanelAscii +# half as tall: wait on a row that is on screen. What the leader route +# produced is the snapshot below, not this. +wait 10000 SPC Y ClipYankMain stable 700 15000 snap leaderworks |
