diff options
Diffstat (limited to 'test/output.zig')
| -rw-r--r-- | test/output.zig | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/test/output.zig b/test/output.zig index 70518de8..7fb9f237 100644 --- a/test/output.zig +++ b/test/output.zig @@ -38,16 +38,13 @@ test "search tint survives wrapping and theme changes while selections remain au pane.file.?.output = .{ .from = .search }; var frame = std.heap.ArenaAllocator.init(std.testing.allocator); defer frame.deinit(); - for ([_]bool{ true, false, true }) |colors| { - p.settings.colors = colors; - const surface = try p.render(frame.allocator()); - var marked: usize = 0; - for (surface.cells) |cell| { - if (std.meta.eql(cell.style.bg, pardes.Color{ .rgb = p.theme().search_bg.? })) marked += 1; - } - try std.testing.expectEqual(@as(usize, if (colors) 3 else 0), marked); - _ = frame.reset(.retain_capacity); + const surface = try p.render(frame.allocator()); + var marked: usize = 0; + for (surface.cells) |cell| { + if (std.meta.eql(cell.style.bg, pardes.Color{ .rgb = p.theme().search_bg.? })) marked += 1; } + try std.testing.expectEqual(@as(usize, 3), marked); + _ = frame.reset(.retain_capacity); // The body changes immediately even when dark chrome is still fading. try std.testing.expect(p.executeBuiltinLine(0, "Theme daybreak")); const light = try p.render(frame.allocator()); @@ -430,7 +427,7 @@ test "Mini dump preserves its exact virtual snapshot and body writes detach colo try std.testing.expect(mini.file.?.mini == null); } -test "Mini syntax colors survive toggles themes and rendering without source access" { +test "Mini syntax colors survive themes and rendering without source access" { if (!pardes.syntax.enabled) return error.SkipZigTest; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); @@ -440,7 +437,6 @@ test "Mini syntax colors survive toggles themes and rendering without source acc const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer p.deinit(); try p.panes[0].?.setOwnedCwd(dir); - p.settings.colors = false; try panes.mini.open(p, 0, "demo.zig"); const id = p.active; const mini = p.panes[id].?; @@ -453,14 +449,13 @@ test "Mini syntax colors survive toggles themes and rendering without source acc const colors = mini.file.?.mini.?.colors.ptr; var frame = std.heap.ArenaAllocator.init(std.testing.allocator); defer frame.deinit(); - for ([_]bool{ false, true, false, true }) |enabled| { - p.settings.colors = enabled; + for (0..4) |_| { mini.file.?.syntax_dirty = true; const surface = try p.render(frame.allocator()); const rect = p.rects[id]; const x = rect.x + config.GUTTER + panes.File.gutterWidth(mini) + @as(u16, @intCast(column)); const y = p.bodyTop(mini, rect) + @as(u16, @intCast(position.row)); - if (enabled) try std.testing.expectEqualDeep(pardes.Color{ .rgb = p.theme().kw }, surface.at(x, y).style.fg); + try std.testing.expectEqualDeep(pardes.Color{ .rgb = p.theme().kw }, surface.at(x, y).style.fg); try std.testing.expectEqual(colors, mini.file.?.mini.?.colors.ptr); try std.testing.expectEqual(@as(usize, 0), mini.file.?.highlights.len); _ = frame.reset(.retain_capacity); @@ -776,7 +771,6 @@ test "identical result refresh keeps warm content caches without allocation" { defer p.deinit(); p.locations_config.layout = .@"inline"; const source = try p.setTestFile("notes\n"); - p.settings.colors = true; const text = "a.zig:1:1 pub fn first() void {}\na.zig:2:1 if (true) return;\n"; try panes.Output.fillResults(p, 0, "/tmp", .{ .query = .references }, "before", try p.gpa.dupe(u8, text), 0); const id = source.search_pane orelse return error.MissingResults; |
