diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-27 21:49:28 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 41bbbd05dccb02631ed785d19ed54fb4edfcc471 (patch) | |
| tree | ab1b8c26cb588eb92b9b1e58004237a2abe919ab /test | |
| parent | fa5260c120268f1c1e3dbd2a17264e5896476576 (diff) | |
| download | pardes-41bbbd05dccb02631ed785d19ed54fb4edfcc471.tar.gz pardes-41bbbd05dccb02631ed785d19ed54fb4edfcc471.zip | |
Move colour themes out of pardes.zig into colors.zig
Pure move, no behaviour change: the Theme type, the curated palettes,
fold and the themes ring with its two comptime checks, themeContrast, mix,
ChromeTheme, ChromeAnimation and initial_chrome, the Pardes methods that
load theme files and switch themes (nextThemeFileGeneration,
requestThemeFile, ThemeFileRequest, themeFileRequest, failThemeFile,
loadThemeFile, finishThemeInitialization, invalidateThemeDependentRasters,
setThemeIndex), and the ten theme tests go verbatim to colors.zig.
The methods become free functions taking `p: *Pardes`; their call sites
change from `p.setThemeIndex(i)` to `colors.setThemeIndex(p, i)` (37 of
them, in pardes.zig, builtins.zig, file_watch.zig, macos.zig and two test
files). pardes.zig keeps `pub const Theme/themes/native_theme_count/
ChromeTheme = colors.X;` for the shells that name them, and sync and
enterTagEdit become pub because a moved test calls them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test')
| -rw-r--r-- | test/output.zig | 2 | ||||
| -rw-r--r-- | test/pdf.zig | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/test/output.zig b/test/output.zig index cda5f556..ebea79d4 100644 --- a/test/output.zig +++ b/test/output.zig @@ -950,7 +950,7 @@ test "ThemeSel groups native themes first and skips headings in both directions" const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 40 }); defer p.deinit(); const source = try p.setTestFile("notes\n"); - p.setThemeIndex(pardes.themes.len - 1); + pardes.colors.setThemeIndex(p, pardes.themes.len - 1); const original_theme = p.settings.theme; try std.testing.expect(p.executeBuiltinLine(0, "ThemeSel")); const tid = source.search_pane orelse return error.MissingThemeList; diff --git a/test/pdf.zig b/test/pdf.zig index 930cc5c0..25d0de76 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -1310,7 +1310,7 @@ test "PdfTint cycles pane-local state without adding tag clutter" { const dark_index = for (themes, 0..) |th, i| { if (std.mem.eql(u8, th.name, "dark")) break i; } else return error.MissingDarkTheme; - p.setThemeIndex(dark_index); + pardes.colors.setThemeIndex(p, dark_index); const colors = panes.Pdf.tintColors(p); try std.testing.expectEqual(p.theme().tag_bg, colors.background); try std.testing.expectEqual(p.theme().tag_fg, colors.foreground); @@ -1386,7 +1386,7 @@ test "PDF tint and tinted theme changes rebuild every visible raster only" { const dark_index = for (themes, 0..) |th, i| { if (std.mem.eql(u8, th.name, "dark")) break i; } else return error.MissingDarkTheme; - p.setThemeIndex(dark_index); + pardes.colors.setThemeIndex(p, dark_index); for (pv.rasters[0..pv.rasters_len]) |raster| try std.testing.expect(!raster.tried); _ = frame.reset(.retain_capacity); const themed_surface = try p.render(frame.allocator()); @@ -1440,7 +1440,7 @@ test "PDF tint and tinted theme changes rebuild every visible raster only" { if (std.mem.eql(u8, th.name, "acme")) break i; } else return error.MissingAcmeTheme; for (pv.rasters[0..pv.rasters_len]) |raster| try std.testing.expect(raster.tried); - p.setThemeIndex(acme_index); + pardes.colors.setThemeIndex(p, acme_index); // Disabled keys ignore theme colors, so neither explicit invalidation nor // the per-raster key comparison asks MuPDF for replacement pixels. for (pv.rasters[0..pv.rasters_len]) |raster| try std.testing.expect(raster.tried); |
