add(test): container size with fixed and growable container children
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 46s

This commit is contained in:
2025-03-10 22:07:34 +01:00
parent 5c1d61eefd
commit adda53c5a9
3 changed files with 50 additions and 0 deletions

View File

@@ -904,3 +904,51 @@ test {
_ = Layout;
_ = Rectangle;
}
test "Container Fixed and Grow Size Vertical" {
const event = @import("event.zig");
const testing = @import("testing.zig");
var container: Container(event.SystemEvent) = try .init(std.testing.allocator, .{
.layout = .{ .direction = .vertical },
}, .{});
try container.append(try .init(std.testing.allocator, .{
.size = .{
.dim = .{ .y = 5 },
.grow = .horizontal,
},
.rectangle = .{ .fill = .grey },
}, .{}));
try container.append(try .init(std.testing.allocator, .{
.rectangle = .{ .fill = .red },
}, .{}));
defer container.deinit();
try testing.expectContainerScreen(.{
.y = 20,
.x = 30,
}, &container, @import("test/container/fixed_grow_vertical.zon"));
}
test "Container Fixed and Grow Size Horizontal" {
const event = @import("event.zig");
const testing = @import("testing.zig");
var container: Container(event.SystemEvent) = try .init(std.testing.allocator, .{}, .{});
try container.append(try .init(std.testing.allocator, .{
.size = .{
.dim = .{ .x = 5 },
.grow = .vertical,
},
.rectangle = .{ .fill = .grey },
}, .{}));
try container.append(try .init(std.testing.allocator, .{
.rectangle = .{ .fill = .red },
}, .{}));
defer container.deinit();
try testing.expectContainerScreen(.{
.y = 20,
.x = 30,
}, &container, @import("test/container/fixed_grow_horizontal.zon"));
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long