diff options
Diffstat (limited to 'test/behaviour')
| -rw-r--r-- | test/behaviour/columns_and_tags.zig | 9 | ||||
| -rw-r--r-- | test/behaviour/tags.zig | 16 |
2 files changed, 17 insertions, 8 deletions
diff --git a/test/behaviour/columns_and_tags.zig b/test/behaviour/columns_and_tags.zig index 4ca6f7b3..bbb30f25 100644 --- a/test/behaviour/columns_and_tags.zig +++ b/test/behaviour/columns_and_tags.zig @@ -281,10 +281,13 @@ test "columns-and-tags: a column tag lights the word under the mouse, is clicked try s.expect("/focus", ""); try std.testing.expectEqual(.{ x, @as(usize, 1) }, (try s.cursor()).?); // Swept over three cells: those and the caret's, normal mode's - // selection taking the cell under it, in the selection's colour. + // selection taking the cell under it, in the selection's colour + // (the hovered word's is its half, DESIGN.md B5). try s.write("/mousein", s.at("m {d} 1 1\nm {d} 1 0\n", .{ x + 3, x + 3 })); - for (0..4) |k| try expectEqualStrings(lit, try s.bg(x + k, 1)); - try std.testing.expect(!std.mem.eql(u8, lit, try s.bg(x + 4, 1))); + const swept = try s.bg(x, 1); + try std.testing.expect(!std.mem.eql(u8, lit, swept) and !std.mem.eql(u8, plain, swept)); + for (1..4) |k| try expectEqualStrings(swept, try s.bg(x + k, 1)); + try std.testing.expect(!std.mem.eql(u8, swept, try s.bg(x + 4, 1))); // A clicked tag is in normal mode: `i` types at its caret, after its // computed words (UX K'1). const lead = "New Term Joincol Delcol ".len; diff --git a/test/behaviour/tags.zig b/test/behaviour/tags.zig index fcef9fd3..bb117d59 100644 --- a/test/behaviour/tags.zig +++ b/test/behaviour/tags.zig @@ -495,7 +495,7 @@ test "tags: truncating a tag clears its own text, u in the tag undoes it, and > try std.testing.expectEqualStrings("/test.txt Del Make\nMore\n Tail\n", try tag(&s, n)); } -test "tags: a pane tag's file name is tinted, its directory, dirty marker and words not" { +test "tags: a pane tag's file name is tinted, its directory in the tag's full ink and its computed words in the words' (DESIGN.md H)" { var s = try Session.initFile(std.testing.allocator, "body\n"); defer s.deinit(); const n = try s.focused(); @@ -511,13 +511,19 @@ test "tags: a pane tag's file name is tinted, its directory, dirty marker and wo var x: usize = 0; var tinted: ?[]const u8 = null; var ink: ?[]const u8 = null; + var words: ?[]const u8 = null; while (cells.nextCodepointSlice()) |cell| : (x += 1) { if (x < x0 or std.mem.eql(u8, cell, " ")) continue; - // `界file.zig`: the wide glyph's two cells, then eight. + // `界file.zig`: the wide glyph's two cells, then eight; after it + // `Keep` in the full ink, its computed words in the words' ink + // (DESIGN.md H). const in_name = x >= x0 + "/project/".len and x < x0 + "/project/".len + 10; - const want = if (in_name) &tinted else &ink; - if (want.* == null) want.* = styles[y * cols + x]; - try std.testing.expectEqualStrings(want.*.?, styles[y * cols + x]); + const style = styles[y * cols + x]; + if (x >= x0 + "/project/".len + 10 and std.mem.eql(u8, style, ink.?)) continue; + const want = if (in_name) &tinted else if (x < x0 + "/project/".len) &ink else &words; + if (want.* == null) want.* = style; + try std.testing.expectEqualStrings(want.*.?, style); } try std.testing.expect(!std.mem.eql(u8, tinted.?, ink.?)); + try std.testing.expect(!std.mem.eql(u8, words.?, ink.?) and !std.mem.eql(u8, words.?, tinted.?)); } |
