summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig39
1 files changed, 23 insertions, 16 deletions
diff --git a/test/panes.zig b/test/panes.zig
index 74988a0a..7b34192f 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -117,10 +117,13 @@ const TagLayerTests = struct {
for ([_]Kind{ .workspace, .column }) |kind| {
const id: usize = if (kind == .column) 1 else 0;
const header = try findLayer(p, kind, id);
- const x = @as(f32, @floatFromInt(header.viewport.x)) * 10 + 62.5 * 5;
+ // The own text after the header's computed words and a blank
+ // (UX K'2).
+ const lead: f32 = @floatFromInt(pardes.tagline.headerWords(p, if (kind == .column) .column else .workspace).len + 1);
+ const x = @as(f32, @floatFromInt(header.viewport.x)) * 10 + (lead + 62.5) * 5;
p.update(.{ .mouse = mouse(header, x, .press) });
p.update(.{ .mouse = mouse(header, x, .release) });
- try std.testing.expectEqual(@as(i32, 63), pardes.tagline.focusedHeader(p).?.cur_col);
+ try std.testing.expectEqual(@as(i32, @intFromFloat(lead + 63)), pardes.tagline.focusedHeader(p).?.cur_col);
if (kind == .column) try std.testing.expectEqual(@as(?usize, 1), p.headerColumn()) else try std.testing.expect(p.headerColumn() == null);
p.update(.{ .key = .{ .cp = Key.escape } });
}
@@ -2056,7 +2059,7 @@ const OutputTests = struct {
const y = body_y + @as(u16, @intCast(index));
const cell = surface.at(x, y);
try std.testing.expect(!cell.style.bold);
- try std.testing.expectEqual(pardes.Color{ .rgb = pardes.ChromeTheme.fromTheme(p.theme()).lineno }, cell.style.fg);
+ try std.testing.expectEqual(pardes.Color{ .rgb = p.chrome().line_number }, cell.style.fg);
}
// Old dumps and edited outputs still identify both context prefixes.
panes.File.setContent(p, file, try p.gpa.dupe(u8, "| old.zig:1 old\n new.zig:2 new\nmain.zig:42 ***\t\tmatch\n"));
@@ -2266,7 +2269,7 @@ const ImageTests = struct {
pardes.layout.placeNew(p, 0, 0, id, .doc);
_ = try p.render(p.scratch.allocator());
pane.addon.?.art = .{ .glyph = true, .palette = .terminal, .ascii = false };
- try std.testing.expectEqualStrings("img petscii:on palette:terminal ascii:off /tmp/picture.ppm", try pardes.tagline.tagPrefix(p, pane));
+ try std.testing.expectEqualStrings("img petscii:on palette:terminal ascii:off /tmp/picture.ppm", try pardes.tagline.pathPrefix(p, p.scratch.allocator(), pane));
}
test "an image's dump keeps its path, its renderer choices and its tag's tail, and reopens from the file; a file gone waits as a placeholder saying so" {
@@ -2322,9 +2325,11 @@ const ImageTests = struct {
};
const TerminalTests = struct {
- // Tests asserting raw ANSI indices explicitly select helix, whose palette
- // is inherited. Native-palette coverage lives in the overlay/eviction and
- // trailing-blank tests and checks their concrete RGB values instead.
+ // Tests asserting raw ANSI indices explicitly select `dark` in a tty,
+ // which leaves its page and sixteen to the host (a theme with no sixteen
+ // of its own draws the ones worked out for it, DESIGN.md R14). Native-
+ // palette coverage lives in the overlay/eviction and trailing-blank tests
+ // and checks their concrete RGB values instead.
const forwardKey = pardes.keys.forwardKey;
const enterTty = pardes.keys.enterTty;
@@ -2598,7 +2603,7 @@ const TerminalTests = struct {
test "an edit buffer slides shell rows and their colors together" {
const testing = std.testing;
- const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 12 });
+ const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 12 });
defer p.deinit();
while (p.nextEffect()) |_| {}
const pane = p.panes[0].?;
@@ -2648,7 +2653,7 @@ const TerminalTests = struct {
test "a combining mark in the prompt keeps the command and its colors aligned" {
const testing = std.testing;
- const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 6 });
+ const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 6 });
defer p.deinit();
while (p.nextEffect()) |_| {}
const pane = p.panes[0].?;
@@ -2682,7 +2687,7 @@ const TerminalTests = struct {
test "colors are never taken from shell rows below the viewport" {
const testing = std.testing;
- const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 14 });
+ const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 14 });
defer p.deinit();
while (p.nextEffect()) |_| {}
const pane = p.panes[0].?;
@@ -2740,7 +2745,7 @@ const TerminalTests = struct {
test "a row the edit buffer only swallowed keeps its color" {
const testing = std.testing;
- const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 12 });
+ const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 12 });
defer p.deinit();
while (p.nextEffect()) |_| {}
const pane = p.panes[0].?;
@@ -2777,7 +2782,7 @@ const TerminalTests = struct {
test "an edit buffer reaching past the dumped rows colors nothing from row zero" {
const testing = std.testing;
- const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 12 });
+ const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 12 });
defer p.deinit();
while (p.nextEffect()) |_| {}
const pane = p.panes[0].?;
@@ -2853,7 +2858,7 @@ const TerminalTests = struct {
};
for (prompts) |prompt| {
for ([_]bool{ false, true }) |filter| {
- const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 24, .rows = 6 });
+ const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 24, .rows = 6 });
defer p.deinit();
while (p.nextEffect()) |_| {}
const pane = p.panes[0].?;
@@ -3035,6 +3040,8 @@ const TerminalTests = struct {
// ghostty leaves a `spacer_head` in that last column, carrying the row's
// background, and wraps the glyph to the next row. A head OWNS its column,
// so skipping it the way a tail is skipped left the row's final column bare.
+ // A theme with a page of its own (helix): every cell of the row is the
+ // body's, its red the sixteen worked out for it.
for ([_]panes.Text.Mode{ .tty, .normal }) |mode| {
const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 16, .rows = 9 });
defer p.deinit();
@@ -3052,7 +3059,7 @@ const TerminalTests = struct {
p.shell_rows.stale = true;
const s = try p.render(frame.allocator());
- const red: pardes.Color = .{ .index = 1 };
+ const red: pardes.Color = .{ .rgb = p.chrome().ansi[1] };
var c: u16 = 0;
while (c < r.w -| config.GUTTER) : (c += 1) {
errdefer std.debug.print("\nmode={any} col {d} bg={any}\n", .{ mode, c, s.at(tx + c, body_y).style.bg });
@@ -3187,7 +3194,7 @@ const TerminalTests = struct {
test "an emptied edit buffer does not shift the colors below it" {
const testing = std.testing;
- const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 12 });
+ const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 12 });
defer p.deinit();
while (p.nextEffect()) |_| {}
const pane = p.panes[0].?;
@@ -3221,7 +3228,7 @@ const TerminalTests = struct {
test "an edit overlay never changes tty-mode ansi colors" {
const testing = std.testing;
- const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 7 });
+ const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme dark\n", .tty_only = true, .windowed = false, .cols = 18, .rows = 7 });
defer p.deinit();
while (p.nextEffect()) |_| {}
const pane = p.panes[0].?;