diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 12:35:31 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 15:18:26 -0300 |
| commit | e65ada6bfab3e3851281be253b5e8187b652b66b (patch) | |
| tree | 8eda0b933dd1c1c0e1310963b1be0000d01281e7 /test/behaviour | |
| parent | ba3c654472ee0dd9fb5d39dd24063c07a44c6752 (diff) | |
| download | pardes-e65ada6bfab3e3851281be253b5e8187b652b66b.tar.gz pardes-e65ada6bfab3e3851281be253b5e8187b652b66b.zip | |
the Pet back, the window's alone: src/gui/pet.zig and the window's pet overlay return as they were (the workspace tag's blank end, the tag's colours, now read from the Surface's chrome, its walk and hop on the window's own clock, SDL_GetTicks), and Pet is a plain setting now, a choice of off, cat or frog the window reads (config.Runtime.pet, a byte with no state behind it, dumped and replicated as any setting, in /ctl and DumpConfig as `Pet <name>`, and as `# Pet unsupported` where no window draws it, so an init file shared with a terminal loads there clean); its behaviour test and the appearance gallery's pets return
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/behaviour')
| -rw-r--r-- | test/behaviour/settings.zig | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig index 3a9d42df..d87e8191 100644 --- a/test/behaviour/settings.zig +++ b/test/behaviour/settings.zig @@ -43,6 +43,31 @@ test "settings: Shell refuses a path that is no executable, and bare it goes bac try std.testing.expectEqualStrings(default, try setting(&s, "Shell")); } +test "settings: Pet is the window's: a terminal's view refuses it; a window takes only its pets, and /ctl reads it back" { + var s = try Session.initFile(std.testing.allocator, "x\n"); + defer s.deinit(); + // Which build, from its options, not from the answer: a terminal's view + // taking Pet must fail here, not pass as a window. + if (comptime @import("pardes_config").platform == .gui) { + try std.testing.expectEqualStrings("Pet off", try setting(&s, "Pet")); + try s.write("/ctl", "Pet cat\n"); + try std.testing.expectEqualStrings("Pet cat", try setting(&s, "Pet")); + // A window's: dog is no pet of its. + _ = try s.refused("/ctl", "Pet dog\n"); + try std.testing.expectEqualStrings("Pet cat", try setting(&s, "Pet")); + try s.write("/ctl", "Pet frog\n"); + try std.testing.expectEqualStrings("Pet frog", try setting(&s, "Pet")); + try s.write("/ctl", "Pet off\n"); + try std.testing.expectEqualStrings("Pet off", try setting(&s, "Pet")); + return; + } + _ = try s.refused("/ctl", "Pet cat\n"); + try std.testing.expectEqualStrings("Pet is GUI-only, invalid here \"Pet\"", s.said); + try std.testing.expectEqual(@as(u16, 22), try s.refused(s.at("/pane/{d}/exec", .{try s.focused()}), "Pet cat\n")); + try std.testing.expectEqualStrings("Pet is GUI-only, invalid here", s.said); + try std.testing.expect(has(try s.read("/ctl"), "\n# Pet unsupported\n")); +} + fn expectHas(text: []const u8, part: []const u8) !void { if (std.mem.indexOf(u8, text, part) == null) { std.debug.print("not in it: {s}\n", .{part}); |
