summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/behaviour/addons.zig31
-rw-r--r--test/behaviour/addons_pdf.zig2
-rw-r--r--test/session.zig1
3 files changed, 29 insertions, 5 deletions
diff --git a/test/behaviour/addons.zig b/test/behaviour/addons.zig
index 0b0555c2..88c477ea 100644
--- a/test/behaviour/addons.zig
+++ b/test/behaviour/addons.zig
@@ -37,7 +37,7 @@ test "addons: Addon load takes a library in, /addons lists it with the kinds com
defer unload(&s, "fake");
// `<kind> <version> <abi> <panes open> <path> <blake3> <state>`.
const listed = try s.read("/addons");
- try std.testing.expect(std.mem.startsWith(u8, listed, "fake 1 3.3 0 /"));
+ try std.testing.expect(std.mem.startsWith(u8, listed, "fake 1 3.4 0 /"));
var fields = std.mem.tokenizeScalar(u8, listed[0..std.mem.indexOfScalar(u8, listed, '\n').?], ' ');
for (0..5) |_| _ = fields.next();
try std.testing.expectEqual(@as(usize, 64), fields.next().?.len);
@@ -51,7 +51,7 @@ test "addons: Addon load takes a library in, /addons lists it with the kinds com
// A pane of it open, it stays; closed, it goes.
try s.write("/ctl", "Fake\n");
const pane = try paneOf(&s, "fake");
- try std.testing.expect(std.mem.startsWith(u8, try s.read("/addons"), "fake 1 3.3 1 /"));
+ try std.testing.expect(std.mem.startsWith(u8, try s.read("/addons"), "fake 1 3.4 1 /"));
try std.testing.expect(try s.refused("/ctl", "Addon unload fake\n") != 0);
try std.testing.expect(has(s.said, "1 fake pane is open"));
try s.write(s.at("/pane/{d}/ctl", .{pane}), "Del\n");
@@ -68,7 +68,7 @@ test "addons: a library of another ABI, one with no pardes_addon, and one whose
try std.testing.expect(std.mem.startsWith(u8, listed, "fakeabi 1 2.2 0 /"));
try std.testing.expect(has(listed, " refused: wants abi 2, this pardes speaks 3\n"));
try std.testing.expect(has(listed, " refused: it has no pardes_addon\n"));
- try std.testing.expect(has(listed, "\nfakeword 1 3.3 0 /"));
+ try std.testing.expect(has(listed, "\nfakeword 1 3.4 0 /"));
try std.testing.expect(has(listed, " refused: word Save is the core's\n"));
// A file that is no library at all: listed with what the loader said.
var tmp = std.testing.tmpDir(.{});
@@ -120,7 +120,7 @@ test "addons: the image addon opens the pictures a Look names, fitted, with the
defer s.deinit();
try load(&s, Session.image_addon);
const listed = try s.read("/addons");
- try std.testing.expect(std.mem.startsWith(u8, listed, "image 1 3.3 0 /") and has(listed, " loaded\n"));
+ try std.testing.expect(std.mem.startsWith(u8, listed, "image 1 3.4 0 /") and has(listed, " loaded\n"));
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
var buf: [4096]u8 = undefined;
@@ -530,3 +530,26 @@ test "addons: Enter on a picture in a picker opens its kind's pane, never its by
try std.testing.expect(has(screen, s.at("\"serial\":{d},", .{image})) and has(screen, "\"src\":[0,0,2,1]"));
try std.testing.expect(!has(try s.screen(), "1 P6"));
}
+
+test "addons: a kind's pane is painted with the theme's search hit colours, the current hit's apart (ABI 3.4), and a library whose head says 3.3 still loads, opens and paints" {
+ {
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ try load(&s, fake.ok);
+ defer unload(&s, "fake");
+ try s.write("/ctl", "Theme acme\n");
+ try s.write("/ctl", "Fake\n");
+ // acme's: its hit ground, and its amber held for its page's ink.
+ try std.testing.expect(has(try s.screen(), "hits ffc790 a05200"));
+ try s.write("/ctl", "Theme neonotte84\n");
+ try std.testing.expect(has(try s.screen(), "hits 4c301a e59d3c"));
+ }
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ try load(&s, fake.old);
+ defer unload(&s, "fakeold");
+ const listed = try s.read("/addons");
+ try std.testing.expect(std.mem.startsWith(u8, listed, "fakeold 1 3.3 0 /") and has(listed, " loaded\n"));
+ try s.write("/ctl", "Fake\n");
+ try std.testing.expect(has(try s.screen(), "count 0"));
+}
diff --git a/test/behaviour/addons_pdf.zig b/test/behaviour/addons_pdf.zig
index 7df5d5ee..c59b4a93 100644
--- a/test/behaviour/addons_pdf.zig
+++ b/test/behaviour/addons_pdf.zig
@@ -38,7 +38,7 @@ test "addons: a PDF is the pdf addon's pane, its pages pictures, its page in its
s.graphics();
const n = try s.lookFile("docs/design.pdf");
try std.testing.expect(has(try s.read("/index"), " pdf "));
- try std.testing.expect(std.mem.startsWith(u8, try s.read("/addons"), "pdf 1 3.3 1 /"));
+ try std.testing.expect(std.mem.startsWith(u8, try s.read("/addons"), "pdf 1 3.4 1 /"));
const pages = (try s.pdfPage(n))[1];
try std.testing.expectEqual(@as(u32, 16), pages);
// Its first page, a picture over its body.
diff --git a/test/session.zig b/test/session.zig
index 9285c13b..91cca3e5 100644
--- a/test/session.zig
+++ b/test/session.zig
@@ -23,6 +23,7 @@ pub const Session = struct {
pub const no_export = o.fake_addon_no_export;
pub const core_word = o.fake_addon_core_word;
pub const no_dump = o.fake_addon_no_dump;
+ pub const old = o.fake_addon_old;
};
core: *anyopaque,