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.
This commit is contained in:
2026-05-15 23:46:56 +02:00
parent 3d237039c6
commit 4aa3480b64
155 changed files with 13832 additions and 13035 deletions
+50
View File
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: LGPL-2.1-only
// Copyright (C) 2026 Liberux Labs, S. L. <info@liberux.net>
use super::*;
use crate::render::Canvas;
#[ test ]
fn default_size_is_decoration_sized()
{
let canvas = Canvas::new( 100, 100 );
let b = window_button::<()>( WindowButtonKind::Close );
assert_eq!( b.preferred_size( 100.0, &canvas ), ( theme::SIZE, theme::SIZE ) );
}
#[ test ]
fn controls_has_three_children()
{
let controls = window_controls::<()>(
Some( () ), WindowButtonKind::Maximize, Some( () ), Some( () ),
);
assert_eq!( controls.children.len(), 3 );
}
#[ test ]
fn icon_names_resolve_each_kind_to_the_window_catalogue()
{
// Lock the catalogue paths so a future rename of the on-disk
// SVG (e.g. close.svg → x.svg) breaks this test instead of
// silently falling back to the programmatic glyph at runtime.
assert_eq!( icon_name( WindowButtonKind::Minimize ), "window/minimize" );
assert_eq!( icon_name( WindowButtonKind::Maximize ), "window/maximize" );
assert_eq!( icon_name( WindowButtonKind::Restore ), "window/restore" );
assert_eq!( icon_name( WindowButtonKind::Close ), "window/close" );
}
#[ test ]
fn paint_bounds_unchanged_after_glyph_refactor()
{
// The SVG glyph paints inside the button rect just like the
// programmatic one did, so paint_bounds must stay equal to
// the previous value (rect expanded by the focus-ring slack).
let b = window_button::<()>( WindowButtonKind::Close );
let rect = Rect { x: 10.0, y: 10.0, width: 36.0, height: 36.0 };
let bounds = b.paint_bounds( rect );
let slack = theme::FOCUS_W * 1.5 + 2.0;
assert!( ( bounds.x - ( rect.x - slack ) ).abs() < 0.01 );
assert!( ( bounds.y - ( rect.y - slack ) ).abs() < 0.01 );
assert!( ( bounds.width - ( rect.width + slack * 2.0 ) ).abs() < 0.01 );
assert!( ( bounds.height - ( rect.height + slack * 2.0 ) ).abs() < 0.01 );
}