summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig44
1 files changed, 1 insertions, 43 deletions
diff --git a/test/panes.zig b/test/panes.zig
index 958c35a2..f3ae3cfc 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -2,7 +2,6 @@ const std = @import("std");
const pardes = @import("pardes");
const panes = pardes.panes;
const layout = pardes.layout;
-const animation = pardes.animation;
const Pardes = pardes.Pardes;
const Pane = pardes.Pane;
const Key = pardes.Key;
@@ -37,7 +36,6 @@ const TagLayerTests = struct {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 16 });
defer p.deinit();
const pane = try p.setTestFile("body\n");
- p.presentation.enabled = false;
p.settings.tag_bottom = bottom;
p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 };
p.gpa.free(pane.file.?.path);
@@ -72,33 +70,6 @@ const TagLayerTests = struct {
try std.testing.expectEqual(@as(u16, 0), pane.tag_scroll);
try std.testing.expectEqualStrings("body\n", pane.file.?.content);
p.update(.{ .key = .{ .cp = Key.escape } });
- const rect = p.rects[0];
- const track: animation.Track = .{
- .serial = pane.serial,
- .pane = 0,
- .effect = .zoom,
- .frame = 4,
- .frame_count = 10,
- .from = .{ .x = @as(f32, @floatFromInt(rect.x)) + 2, .y = @floatFromInt(rect.y), .w = @floatFromInt(rect.w - 4), .h = @floatFromInt(rect.h) },
- .to = .{ .x = @floatFromInt(rect.x), .y = @floatFromInt(rect.y), .w = @floatFromInt(rect.w), .h = @floatFromInt(rect.h) },
- };
- p.presentation.shown_tracks[0] = track;
- p.presentation.pending = false;
- const shown = track.presented();
- const source_y = @as(f32, @floatFromInt(layer.viewport.y)) + 0.5;
- const painted_x = shown.x + (x / 10 - track.to.x) / track.to.w * shown.w;
- const painted_y = shown.y + (source_y - track.to.y) / track.to.h * shown.h;
- // Each is a first click, whatever cell the one before hit.
- p.last_click = null;
- for ([_]pardes.Mouse.Kind{ .press, .release }) |kind| {
- var event = mouse(layer, x, kind);
- // Hosts inverse the exact painted pixel into the tag envelope;
- // physical routing still receives the original body-grid cell.
- event.col = @intFromFloat(painted_x);
- event.row = @intFromFloat(painted_y);
- p.update(.{ .mouse = event });
- }
- try std.testing.expectEqual(at, @as(usize, @intCast(pane.tag.cur_col)));
}
}
@@ -106,7 +77,6 @@ const TagLayerTests = struct {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 24 });
defer p.deinit();
_ = try p.setTestFile("body\n");
- p.presentation.enabled = false;
p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 };
try std.testing.expect(p.executeBuiltinLine(0, "New"));
const second = p.active;
@@ -289,7 +259,6 @@ const TreeContextTests = struct {
const pane = try p.setTestFile(content);
p.gpa.free(pane.file.?.path);
pane.file.?.path = try p.gpa.dupe(u8, "/tree-context.zig");
- p.presentation.enabled = false;
return pane;
}
@@ -486,7 +455,6 @@ const TtySelectionTests = struct {
test "tty selection yields to a new modal cursor selection" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 12 });
defer p.deinit();
- p.presentation.enabled = false;
const pane = p.panes[0].?;
pane.tty_filter = false;
while (p.nextEffect()) |_| {}
@@ -514,7 +482,6 @@ const TtySelectionTests = struct {
const pane = p.panes[0].?;
pane.body.mode = .tty;
pane.tty_filter = false;
- p.presentation.enabled = false;
while (p.nextEffect()) |_| {}
p.update(.{ .output = .{ .pane = 0, .bytes = if (prompt)
"\x1b]133;A\x07$ \x1b]133;B\x07abc"
@@ -571,7 +538,6 @@ const TtySelectionTests = struct {
for ([_]bool{ false, true }) |reports_mouse| {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 24 });
defer p.deinit();
- p.presentation.enabled = false;
_ = pardes.exec.spawnTty(p, 0);
for (p.panes[0..2]) |slot| {
slot.?.body.mode = .tty;
@@ -727,7 +693,6 @@ const ClickCursorTests = struct {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 14 });
defer p.deinit();
const pane = try p.setTestFile("zero\none\ntwo\nthree\nalpha beta\nfive\ngamma delta\nseven\n" ++ std.mem.asBytes(&@as([20][5]u8, @splat("tail\n".*))));
- p.presentation.enabled = false;
p.settings.wrap = false;
var frame = std.heap.ArenaAllocator.init(p.gpa);
defer frame.deinit();
@@ -835,7 +800,6 @@ const TagNameTintTests = struct {
p.custom_theme = theme;
p.chrome_animation.snap(pardes.ChromeTheme.fromTheme(p.theme()));
p.settings.focus_tint = false;
- p.presentation.enabled = false;
}
fn check(p: *Pardes, id: usize, name: []const u8) !usize {
@@ -1586,7 +1550,6 @@ test "a failed Save to another name leaves a clean named file clean" {
test "unplaced terminal panes keep their allocated grid until placement" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 });
defer p.deinit();
- p.presentation.enabled = false;
while (p.nextEffect()) |_| {}
const id = p.freeSlot().?;
const pane = try p.newShell(id, "");
@@ -1631,7 +1594,6 @@ test "document panes ignore terminal output without allocating terminal state" {
test "removed and recycled pane slots have no stale geometry" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 });
defer p.deinit();
- p.presentation.enabled = false;
const id = p.freeSlot().?;
const original = try p.newDocPane(id);
pardes.layout.insert(p, 0, 1, id);
@@ -2123,7 +2085,6 @@ const OutputTests = struct {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 40 });
defer p.deinit();
_ = try p.setTestFile("notes\n");
- p.presentation.enabled = false;
try std.testing.expect(p.executeBuiltinLine(0, "Help"));
const id = p.active;
const help = p.panes[id].?;
@@ -2200,7 +2161,6 @@ const OutputTests = struct {
defer p.deinit();
p.locations_config.layout = .@"inline";
_ = try p.setTestFile("notes\n");
- p.presentation.enabled = false;
try fillResults(p, 0, "/", .{ .query = .hover }, "", try p.gpa.dupe(u8, "first\nsecond\nthird\n"), null);
const id = for (p.panes, 0..) |slot, id| {
if (slot != null and slot.?.file != null and slot.?.file.?.output != null) break id;
@@ -2210,7 +2170,7 @@ const OutputTests = struct {
var frame: std.heap.ArenaAllocator = .init(std.testing.allocator);
defer frame.deinit();
_ = try p.render(frame.allocator());
- p.acknowledgePanelPresentation(&.{});
+ p.presented();
const rect = p.rects[id];
const x = rect.x + config.GUTTER + panes.File.gutterWidth(result);
const y = bodyY(p, rect);
@@ -3701,7 +3661,6 @@ test "Zig keywords keep every rendered byte colored across line-number widths" {
pane.hscroll = view.horizontal;
p.settings.colors = true;
p.settings.wrap = view.wrap;
- p.presentation.enabled = false;
p.sync();
var frame = std.heap.ArenaAllocator.init(gpa);
defer frame.deinit();
@@ -3825,7 +3784,6 @@ test {
test "a terminal keeps its tag and two body rows through a squeeze, a drag and a smaller window; a text pane does not" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 });
defer p.deinit();
- p.presentation.enabled = false;
p.sync();
while (p.nextEffect()) |_| {}
const term = for (p.panes, 0..) |slot, i| {