summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/consumer/lib.zig2
-rw-r--r--test/process/tty_themes.zig177
2 files changed, 117 insertions, 62 deletions
diff --git a/test/consumer/lib.zig b/test/consumer/lib.zig
index 68134cc3..2832bdf1 100644
--- a/test/consumer/lib.zig
+++ b/test/consumer/lib.zig
@@ -88,7 +88,7 @@ test "a C and a Zig source are coloured, outlined and walked as pardes has them,
try std.testing.expectEqual(null, pardes.parse("main.rs", "fn main() {}"));
const orchard = pardes.theme("Orchard").?;
- try std.testing.expectEqual(orchard, &pardes.themes[0]);
+ try std.testing.expectEqual(orchard, &pardes.themes[pardes.default_theme]);
try std.testing.expectEqual([3]u8{ 0x0d, 0x14, 0x10 }, pardes.page(orchard));
try std.testing.expectEqual([3]u8{ 0xe5, 0xee, 0xe5 }, pardes.ink(orchard));
try std.testing.expectEqual([3]u8{ 0xc9, 0xa7, 0xed }, pardes.synInk(orchard, .keyword).?);
diff --git a/test/process/tty_themes.zig b/test/process/tty_themes.zig
index 1975c02b..8c49b77f 100644
--- a/test/process/tty_themes.zig
+++ b/test/process/tty_themes.zig
@@ -17,6 +17,10 @@ pub const cases = .{
fn theme(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
var t = try Tty.init(gpa, exe, "theme");
defer t.deinit();
+ // From the ring's first, dark (the host's page: the tty's own cells),
+ // through pardes's own, those after a classic and acme's, into the first
+ // faithful ports (DESIGN.md E's groups).
+ try t.config("Theme dark");
try t.file("t.txt", "x");
try t.start(31, 100, &.{ "-n", "3" });
try t.wait(8000, "t.txt");
@@ -30,13 +34,23 @@ fn theme(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.key("esc");
try t.settle(100);
try t.stable(700, 10000);
+ try t.snap("dark");
+ try t.style("dark");
+ try t.press("middle", "@NextColor", 1);
+ try t.release("middle", "@NextColor", 1);
+ try t.stable(700, 10000);
+ try t.snap("light");
+ try t.style("light");
+ try t.press("middle", "@NextColor", 1);
+ try t.release("middle", "@NextColor", 1);
+ try t.stable(700, 10000);
try t.snap("orchard");
try t.style("orchard");
try t.press("middle", "@NextColor", 1);
try t.release("middle", "@NextColor", 1);
try t.stable(700, 10000);
- try t.snap("dusk");
- try t.style("dusk");
+ try t.snap("orchard-black");
+ try t.style("orchard-black");
try t.press("middle", "@NextColor", 1);
try t.release("middle", "@NextColor", 1);
try t.stable(700, 10000);
@@ -45,6 +59,21 @@ fn theme(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.press("middle", "@NextColor", 1);
try t.release("middle", "@NextColor", 1);
try t.stable(700, 10000);
+ try t.snap("mono");
+ try t.style("mono");
+ try t.press("middle", "@NextColor", 1);
+ try t.release("middle", "@NextColor", 1);
+ try t.stable(700, 10000);
+ try t.snap("okabe");
+ try t.style("okabe");
+ try t.press("middle", "@NextColor", 1);
+ try t.release("middle", "@NextColor", 1);
+ try t.stable(700, 10000);
+ try t.snap("sepia");
+ try t.style("sepia");
+ try t.press("middle", "@NextColor", 1);
+ try t.release("middle", "@NextColor", 1);
+ try t.stable(700, 10000);
try t.snap("paper");
try t.style("paper");
try t.press("middle", "@NextColor", 1);
@@ -55,8 +84,13 @@ fn theme(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.press("middle", "@NextColor", 1);
try t.release("middle", "@NextColor", 1);
try t.stable(700, 10000);
- try t.snap("atelier");
- try t.style("atelier");
+ try t.snap("dusk");
+ try t.style("dusk");
+ try t.press("middle", "@NextColor", 1);
+ try t.release("middle", "@NextColor", 1);
+ try t.stable(700, 10000);
+ try t.snap("lapis");
+ try t.style("lapis");
try t.press("middle", "@NextColor", 1);
try t.release("middle", "@NextColor", 1);
try t.stable(700, 10000);
@@ -65,6 +99,16 @@ fn theme(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.press("middle", "@NextColor", 1);
try t.release("middle", "@NextColor", 1);
try t.stable(700, 10000);
+ try t.snap("forge-black");
+ try t.style("forge-black");
+ try t.press("middle", "@NextColor", 1);
+ try t.release("middle", "@NextColor", 1);
+ try t.stable(700, 10000);
+ try t.snap("forge-soft");
+ try t.style("forge-soft");
+ try t.press("middle", "@NextColor", 1);
+ try t.release("middle", "@NextColor", 1);
+ try t.stable(700, 10000);
try t.snap("lagoon");
try t.style("lagoon");
try t.press("middle", "@NextColor", 1);
@@ -90,28 +134,13 @@ fn theme(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.press("middle", "@NextColor", 1);
try t.release("middle", "@NextColor", 1);
try t.stable(700, 10000);
- try t.snap("forge-black");
- try t.style("forge-black");
- try t.press("middle", "@NextColor", 1);
- try t.release("middle", "@NextColor", 1);
- try t.stable(700, 10000);
- try t.snap("forge-soft");
- try t.style("forge-soft");
- try t.press("middle", "@NextColor", 1);
- try t.release("middle", "@NextColor", 1);
- try t.stable(700, 10000);
- try t.snap("orchard-black");
- try t.style("orchard-black");
- try t.press("middle", "@NextColor", 1);
- try t.release("middle", "@NextColor", 1);
- try t.stable(700, 10000);
try t.snap("acme");
try t.style("acme");
try t.press("middle", "@NextColor", 1);
try t.release("middle", "@NextColor", 1);
try t.stable(700, 10000);
- try t.snap("lapis");
- try t.style("lapis");
+ try t.snap("atelier");
+ try t.style("atelier");
try t.press("middle", "@NextColor", 1);
try t.release("middle", "@NextColor", 1);
try t.stable(700, 10000);
@@ -120,7 +149,6 @@ fn theme(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.press("middle", "@NextColor", 1);
try t.release("middle", "@NextColor", 1);
try t.stable(700, 10000);
- // After orchard_black: acme and lapis, then the first faithful ports.
try t.snap("solarized-dark");
try t.style("solarized-dark");
try t.done();
@@ -138,10 +166,10 @@ fn theme(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// running it and stopping. There is still no preview state, nothing to confirm
// and nothing to cancel: the row you ran is the theme you have.
//
-// The whole ring is in the buffer, in sections: the fifteen native themes,
-// acme and lapis, the faithful ports a family at a time, the legacy helix and
-// dark, then everything exported from the vendored helix .toml and zed .json
-// files, sorted. The colors below are
+// The whole ring is in the buffer, in sections (DESIGN.md E): pardes's own,
+// those after a classic, acme's, the faithful ports a family at a time, the
+// captured helix, then everything imported from the vendored helix .toml and
+// zed .json files, a family at a time and the lone ones last, sorted. The colors below are
// read with snapstyle, so this proves the generated themes are real data and
// not just names in a list.
fn themesel(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
@@ -159,66 +187,77 @@ fn themesel(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// fresh output buffer is where the walk's ring starts, so the first n goes
// into the list and every one after it carries on down it.
try t.key("space t t");
- try t.wait(10000, "Theme orchard");
+ try t.wait(10000, "Theme dark");
try t.stable(700, 15000);
try t.snap("list");
- // n selects row 1 whole and Tab runs it: `Theme orchard`, which is already the
- // boot theme, so only the selection moves. That is the honest first step — an
- // idempotent command has to be safe to run.
+ // n selects row 1 whole and Tab runs it: `Theme dark`, the ring's first;
+ // the theme changes under the cursor one row at a time, a section's
+ // heading and its blank line skipped (Output.isWalkRow).
+ try t.key("space j n");
+ try t.key("tab");
+ try t.stable(700, 15000);
+ try t.snap("step-dark");
+ try t.style("step-dark");
+ try t.key("space j n");
+ try t.key("tab");
+ try t.stable(700, 15000);
+ try t.snap("step-light");
+ try t.style("step-light");
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
try t.snap("step-orchard");
try t.style("step-orchard");
- // ...and now the theme really does change under the cursor, one row at a time
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
- try t.snap("step-dusk");
- try t.style("step-dusk");
- // Selection alone can skip rows without previewing or applying their themes.
- // Four steps reach atelier, the Acme homage; Tab then applies it.
- try t.key("space j n");
+ try t.snap("step-orchard-black");
+ try t.style("step-orchard-black");
try t.key("space j n");
+ try t.key("tab");
+ try t.stable(700, 15000);
+ try t.snap("step-ink");
+ try t.style("step-ink");
try t.key("space j n");
+ try t.key("tab");
+ try t.stable(700, 15000);
+ try t.snap("step-mono");
+ try t.style("step-mono");
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
- try t.snap("step-atelier");
- try t.style("step-atelier");
+ try t.snap("step-okabe");
+ try t.style("step-okabe");
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
- try t.snap("step-forge");
- try t.style("step-forge");
+ try t.snap("step-sepia");
+ try t.style("step-sepia");
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
- try t.snap("step-lagoon");
- try t.style("step-lagoon");
+ try t.snap("step-paper");
+ try t.style("step-paper");
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
- try t.snap("step-solarium");
- try t.style("step-solarium");
+ try t.snap("step-daybreak");
+ try t.style("step-daybreak");
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
- try t.snap("step-spectrum");
- try t.style("step-spectrum");
+ try t.snap("step-dusk");
+ try t.style("step-dusk");
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
- try t.snap("step-harvest");
- try t.style("step-harvest");
+ try t.snap("step-lapis");
+ try t.style("step-lapis");
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
- try t.snap("step-clay");
- try t.style("step-clay");
- // The three native contrast variants precede acme and lapis, and then the first
- // ported family's section. Its heading
- // and blank separator are not stops in the n/N command walk.
+ try t.snap("step-forge");
+ try t.style("step-forge");
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
@@ -232,8 +271,28 @@ fn themesel(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
- try t.snap("step-orchard-black");
- try t.style("step-orchard-black");
+ try t.snap("step-lagoon");
+ try t.style("step-lagoon");
+ try t.key("space j n");
+ try t.key("tab");
+ try t.stable(700, 15000);
+ try t.snap("step-solarium");
+ try t.style("step-solarium");
+ try t.key("space j n");
+ try t.key("tab");
+ try t.stable(700, 15000);
+ try t.snap("step-spectrum");
+ try t.style("step-spectrum");
+ try t.key("space j n");
+ try t.key("tab");
+ try t.stable(700, 15000);
+ try t.snap("step-harvest");
+ try t.style("step-harvest");
+ try t.key("space j n");
+ try t.key("tab");
+ try t.stable(700, 15000);
+ try t.snap("step-clay");
+ try t.style("step-clay");
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
@@ -242,17 +301,13 @@ fn themesel(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
- try t.snap("step-lapis");
- try t.style("step-lapis");
+ try t.snap("step-atelier");
+ try t.style("step-atelier");
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);
try t.snap("step-dark-plus");
try t.style("step-dark-plus");
- // across the Visual Studio Code section into Solarized: a section heading and
- // its blank line are skipped like the first. (The imported half, past the
- // legacy section, is sorted by name, so the ring is the same everywhere
- // whatever order the directory read handed the files over in.)
try t.key("space j n");
try t.key("tab");
try t.stable(700, 15000);