diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 22:40:49 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 23:58:31 -0300 |
| commit | dfcc040ac979b695dc2e68b9d866c2769ba6d928 (patch) | |
| tree | cd88c998b46f758a7c74e3d800312d968d6303ac /test/behaviour/settings.zig | |
| parent | f930d53c58187381b2f0df6892546ac1c217c9db (diff) | |
| download | pardes-dfcc040ac979b695dc2e68b9d866c2769ba6d928.tar.gz pardes-dfcc040ac979b695dc2e68b9d866c2769ba6d928.zip | |
settings #2, five presentation variants go, each now the style it had by default: Colors (text panes and terminals coloured, with SPC t c), TreeContextTagStyle (TreeContext rows in the tag's style), FocusTint (the focused tags tinted), SyntaxBold (keywords not bold) and Ligatures (the window shapes them; gui.zig's syncLigatures and the words' ligatures flag go, and Capabilities.ligatures); the reads deleted are in File.zig, body_layer.zig, Tables.zig, exec.zig's applySettingBuiltin, Core.zig (SessionView.layered left at its default), draw.zig, surface.zig's comment and gui.zig; deleted tests: "settings: Colors off draws a source plain, and on again colours its keywords", "Ligatures is a setting only in the shell that shapes text" and "Ligatures off draws a ligature as its cells' own glyphs, and on shapes it again", and the toggled half of TreeContext's Core test; rewritten through what stays: SyntaxBold's every-row test as keywords coloured in every row, the tag-click tests on JumpTrail, the tag-name tint tests with the focused tag's ink plain, Core's tab test by the keyword's ink; golden changes, each the cut's: syntax, theme, mini and ninep lose their Colors toggles and frames (the message row after them names the builtin before, Mini), and leader, ttyhelp and builtins' Help listing is four columns narrower, TreeContextTagStyle having been its longest word; perf.zig's harness id moves again; the window scenes from 09 on take new gui-goldens lines, the scene no longer writing FocusTint on and its word gone from the message row (the base window build running the same scenes gives the same frames); gates on tui: core-test 965/965, behaviour-test 242/242, unit-test 1482/1483, pane-test 171/172, snap all 105 scripts ok, process-test 0 of 37 failed; gui unit-test 1526/1527, gui-golden 0 of 1 failed
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/behaviour/settings.zig')
| -rw-r--r-- | test/behaviour/settings.zig | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig index 80573e2f..fdb37fa3 100644 --- a/test/behaviour/settings.zig +++ b/test/behaviour/settings.zig @@ -207,41 +207,15 @@ fn keywordsIn(s: *Session, want: []const u8) !usize { return seen; } -test "settings: Colors off draws a source plain, and on again colours its keywords, the layout as it was, an edit made while off included" { - if (!syntax) return error.SkipZigTest; - for ([_]bool{ false, true }) |edit_while_off| { - var s = try Session.initFile(std.testing.allocator, "pub fn first() void { if (true) {} }\n"); - defer s.deinit(); - const n = try s.focused(); - try s.write(s.at("/pane/{d}/name", .{n}), "/colors.zig\n"); - var ident: []const u8 = "first"; - if (edit_while_off) { - try std.testing.expect(!std.mem.eql(u8, try styleOf(&s, " fn ", 1), try styleOf(&s, "first", 0))); - try s.write("/ctl", "Colors off\n"); - try s.replace(s.at("/pane/{d}/body", .{n}), "pub fn edited() void { if (false) {} }\n"); - ident = "edited"; - } else try s.write("/ctl", "Colors off\n"); - try std.testing.expectEqual(@as(usize, 2), try keywordsIn(&s, try styleOf(&s, ident, 0))); - const layout = try s.read("/layout"); - try s.write("/ctl", "Colors on\n"); - try s.expect("/layout", layout); - const kw = try styleOf(&s, " fn ", 1); - try std.testing.expect(!std.mem.eql(u8, kw, try styleOf(&s, ident, 0))); - try std.testing.expect(!has(kw, "\"bold\":true")); - try std.testing.expectEqual(@as(usize, 2), try keywordsIn(&s, kw)); - } -} - -test "settings: SyntaxBold keywords stay coloured and bold in every row a pane grows into" { +test "settings: keywords stay coloured in every row a pane grows into" { if (!syntax) return error.SkipZigTest; var s = try Session.initFile(std.testing.allocator, std.mem.asBytes(&@as([100][33]u8, @splat("pub fn f() void { if (true) {} }\n".*)))); defer s.deinit(); try s.write(s.at("/pane/{d}/name", .{try s.focused()}), "/resize.zig\n"); - try s.write("/ctl", "SyntaxBold on\n"); s.detach(); try s.write("/ctl", "size 80 8\n"); const kw = try styleOf(&s, " fn ", 1); - try std.testing.expect(has(kw, "\"bold\":true")); + try std.testing.expect(!std.mem.eql(u8, kw, try styleOf(&s, "f()", 0))); for ([_]usize{ 50, 12, 70 }) |rows| { try s.write("/ctl", s.at("size 80 {d}\n", .{rows})); try std.testing.expect(try keywordsIn(&s, kw) >= 2 * (rows - 4)); @@ -272,9 +246,9 @@ test "settings: every on/off setting the root ctl reads flips when its word is w flipped += 1; } // 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", "Debug on" }) |want| + // words, Wrap, Debug, Verbose and JumpTrail at least, are four. + try std.testing.expect(flipped >= 4); + for ([_][]const u8{ "Wrap off", "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"); try s.write("/ctl", "Shell /bin/sh\n"); @@ -289,7 +263,7 @@ fn look(s: *Session, style: []const u8) !struct { bool, []const u8 } { return .{ json.object.get("bold").?.bool, try std.json.Stringify.valueAlloc(a, json.object.get("fg").?, .{}) }; } -test "settings: a keyword is coloured apart from the text beside it, and not bold (SyntaxBold is off by default), at a long file's end" { +test "settings: a keyword is coloured apart from the text beside it, and not bold, at a long file's end" { var s = try Session.initFile(std.testing.allocator, "initial\n"); defer s.deinit(); const n = try s.focused(); |
