// SPDX-License-Identifier: LGPL-2.1-only
// Copyright (C) 2026 Liberux Labs, S. L. <info@liberux.net>

use super::*;

#[ test ]
fn resolve_rect_uses_anchor_when_present()
{
	let anchor   = Rect { x: 100.0, y: 50.0, width: 200.0, height: 40.0 };
	let fallback = Rect { x: 0.0, y: 0.0, width: 800.0, height: 600.0 };
	let r = AnchoredOverlay::<()>::resolve_rect( Some( anchor ), 8.0, fallback );
	assert_eq!( r.x, 100.0 );
	assert_eq!( r.y, 98.0 );          // anchor.y + height + gap
	assert_eq!( r.width, 200.0 );      // anchor width
	assert_eq!( r.height, 600.0 );     // fallback height
}

#[ test ]
fn resolve_rect_falls_back_when_anchor_missing()
{
	let fallback = Rect { x: 5.0, y: 6.0, width: 7.0, height: 8.0 };
	let r = AnchoredOverlay::<()>::resolve_rect( None, 8.0, fallback );
	assert_eq!( r, fallback );
}
