summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index ad427cad..f4aff960 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -4188,3 +4188,28 @@ test "a second LookWord list look in a directory refills its +Search rather than
};
try testing.expectEqual(@as(usize, 1), searches);
}
+
+test "Petscii, Palette and Ascii take the state their tag word names, set rather than flipped" {
+ const p = try withFile(testing.allocator, "x\n");
+ defer p.deinit();
+ const doc = try p.newDocPane(p.freeSlot().?);
+ doc.image = .{ .path = try p.gpa.dupe(u8, "/tmp/pardes-pic.ppm") };
+ const ctl_node = Node.of(doc.serial, .ctl);
+ for ([_][]const u8{ "Petscii on\n", "Petscii on\n" }) |line| {
+ try testing.expectEqual(Status.ok, wr(p, ctl_node, line).reply.status);
+ try testing.expect(doc.image.?.glyph_art);
+ }
+ _ = wr(p, ctl_node, "Petscii off\n");
+ try testing.expect(!doc.image.?.glyph_art);
+ _ = wr(p, ctl_node, "Palette terminal\n");
+ _ = wr(p, ctl_node, "Palette terminal\n");
+ try testing.expectEqual(pardes.panes.Image.PaletteMode.terminal, doc.image.?.pmode);
+ _ = wr(p, ctl_node, "Ascii off\n");
+ _ = wr(p, ctl_node, "Ascii off\n");
+ try testing.expect(!doc.image.?.ascii);
+ // Bare, each still flips.
+ _ = wr(p, ctl_node, "Ascii\n");
+ try testing.expect(doc.image.?.ascii);
+ _ = wr(p, ctl_node, "Petscii maybe\n");
+ try testing.expect(th.logHas(p, "Petscii takes on or off"));
+}