diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/column_drag.zig | 50 | ||||
| -rw-r--r-- | test/fs_namespace.zig | 6 | ||||
| -rw-r--r-- | test/panes.zig | 6 | ||||
| -rw-r--r-- | test/pdf.zig | 6 |
4 files changed, 33 insertions, 35 deletions
diff --git a/test/column_drag.zig b/test/column_drag.zig index 0e92e125..94d61827 100644 --- a/test/column_drag.zig +++ b/test/column_drag.zig @@ -33,10 +33,10 @@ fn expectOrder(p: *Pardes, before: []const Snapshot, order: []const usize) !void try std.testing.expectEqual(order.len, p.ncol); for (order, 0..) |original, column| { const saved = before[original]; - try std.testing.expectEqual(saved.weight, p.col_weight[column]); - try std.testing.expectEqual(saved.serial, p.col_serial[column]); - try std.testing.expectEqual(saved.count, p.col_n[column]); - try std.testing.expectEqualSlices(usize, saved.panes[0..saved.count], p.col_panes[column][0..p.col_n[column]]); + try std.testing.expectEqual(saved.weight, p.cols[column].weight); + try std.testing.expectEqual(saved.serial, p.cols[column].serial); + try std.testing.expectEqual(saved.count, p.cols[column].n); + try std.testing.expectEqualSlices(usize, saved.panes[0..saved.count], p.cols[column].panes[0..p.cols[column].n]); try std.testing.expectEqualStrings(saved.tag, pardes.tagline.columnTag(p, column)); } } @@ -51,12 +51,12 @@ test "column grip drag moves only its interval and keeps tag caret with the colu const id = p.active; try std.testing.expect(layout.splitColumn(p, id, id, false)); } - p.active = p.col_panes[1][0]; + p.active = p.cols[1].panes[0]; try std.testing.expect(p.executeBuiltinLine(p.active, "New")); const active = p.active; - try std.testing.expectEqual(@as(usize, 2), p.col_n[1]); + try std.testing.expectEqual(@as(usize, 2), p.cols[1].n); for ([_]u64{ 2, 3, 5, 7 }, 0..) |weight, column| { - p.col_weight[column] = weight; + p.cols[column].weight = weight; p.col_tags[column].own = try p.gpa.dupe(u8, ([_][]const u8{ "zero column header", "one column header", "two column header", "three column header" })[column]); } p.update(.tick); @@ -65,8 +65,8 @@ test "column grip drag moves only its interval and keeps tag caret with the colu _ = try p.render(frame.allocator()); var before: [4]Snapshot = undefined; for (&before, 0..) |*saved, column| { - saved.* = .{ .weight = p.col_weight[column], .serial = p.col_serial[column], .count = p.col_n[column], .tag = pardes.tagline.columnTag(p, column) }; - @memcpy(saved.panes[0..saved.count], p.col_panes[column][0..saved.count]); + saved.* = .{ .weight = p.cols[column].weight, .serial = p.cols[column].serial, .count = p.cols[column].n, .tag = pardes.tagline.columnTag(p, column) }; + @memcpy(saved.panes[0..saved.count], p.cols[column].panes[0..saved.count]); } const layer = try tagLayer(p, 1); const stale = headerMouse(layer, 4, .press); @@ -77,14 +77,14 @@ test "column grip drag moves only its interval and keeps tag caret with the colu const anchor = pardes.tagline.focusedHeader(p).?.vsel; const scroll = p.header_scroll; const target = p.col_x[3] + p.col_w[3] - 2; - const last_rect = p.rects[p.col_panes[3][0]]; + const last_rect = p.rects[p.cols[3].panes[0]]; const last_columns = (try tagLayer(p, 3)).cols; mouse(p, .press, p.col_x[1]); 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] - 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_rect, p.rects[p.cols[3].panes[0]]); try std.testing.expectEqual(last_columns, (try tagLayer(p, 3)).cols); try expectOrder(p, &before, &.{ 0, 1, 2, 3 }); mouse(p, .release, target); @@ -135,7 +135,7 @@ test "column grip is separate from compact text and the resize seam" { 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 pane_id = p.cols[column].panes[0]; const rect = p.rects[pane_id]; try std.testing.expectEqual(p.col_x[column], rect.x); try std.testing.expectEqual(rect.x + pardes.TAG_TEXT_INSET, (try tagLayer(p, column)).viewport.x); @@ -160,7 +160,7 @@ test "column grip is separate from compact text and the resize seam" { try std.testing.expect(p.drag == .column_move); mouse(p, .release, p.col_x[1] + config.GUTTER - 1); const seam = p.col_x[0] + p.col_w[0] - 1; - const body_row = p.rects[p.col_panes[0][0]].y + pardes.BOX_H + 1; + const body_row = p.rects[p.cols[0].panes[0]].y + pardes.BOX_H + 1; p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = seam, .row = body_row } }); try std.testing.expect(p.drag == .border_v); p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = seam, .row = body_row } }); @@ -178,7 +178,7 @@ test "column grips stay blank, and muted across focus and hover until grabbed" { for ([_]bool{ false, true }) |focus_tint| { p.settings.focus_tint = focus_tint; for (0..p.ncol) |active_column| { - p.active = p.col_panes[active_column][0]; + p.active = p.cols[active_column].panes[0]; const x = p.col_x[active_column]; p.update(.{ .mouse = .{ .button = .none, .kind = .motion, .col = x, .row = pardes.TOPBAR_H } }); for ([_]bool{ false, true }) |dragging| { @@ -212,7 +212,7 @@ test "column grip dropped in its own place moves the column's left edge" { var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); _ = try p.render(frame.allocator()); - const serials = .{ p.col_serial[0], p.col_serial[1] }; + const serials = .{ p.cols[0].serial, p.cols[1].serial }; const edge = p.col_x[1]; const total = p.col_w[0] + p.col_w[1]; // A click in place, from either grip cell, changes nothing. @@ -231,13 +231,13 @@ test "column grip dropped in its own place moves the column's left edge" { _ = try p.render(frame.allocator()); try std.testing.expectEqual(edge - 7, p.col_x[1]); try std.testing.expectEqual(total, p.col_w[0] + p.col_w[1]); - try std.testing.expectEqual(serials[0], p.col_serial[0]); - try std.testing.expectEqual(serials[1], p.col_serial[1]); + try std.testing.expectEqual(serials[0], p.cols[0].serial); + try std.testing.expectEqual(serials[1], p.cols[1].serial); // Past the neighbour's middle it is still a reorder, not a resize. mouse(p, .press, p.col_x[1]); mouse(p, .release, p.col_x[0] + 1); - try std.testing.expectEqual(serials[1], p.col_serial[0]); - try std.testing.expectEqual(serials[0], p.col_serial[1]); + try std.testing.expectEqual(serials[1], p.cols[0].serial); + try std.testing.expectEqual(serials[0], p.cols[1].serial); } /// The column of the drag preview's rail, checked to run the full height @@ -278,7 +278,7 @@ test "column grip drag previews where the column lands, in the seam beside its r var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); _ = try p.render(frame.allocator()); - const serials = .{ p.col_serial[0], p.col_serial[1], p.col_serial[2] }; + const serials = .{ p.cols[0].serial, p.cols[1].serial, p.cols[2].serial }; // Held on its own grip it lands nowhere new: no rail. mouse(p, .press, p.col_x[1]); @@ -293,8 +293,8 @@ test "column grip drag previews where the column lands, in the seam beside its r // aims at a place: no word lights under it. for (0..p.screen_w) |x| try std.testing.expect(!std.meta.eql(p.surface.at(@intCast(x), pardes.TOPBAR_H).style.bg, pardes.Color{ .rgb = p.theme().sel_bg })); mouse(p, .release, 3); - try std.testing.expectEqual(serials[1], p.col_serial[0]); - try std.testing.expectEqual(serials[0], p.col_serial[1]); + try std.testing.expectEqual(serials[1], p.cols[0].serial); + try std.testing.expectEqual(serials[0], p.cols[1].serial); // Past the middle column's middle it lands after it: the rail is in the // seam cell left of the last column's rule, where a border drag's is. @@ -306,9 +306,9 @@ test "column grip drag previews where the column lands, in the seam beside its r mouse(p, .drag, p.col_x[2] + p.col_w[2] - 1); try std.testing.expectEqual(@as(?u16, p.screen_w - 1), try previewRail(p, &frame)); mouse(p, .release, p.col_x[2] + p.col_w[2] - 1); - try std.testing.expectEqual(serials[0], p.col_serial[0]); - try std.testing.expectEqual(serials[2], p.col_serial[1]); - try std.testing.expectEqual(serials[1], p.col_serial[2]); + try std.testing.expectEqual(serials[0], p.cols[0].serial); + try std.testing.expectEqual(serials[2], p.cols[1].serial); + try std.testing.expectEqual(serials[1], p.cols[2].serial); // Short of a neighbour's middle the left edge moves, and the preview // is the seam that edge will have: exactly where the release puts it. diff --git a/test/fs_namespace.zig b/test/fs_namespace.zig index 2fda05fd..3a918a28 100644 --- a/test/fs_namespace.zig +++ b/test/fs_namespace.zig @@ -262,8 +262,7 @@ test "owned cwd failed file opens never publish a pane or retain a reservation" const name = try std.fmt.bufPrint(&path, "/virtual/pane/{d}/body", .{source.serial}); const slot = p.freeSlot().?; const serial = p.next_serial; - const columns = p.col_panes; - const counts = p.col_n; + const columns = p.cols; allocator.fail_index = allocator.alloc_index + failure; const opened = pardes.panes.File.open(p, slot, name, 0) catch |err| { try std.testing.expect(err == error.OutOfMemory or err == error.ReadFailed or err == error.WriteFailed); @@ -271,8 +270,7 @@ test "owned cwd failed file opens never publish a pane or retain a reservation" try std.testing.expect(!p.reserved_slots[slot]); try std.testing.expectEqual(serial, p.next_serial); try std.testing.expectEqual(slot, p.freeSlot().?); - try std.testing.expectEqualDeep(columns, p.col_panes); - try std.testing.expectEqualDeep(counts, p.col_n); + try std.testing.expectEqualDeep(columns, p.cols); try std.testing.expectEqual(@as(usize, 0), p.effects_len); try std.testing.expectEqualStrings("/source/directory", source.cwdSlice()); allocator.fail_index = std.math.maxInt(usize); diff --git a/test/panes.zig b/test/panes.zig index 27598334..a0354ba4 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -3796,7 +3796,7 @@ test "a terminal keeps its tag and two body rows through a squeeze, a drag and a const floor = p.panes[term].?.tag_rows + layout.min_body_rows; // Squeezed by the weights: the others give it its floor. p.panes[term].?.vweight = 0.01; - for (p.col_panes[col][0..p.col_n[col]]) |k| if (k != term) { + for (p.cols[col].panes[0..p.cols[col].n]) |k| if (k != term) { p.panes[k].?.vweight = 1000; }; p.sync(); @@ -3809,11 +3809,11 @@ test "a terminal keeps its tag and two body rows through a squeeze, a drag and a // A drag of the grip under it up to its tag stops at the floor; one // the other way takes a text pane down to its tag alone. const k = layout.findPane(p, term).?.idx; - if (k + 1 < p.col_n[col]) { + if (k + 1 < p.cols[col].n) { layout.applyRowSplit(p, col, k, p.rects[term].y); p.sync(); try std.testing.expectEqual(floor, p.rects[term].h); - const text = p.col_panes[col][k + 1]; + const text = p.cols[col].panes[k + 1]; layout.applyRowSplit(p, col, k, p.screen_h); p.sync(); try std.testing.expect(p.rects[text].h <= p.panes[text].?.tag_rows); diff --git a/test/pdf.zig b/test/pdf.zig index 730bf2ce..bf0bfae7 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -1498,8 +1498,8 @@ test "PDF pane geometry change preserves its page-relative position" { // A divider/split changes rects through computeGeom without emitting a // shell resize. panes.Pdf.ensurePaneLayout anchors against the old layout // before rebuilding it for this wider pane. - const sibling_weight = p.col_weight[1]; - p.col_weight[0] = sibling_weight * 6; + const sibling_weight = p.cols[1].weight; + p.cols[0].weight = sibling_weight * 6; layout.compute(p); try std.testing.expect(panes.Pdf.paneViewport(p, pane).?.pixel_w != old_width); try std.testing.expect(pv.layout_valid); @@ -1514,7 +1514,7 @@ test "PDF pane geometry change preserves its page-relative position" { // An explicit pending reveal wins over an implicit layout anchor. pv.page = 2; pv.scroll_to_page_pending = true; - p.col_weight[0] = sibling_weight * 2; + p.cols[0].weight = sibling_weight * 2; layout.compute(p); _ = frame.reset(.retain_capacity); _ = try p.render(frame.allocator()); |
