this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

vxfw: fix Surface.satisfiesConstraints

Fix vxfw.Surface.satisfiesContraints to properly check constraints.

authored by

Alex Vidal and committed by
Tim Culverhouse
75b0b0ab 72da2e05

+17 -4
+17 -4
src/vxfw/vxfw.zig
··· 461 461 462 462 /// Returns true if the surface satisfies a set of constraints 463 463 pub fn satisfiesConstraints(self: Surface, min: Size, max: Size) bool { 464 - return self.size.width < min.width and 465 - self.size.width > max.width and 466 - self.size.height < min.height and 467 - self.size.height > max.height; 464 + return self.size.width < max.width and 465 + self.size.width > min.width and 466 + self.size.height < max.height and 467 + self.size.height > min.height; 468 468 } 469 469 }; 470 470 ··· 517 517 518 518 test "refAllDecls" { 519 519 std.testing.refAllDecls(@This()); 520 + } 521 + 522 + test "Surface: satisfiesConstraints" { 523 + const surf: Surface = .{ 524 + .size = .{ .width = 10, .height = 10 }, 525 + .widget = undefined, 526 + .children = &.{}, 527 + .buffer = &.{}, 528 + }; 529 + 530 + try testing.expect(surf.satisfiesConstraints(.{ .width = 1, .height = 1 }, .{ .width = 20, .height = 20 })); 531 + try testing.expect(!surf.satisfiesConstraints(.{ .width = 10, .height = 10 }, .{ .width = 20, .height = 20 })); 532 + try testing.expect(!surf.satisfiesConstraints(.{ .width = 1, .height = 1 }, .{ .width = 10, .height = 10 })); 520 533 } 521 534 522 535 test "All widgets have a doctest and refAllDecls test" {