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
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 46s
This commit is contained in:
@@ -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"));
|
||||
}
|
||||
|
||||
1
src/test/container/fixed_grow_horizontal.zon
Normal file
1
src/test/container/fixed_grow_horizontal.zon
Normal file
File diff suppressed because one or more lines are too long
1
src/test/container/fixed_grow_vertical.zon
Normal file
1
src/test/container/fixed_grow_vertical.zon
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user