Files
ltk/src/widget/anchored_overlay/tests.rs
Pedro M. de Echanove Pasquin 4aa3480b64 refactor: split every monolithic module into focused submodules
Each source file that had grown beyond a single concern is replaced by an identically-named directory containing focused submodules. `src/event_loop/mod.rs` (878 lines) becomes a directory with clipboard, context_menu, cursor_shape, drag, focus, handlers, invalidation, overlays_reconcile, repeat, run, surface, text_editing, and tooltip. Every widget, input handler, and theme component follows the same split. Public interfaces are unchanged — only the internal file layout moves.
image bumped from 0.25.2 to 0.25.9.
2026-05-15 23:46:56 +02:00

25 lines
820 B
Rust

// 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 );
}