summaryrefslogtreecommitdiff
path: root/test/column_drag.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-15 17:30:38 -0300
committerGabriel Schneider <[email protected]>2026-09-15 17:34:36 -0300
commite462d566f710e714e3b7176672e98fc82a6dea62 (patch)
tree64b3e9dc1ef36aeedbaae7f7e3a77b556676b952 /test/column_drag.zig
parentebe561b8083782a105a2ee29fb0a031d1c2427d3 (diff)
downloadpardes-e462d566f710e714e3b7176672e98fc82a6dea62.tar.gz
pardes-e462d566f710e714e3b7176672e98fc82a6dea62.zip
Separate pane and column grip hit areas from tagline text with a small gap
Diffstat (limited to 'test/column_drag.zig')
-rw-r--r--test/column_drag.zig20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/column_drag.zig b/test/column_drag.zig
index 1c9a344e..be4e33a3 100644
--- a/test/column_drag.zig
+++ b/test/column_drag.zig
@@ -85,7 +85,7 @@ test "column grip drag moves only its interval and keeps tag caret with the colu
try std.testing.expect(p.drag == .column_move);
mouse(p, .drag, target);
_ = try p.render(frame.allocator());
- try std.testing.expectEqual(p.col_w[3] - config.GUTTER - 1, (try tagLayer(p, 3)).viewport.w);
+ try std.testing.expectEqual(p.col_w[3] - pardes.TAG_TEXT_INSET - 1, (try tagLayer(p, 3)).viewport.w);
try std.testing.expectEqual(last_rect, p.rects[p.col_panes[3][0]]);
try std.testing.expectEqual(last_columns, (try tagLayer(p, 3)).cols);
try expectOrder(p, &before, &.{ 0, 1, 2, 3 });
@@ -103,7 +103,7 @@ test "column grip drag moves only its interval and keeps tag caret with the colu
try std.testing.expectEqual(caret, p.topbar_col);
_ = try p.render(frame.allocator());
try std.testing.expectEqual(before[1].serial, (try tagLayer(p, 3)).serial);
- try std.testing.expectEqual(p.col_w[3] - config.GUTTER, (try tagLayer(p, 3)).viewport.w);
+ try std.testing.expectEqual(p.col_w[3] - pardes.TAG_TEXT_INSET, (try tagLayer(p, 3)).viewport.w);
mouse(p, .press, p.col_x[3]);
const back = p.col_x[1] + config.GUTTER;
mouse(p, .drag, back);
@@ -136,13 +136,13 @@ test "column grip is separate from compact text and the resize seam" {
defer frame.deinit();
_ = try p.render(frame.allocator());
const layer = try tagLayer(p, 1);
- try std.testing.expectEqual(p.col_x[1] + config.GUTTER, layer.viewport.x);
+ try std.testing.expectEqual(p.col_x[1] + pardes.TAG_TEXT_INSET, layer.viewport.x);
const surface = &p.surface;
for (0..p.ncol) |column| {
const pane_id = p.col_panes[column][0];
const rect = p.rects[pane_id];
try std.testing.expectEqual(p.col_x[column], rect.x);
- try std.testing.expectEqual(rect.x + config.GUTTER, (try tagLayer(p, column)).viewport.x);
+ try std.testing.expectEqual(rect.x + pardes.TAG_TEXT_INSET, (try tagLayer(p, column)).viewport.x);
for (p.surface.tagLayers()) |pane_layer| {
if (pane_layer.cols > 0 and pane_layer.kind == .pane and pane_layer.id == pane_id)
try std.testing.expectEqual((try tagLayer(p, column)).viewport.x, pane_layer.viewport.x);
@@ -152,9 +152,15 @@ test "column grip is separate from compact text and the resize seam" {
const x = rect.x + @as(u16, @intCast(offset));
try std.testing.expectEqual(surface.at(x, pane_tag_y).style.font_role, surface.at(x, pardes.TOPBAR_H).style.font_role);
}
- try std.testing.expectEqual(pardes.FontRole.tagline, surface.at(rect.x + config.GUTTER, pardes.TOPBAR_H).style.font_role);
- try std.testing.expectEqual(pardes.FontRole.tagline, surface.at(rect.x + config.GUTTER, pane_tag_y).style.font_role);
+ try std.testing.expectEqual(pardes.FontRole.tagline, surface.at(rect.x + pardes.TAG_TEXT_INSET, pardes.TOPBAR_H).style.font_role);
+ try std.testing.expectEqual(pardes.FontRole.tagline, surface.at(rect.x + pardes.TAG_TEXT_INSET, pane_tag_y).style.font_role);
}
+ const gap_x = p.col_x[1] + config.GUTTER;
+ try std.testing.expectEqualStrings(" ", p.surface.at(gap_x, pardes.TOPBAR_H).grapheme());
+ mouse(p, .press, gap_x);
+ try std.testing.expect(p.drag != .column_move);
+ try std.testing.expect(!p.header_drag);
+ mouse(p, .release, gap_x);
p.update(.{ .mouse = headerMouse(layer, 0, .press) });
try std.testing.expect(p.drag != .column_move);
try std.testing.expect(p.header_drag);
@@ -199,7 +205,7 @@ test "column grips stay blank and muted across focus hover and drag" {
try std.testing.expectEqual(muted, cell.style.bg);
try std.testing.expectEqual(pardes.FontRole.tagline, cell.style.font_role);
}
- try std.testing.expectEqual(p.col_x[column] + config.GUTTER, (try tagLayer(p, column)).viewport.x);
+ try std.testing.expectEqual(p.col_x[column] + pardes.TAG_TEXT_INSET, (try tagLayer(p, column)).viewport.x);
}
if (dragging) mouse(p, .release, x);
}