Skip to main content

assert_rect_approx_eq

Function assert_rect_approx_eq 

Source
pub fn assert_rect_approx_eq(
    actual: Rect,
    expected: Rect,
    tolerance: f32,
    msg: &str,
)
Expand description

Assert that a rectangle is approximately equal to another.

Checks x, y, width, and height individually with the given tolerance.

ยงExample

use cranpose_testing::robot_assertions::assert_rect_approx_eq;
use cranpose_ui_graphics::Rect;

let r1 = Rect { x: 0.0, y: 0.0, width: 100.0, height: 100.0 };
let r2 = Rect { x: 0.1, y: 0.0, width: 100.0, height: 99.9 };
assert_rect_approx_eq(r1, r2, 0.2, "Rects should match");