From d4485660aa6339dbe546a81f4b543d68dfbfa9ec Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 02:20:42 -0300 Subject: the four gui unit tests that failed on the base pass: the behaviour tests allow the window's own rows (/status ends in `pointer in|out` on a window; a bare setting word moves a setting, a toggle to its other side and Lift, Crt or ShaderAnimation to their next state, and Shader and Pet, whose off means no file and no pet, take a name, not a flip); the tagline pointer-mapping test puts the workspace tag's text TAG_TEXT_INSET cells in, as it is drawn; the caret test that grew a tag past a row's end goes, as a tag wraps onto rows (up to MAX_TAG_ROWS) and no caret is past one Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/behaviour/look_and_exec.zig | 6 +++++- test/behaviour/settings.zig | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'test/behaviour') diff --git a/test/behaviour/look_and_exec.zig b/test/behaviour/look_and_exec.zig index e88a0053..658d2483 100644 --- a/test/behaviour/look_and_exec.zig +++ b/test/behaviour/look_and_exec.zig @@ -500,7 +500,11 @@ test "look-and-exec: status reads the editor, and look and exec validate whole b try std.testing.expect(std.mem.startsWith(u8, rows.next().?, "pid ")); try std.testing.expect(std.mem.startsWith(u8, rows.next().?, "version ")); try std.testing.expectEqualStrings(s.at("panes {d}", .{lines(try s.read("/index"))}), rows.next().?); - try std.testing.expect(rows.next() == null); + // A window adds whether the pointer is over it (Handover asks every window). + if (rows.next()) |row| { + try std.testing.expect(std.mem.eql(u8, row, "pointer in") or std.mem.eql(u8, row, "pointer out")); + try std.testing.expect(rows.next() == null); + } const st = try s.stat("/status"); try expectEqual(@as(u64, status.len), st.size); try expectEqual(@as(u16, 0o444), st.mode & 0o777); diff --git a/test/behaviour/settings.zig b/test/behaviour/settings.zig index 9a14ff50..c4d93419 100644 --- a/test/behaviour/settings.zig +++ b/test/behaviour/settings.zig @@ -257,8 +257,21 @@ test "settings: every on/off setting the root ctl reads flips when its word is w const word, const was = .{ line[0..space], line[space + 1 ..] }; const on = std.mem.eql(u8, was, "on"); if (!on and !std.mem.eql(u8, was, "off")) continue; - try s.write("/ctl", s.at("{s}\n", .{word})); - try std.testing.expectEqualStrings(s.at("{s} {s}", .{ word, if (on) "off" else "on" }), try setting(&s, word)); + // Shader's and Pet's `off` say they have no file and no pet; each takes + // a name, not a flip. + if (std.mem.eql(u8, word, "Shader") or std.mem.eql(u8, word, "Pet")) continue; + s.write("/ctl", s.at("{s}\n", .{word})) catch |err| { + std.debug.print("a bare {s} (was {s}) was refused\n", .{ word, was }); + return err; + }; + // A bare word moves the setting: a toggle to its other side, one with + // more states (Lift's auto, Crt's level, ShaderAnimation's always) to + // the next, never nowhere. + const after = try setting(&s, word); + try std.testing.expect(std.mem.startsWith(u8, after, word)); + try std.testing.expect(!std.mem.eql(u8, after, line)); + if (on) try std.testing.expect(!std.mem.endsWith(u8, after, " on")); + if (!on) try std.testing.expect(!std.mem.endsWith(u8, after, " off")); flipped += 1; } try std.testing.expect(flipped > 20); -- cgit v1.3