diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-26 10:19:20 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-26 11:28:39 -0300 |
| commit | add0837dc1927389096cbaaf65b7e1a42028eafc (patch) | |
| tree | cdf3252f64669691dd4d5338fc2019390d6d8131 /test | |
| parent | 7d0aaa0c1e68127c023358698498eaeffe57401b (diff) | |
| download | pardes-add0837dc1927389096cbaaf65b7e1a42028eafc.tar.gz pardes-add0837dc1927389096cbaaf65b7e1a42028eafc.zip | |
colors, Core, Kind, lib: the old views deleted, now that no surface reads them (DESIGN.md B6, B8): `ChromeTheme` (its old fields, `view` and `resolved`) and the old names' view of every theme (`viewOf`, theme_schema's `toLegacy` and `Derived`), `readingOf` (the reading tint, gone with G1'), `separatorOf`, `focusTint`/`focusTintFloor` and their floors, `lerp`, the sRGB `mix`, and `Grounds` (the library's diff grounds: `Chrome`'s `add` and `del` say them; lib_syntax exports `Chrome` in its place); `Pardes.theme()` is the theme worn in the new names (`*const Theme`: a picker's preview, a theme file's, or the session's), read for its name; `chromeTheme()` is gone and `chrome()` is the one accessor (the session's chrome or a preview's, each a `Chrome` worked out at a theme change); a theme file is kept as the `Theme` it loads to (`custom_theme`), its old names read by the load-time loader, which STAYS (`LegacyTheme` and `Theme.fromLegacy`: the user's own one_dark_zed_mod.zon and an older DumpThemes' output load as before); Kind's page, ink, selection and link for a picture's or a PDF's raster from the chrome (R1: the page, never the tag, as a theme's page where it has none: dark's `null_page`; the link the page's key ink), the macOS shell's rules and page from the chrome and the theme's `page`; the source test (body_layer.zig's: no `theme()` read but its name, no `chromeTheme()`, `.roles`, `Grounds` or `LegacyTheme`) covers draw.zig, tagline.zig, Band.zig, Messages.zig and Kind.zig too, so a surface deriving its own colour cannot be written there (B6's bar); THE TESTS: the tests of the old derivations go with them, each held by the ring test on the chrome (every native's separators and focus tint, every faithful port's own chrome, a legacy document's derived roles, the old active name-tint precedence), and the rest read the new names and the chrome (a theme's own rule kept, the natives' text and UI roles on their own surfaces, their dark palettes, the quiet line numbers through a theme file, the column grips, the ThemeFile load and its old-names loader, Core's, Command's, panes', terminal's, output's and file_watch's theme reads, the library consumer's diff grounds through `Chrome`); RUN: the build is the test of a deletion (no reader left), the suites below; GOLDENS: none moved; GATES on this change, the stack's top (tui): core-test 1158/1332 (174 skipped: the 4 tests of the old derivations gone; the importer's 7 counted again after a cache wipe), shell-test 1373/1376 (3 skipped), pane-test 184/185 (1 skipped), behaviour-test 287/287 and --replay 20 seeds of 70 steps, 0 failures, process-test 0 of 149 failed (3 skipped; 0 of 103 moved with --update), term-test 17/17, kitty-test 45/45; gui unit-test 1984/1988 (4 skipped; its one failure the known BaselineHarnessMismatch; test/consumer's diff grounds through `Chrome` pass); the ring 245 of 245; the dump fuzz at 40,000 join seeds twice and 1,779 image seeds 11/11 (custom_theme, a digested field, is a Theme now); the soak (replicas, 5 clients, rtt 30,80,207): diverged 0, unequal 0, quiet checks 365/0 451/0 622/0, unlisted stops 0, the corpus 22 of 22 scenes the same, no leak; load 1.3 to 15.6 (other agents' builds); OUTSIDE the L2a files: core/colors.zig, core/Core.zig, core/root.zig, core/theme_schema.zig, core/lib_syntax.zig, core/syntax.zig (a doc line), core/Kind.zig (two hunks), core/File.zig (a test line), core/body_layer.zig (the source test's list), runtime/macos.zig (three lines), dev/file_watch.zig, test/consumer/lib.zig, test/panes.zig, test/terminal.zig, test/output.zig, core/Command.zig (tests)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'test')
| -rw-r--r-- | test/consumer/lib.zig | 10 | ||||
| -rw-r--r-- | test/output.zig | 6 | ||||
| -rw-r--r-- | test/panes.zig | 23 | ||||
| -rw-r--r-- | test/terminal.zig | 26 |
4 files changed, 31 insertions, 34 deletions
diff --git a/test/consumer/lib.zig b/test/consumer/lib.zig index 2832bdf1..949afd5c 100644 --- a/test/consumer/lib.zig +++ b/test/consumer/lib.zig @@ -140,12 +140,10 @@ test "a diff is a language: its hunks coloured as their file's, its added and re // a row's hue in a theme: a ground between the page and the theme's green, a stronger and a fainter one const th = pardes.theme("Orchard").?; - const g = pardes.Grounds.of(th); - const ground = g.forStyle(styles[added]).?; - try std.testing.expectEqual(g.add, ground); - try std.testing.expectEqual(g.del, g.forStyle(styles[removed]).?); - try std.testing.expectEqual(null, g.forStyle(@backingInt(pardes.Syn.keyword))); - try std.testing.expect(!std.mem.eql(u8, &ground.row, &pardes.page(th)) and !std.mem.eql(u8, &ground.row, &ground.emph) and !std.mem.eql(u8, &ground.row, &ground.line)); + const c = pardes.Chrome.of(th); + for ([2]pardes.Chrome.Diff{ c.add, c.del }) |ground| + try std.testing.expect(!std.mem.eql(u8, &ground.row, &pardes.page(th)) and !std.mem.eql(u8, &ground.row, &ground.emph) and !std.mem.eql(u8, &ground.row, &ground.line)); + try std.testing.expect(!std.mem.eql(u8, &c.add.row, &c.del.row)); // what a row points at: the new line a `+` row is var lines: std.ArrayList([]const u8) = .empty; diff --git a/test/output.zig b/test/output.zig index f2a35c01..8f4048f0 100644 --- a/test/output.zig +++ b/test/output.zig @@ -103,7 +103,7 @@ test "output callers opt into location highlighting instead of matching prose co const surface = try p.render(frame.allocator()); const line = modal.lineSlice(file.content, 0); const before_colon = std.mem.indexOfScalar(u8, line, ':').?; - const normal: pardes.Color = if (p.theme().fg) |fg| .{ .rgb = fg } else .default; + const normal: pardes.Color = if (p.theme().text) |fg| .{ .rgb = fg } else .default; for (0..before_colon + 2) |byte| { const cell = outputCell(p, surface, id, byte); try std.testing.expectEqual(normal, cell.style.fg); @@ -140,7 +140,7 @@ test "location producers retain rendered location match and diagnostic styles" { } if (!diagnostic) { const number = start + std.mem.indexOf(u8, code, "42").?; - try std.testing.expectEqual(pardes.Color{ .rgb = p.theme().num }, outputCell(p, surface, id, number).style.fg); + try std.testing.expectEqual(pardes.Color{ .rgb = p.theme().number }, outputCell(p, surface, id, number).style.fg); } } } @@ -454,7 +454,7 @@ test "Mini syntax colors survive themes and rendering without source access" { const rect = p.view().rects[id]; const x = rect.x + config.GUTTER + panes.File.gutterWidth(mini) + @as(u16, @intCast(column)); const y = p.bodyTop(mini, rect) + @as(u16, @intCast(position.row)); - try std.testing.expectEqualDeep(pardes.Color{ .rgb = p.theme().kw }, surface.at(x, y).style.fg); + try std.testing.expectEqualDeep(pardes.Color{ .rgb = p.theme().keyword }, surface.at(x, y).style.fg); try std.testing.expectEqual(colors, mini.file.?.mini.?.colors.ptr); try std.testing.expectEqual(@as(usize, 0), mini.file.?.highlights.len); _ = frame.reset(.retain_capacity); diff --git a/test/panes.zig b/test/panes.zig index 497fe884..063832f3 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -787,13 +787,12 @@ const TagNameTintTests = struct { fn configure(p: *Pardes) void { var theme = p.theme().*; - theme.tag_name_fg = name_fg; - theme.tag_active_name_fg = null; - theme.tag_fg = tag_fg; + theme.tag_name = name_fg; + theme.tag_text = tag_fg; // The focused tag's ink is the plain one, as an unfocused tag's. - theme.tag_active_fg = null; + theme.tag_focus_text = null; p.custom_theme = theme; - p.theme_chrome = pardes.ChromeTheme.fromTheme(p.theme()); + p.theme_chrome = .of(p.theme()); } fn check(p: *Pardes, id: usize, name: []const u8) !usize { @@ -890,10 +889,10 @@ const TagNameTintTests = struct { pane.file.?.path = try p.gpa.dupe(u8, "/dir/file.zig"); configure(p); defer p.custom_theme = null; - p.custom_theme.?.tag_name_fg = null; + p.custom_theme.?.tag_name = null; const active_fg = [3]u8{ 175, 183, 194 }; - p.custom_theme.?.tag_active_fg = active_fg; - p.theme_chrome = pardes.ChromeTheme.fromTheme(p.theme()); + p.custom_theme.?.tag_focus_text = active_fg; + p.theme_chrome = .of(p.theme()); var arena = std.heap.ArenaAllocator.init(p.gpa); defer arena.deinit(); const surface = try p.render(arena.allocator()); @@ -987,7 +986,7 @@ test "terminal overlay recoloring never materializes unrelated history" { const body_y = bodyY(p, rect); const cell = surface.at(rect.x + config.GUTTER, body_y); try testing.expectEqualStrings("c", cell.grapheme()); - try testing.expectEqual(pardes.Color{ .rgb = p.theme().palette.?[2] }, cell.style.fg); + try testing.expectEqual(pardes.Color{ .rgb = p.theme().ansi.?[2] }, cell.style.fg); } test "terminal output keeps following new rows after scrollback eviction" { @@ -1035,7 +1034,7 @@ test "terminal output keeps following new rows after scrollback eviction" { for (last, 0..) |byte, col| { const cell = surface.at(x + @as(u16, @intCast(col)), y); try std.testing.expectEqualStrings(&.{byte}, cell.grapheme()); - try std.testing.expectEqual(pardes.Color{ .rgb = p.theme().palette.?[2] }, cell.style.fg); + try std.testing.expectEqual(pardes.Color{ .rgb = p.theme().ansi.?[2] }, cell.style.fg); } while (p.nextEffect()) |_| {} p.update(.{ .key = .{ .cp = 'f', .text = "f" } }); @@ -3608,7 +3607,7 @@ test "Zig keywords keep every rendered byte colored across line-number widths" { try std.testing.expectEqual(@as(u16, @intCast(y)), surface.cursor.?.y); } else if_position = .{ .x = @intCast(x), .y = @intCast(y) }; for ([_]*pardes.Cell{ first, second }) |cell| { - const expected: pardes.Color = .{ .rgb = p.theme().kw }; + const expected: pardes.Color = .{ .rgb = p.theme().keyword }; if (!std.meta.eql(expected, cell.style.fg)) std.debug.print( "\nline={d} wrap={} horizontal={d} sample={s} cell={s}\n", .{ line, view.wrap, view.horizontal, sample, cell.grapheme() }, @@ -3644,7 +3643,7 @@ test "terminal overlays preserve trailing blank styles without coloring inserted const rect = p.view().rects[0]; const x = rect.x + config.GUTTER; const y = bodyY(p, rect); - const palette = p.theme().palette.?; + const palette = p.theme().ansi.?; const colors = [_]pardes.Color{ .{ .rgb = palette[1] }, .{ .rgb = palette[2] }, .{ .rgb = palette[4] } }; const original = try p.render(frame.allocator()); for (colors, 0..) |color, row| { diff --git a/test/terminal.zig b/test/terminal.zig index 1168fac7..3c74cd11 100644 --- a/test/terminal.zig +++ b/test/terminal.zig @@ -393,14 +393,14 @@ test "terminal Filter keys indexed truecolor OSC and background-only cells throu p.update(.{ .output = .{ .pane = .at(0), .bytes = "\x1b]104;1\x1b\\" } }); var custom = p.theme().*; custom.name = try p.gpa.dupe(u8, "same-name"); - custom.palette = pardes.colors.xterm[0..16].*; - custom.palette.?[1] = .{ 1, 2, 3 }; + custom.ansi = pardes.colors.xterm[0..16].*; + custom.ansi.?[1] = .{ 1, 2, 3 }; p.custom_theme = custom; pardes.colors.finishThemeInitialization(p); _ = frame.reset(.retain_capacity); const custom_first = try p.render(frame.allocator()); try testing.expectEqual(plain.Color{ .rgb = .{ 1, 2, 3 } }, custom_first.at(tx, body_y).style.fg); - if (p.custom_theme) |*theme| theme.palette.?[1] = .{ 4, 5, 6 }; + if (p.custom_theme) |*theme| theme.ansi.?[1] = .{ 4, 5, 6 }; pardes.colors.finishThemeInitialization(p); _ = frame.reset(.retain_capacity); const custom_second = try p.render(frame.allocator()); @@ -465,9 +465,9 @@ test "terminal Filter preserves exact palette-null light theme default roles" { var light = p.theme().*; light.name = try p.gpa.dupe(u8, "filter-light-defaults"); - light.bg = .{ 0xf8, 0xf8, 0xf8 }; - light.fg = .{ 0x38, 0x38, 0x38 }; - light.palette = null; + light.page = .{ 0xf8, 0xf8, 0xf8 }; + light.text = .{ 0x38, 0x38, 0x38 }; + light.ansi = null; p.custom_theme = light; pardes.colors.finishThemeInitialization(p); @@ -482,14 +482,14 @@ test "terminal Filter preserves exact palette-null light theme default roles" { const tx = r.x + config.GUTTER; const body_y = p.bodyTop(pane, r); const ordinary = try p.render(frame.allocator()); - try testing.expectEqual(plain.Color{ .rgb = light.fg.? }, ordinary.at(tx, body_y).style.fg); - try testing.expectEqual(plain.Color{ .rgb = light.bg.? }, ordinary.at(tx, body_y).style.bg); + try testing.expectEqual(plain.Color{ .rgb = light.text.? }, ordinary.at(tx, body_y).style.fg); + try testing.expectEqual(plain.Color{ .rgb = light.page.? }, ordinary.at(tx, body_y).style.bg); p.update(.{ .output = .{ .pane = .at(0), .bytes = "\x1b[?5h" } }); _ = frame.reset(.retain_capacity); const reversed = try p.render(frame.allocator()); - try testing.expectEqual(plain.Color{ .rgb = light.bg.? }, reversed.at(tx, body_y).style.fg); - try testing.expectEqual(plain.Color{ .rgb = light.fg.? }, reversed.at(tx, body_y).style.bg); + try testing.expectEqual(plain.Color{ .rgb = light.page.? }, reversed.at(tx, body_y).style.fg); + try testing.expectEqual(plain.Color{ .rgb = light.text.? }, reversed.at(tx, body_y).style.bg); } test "terminal Filter maps the default roles before it maps anything else" { @@ -631,8 +631,8 @@ test "tty ansi colors follow the prompt hug into normal mode" { const r = p.view().rects[0]; const tx = r.x + config.GUTTER; const body_y = p.bodyTop(pane, r); - const red: plain.Color = .{ .rgb = p.theme().palette.?[1] }; - const blue: plain.Color = .{ .rgb = p.theme().palette.?[4] }; + const red: plain.Color = .{ .rgb = p.theme().ansi.?[1] }; + const blue: plain.Color = .{ .rgb = p.theme().ansi.?[4] }; // tty mode projects the emulator's ansi colours cell for cell. pane.body.mode = .tty; @@ -672,7 +672,7 @@ test "a prompt row hidden end to end paints nothing at all" { const s = try p.render(frame.allocator()); try testing.expectEqualStrings(" ", s.at(tx, body_y).grapheme()); - try testing.expect(!std.meta.eql(plain.Color{ .rgb = p.theme().palette.?[1] }, s.at(tx, body_y).style.bg)); + try testing.expect(!std.meta.eql(plain.Color{ .rgb = p.theme().ansi.?[1] }, s.at(tx, body_y).style.bg)); } test "a program that asked for focus reports hears CSI I and CSI O as its pane takes and gives up the keyboard, and as the window does" { |
