ref(container): split size and position calculations
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 34s

This commit is contained in:
2025-03-04 19:53:28 +01:00
parent 65d7546efd
commit fc72cf4abb
14 changed files with 205 additions and 180 deletions

View File

@@ -34,7 +34,7 @@ pub const Renderer = struct {
pub fn resize(this: *@This(), size: Point) !void {
this.size = size;
const n = @as(usize, size.cols) * @as(usize, size.y);
const n = @as(usize, size.x) * @as(usize, size.y);
this.allocator.free(this.screen);
this.screen = this.allocator.alloc(Cell, n) catch @panic("testing.zig: Out of memory.");
@@ -120,8 +120,8 @@ pub fn expectContainerScreen(size: Point, container: *Container(event.SystemEven
var renderer: Renderer = .init(allocator, size);
defer renderer.deinit();
container.reposition(.{});
container.resize(size);
try renderer.resize(size);
container.resize(.{}, size);
try renderer.render(Container(event.SystemEvent), container);
try expectEqualCells(.{}, renderer.size, expected, renderer.screen);