summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig21
1 files changed, 14 insertions, 7 deletions
diff --git a/test/panes.zig b/test/panes.zig
index 7b34192f..497fe884 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -801,6 +801,12 @@ const TagNameTintTests = struct {
var arena = std.heap.ArenaAllocator.init(p.gpa);
defer arena.deinit();
const surface = try p.render(arena.allocator());
+ // The name in its tint on its tag's ground, the computed words in
+ // the words' ink, the rest in the full one (DESIGN.md H).
+ const g: pardes.colors.Chrome.Ground = if (id == p.view().active) .focus else .plain;
+ const inks = p.chrome().on(g);
+ const words_end = (try pardes.tagline.prefixIn(p, arena.allocator(), pane)).len - 1;
+ const words_lo = words_end - pardes.tagline.computedWords(pane).len;
// The tag as shown: its rows wrapped, each offset mapped back to the
// tag's own to say whether it is in the name.
const shown = try pardes.tagline.shownTag(p, arena.allocator(), pane);
@@ -820,7 +826,7 @@ const TagNameTintTests = struct {
var col = start;
while (col < end and col < rect.w - pardes.TAG_TEXT_INSET) : (col += 1) {
const in_name = real > base and real < name.len;
- const fg = if (in_name) name_fg else tag_fg;
+ const fg = if (in_name) p.chrome().name[@intFromEnum(g)] else if (real >= words_lo and real < words_end) inks.word else inks.text;
try std.testing.expectEqual(pardes.Color{ .rgb = fg }, surface.at(left + @as(u16, @intCast(col)), y).style.fg);
if (in_name) visible_name += 1;
}
@@ -871,8 +877,9 @@ const TagNameTintTests = struct {
const surface = try p.render(arena.allocator());
const x = p.view().rects[0].x + pardes.TAG_TEXT_INSET + @as(u16, @intCast(col));
const y = tagY(p, p.view().rects[0]) + @as(u16, @intCast(pos.row));
- try std.testing.expectEqual(pardes.Color{ .rgb = p.theme().sel_fg }, surface.at(x, y).style.fg);
- try std.testing.expectEqual(pardes.Color{ .rgb = p.theme().sel_fg }, surface.at(x + 1, y).style.fg);
+ const selected = p.chrome().on(.focus).selection.text;
+ try std.testing.expectEqual(pardes.Color{ .rgb = selected }, surface.at(x, y).style.fg);
+ try std.testing.expectEqual(pardes.Color{ .rgb = selected }, surface.at(x + 1, y).style.fg);
}
test "tag filename tint legacy themes keep their active foreground and tint the name with a hue of their own" {
@@ -892,10 +899,10 @@ const TagNameTintTests = struct {
const surface = try p.render(arena.allocator());
const x = p.view().rects[0].x + pardes.TAG_TEXT_INSET;
const y = tagY(p, p.view().rects[0]);
- const fg = active_fg;
- // The directory in the ink; the name tinted, never in it.
- const chrome = p.chromeTheme();
- const tint = chrome.tag_active_name_fg;
+ // The directory in the focused ink (the theme's own, held to its
+ // floors, DESIGN.md H); the name tinted, never in it.
+ const fg = p.chrome().on(.focus).text;
+ const tint = p.chrome().name[1];
try std.testing.expect(!std.meta.eql(tint, fg));
try std.testing.expectEqual(pardes.Color{ .rgb = fg }, surface.at(x + 1, y).style.fg);
try std.testing.expectEqual(pardes.Color{ .rgb = tint }, surface.at(x + 5, y).style.fg);