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::new(0.0, 0.0, 100.0, 100.0);
let r2 = Rect::new(0.1, 0.0, 100.0, 99.9);
assert_rect_approx_eq(r1, r2, 0.2, "Rects should match");