aura-gui 0.3.0

UI nativa acelerada por GPU para escritorio, Android e iOS, en un solo crate: estilo tipo Tailwind, componentes, sombras, animaciones y agentes de IA. Reposo a cero. Licencia AGPL-3.0 o comercial.
//! La barra de scroll se arrastra con el pulgar, salta al pulsar la pista y se ve con marcadores.

use aura_ui::view::prelude::*;
use aura_ui::view::scrollbar::Marker;
use aura_ui::view::test_context::TestWindow;

struct Page;

impl Component for Page {
    fn view(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
        let rows =
            (0..100).map(|index| div().h(px(20.0)).flex_shrink_0().child(format!("fila {index}")).into_element());
        div()
            .id("pagina")
            .flex_col()
            .w(px(300.0))
            .h(px(200.0))
            .overflow_y_scroll()
            .children(rows.collect::<Vec<_>>())
            .into_element()
    }
}

fn offset(test: &mut TestWindow) -> f32 {
    test.window.scroll_offset("pagina")
}

#[test]
fn dragging_the_thumb_scrolls_the_content() {
    let (mut test, _) = TestWindow::new(|_| Page);
    assert_eq!(offset(&mut test), 0.0);
    // Contenido de 2000 px en 200 visibles: el pulgar mide 20 px (mínimo 24) y arranca arriba.
    test.simulate_drag((294.0, 10.0), (294.0, 100.0));
    let moved = offset(&mut test);
    assert!(moved > 500.0 && moved < 1_500.0, "arrastrar medio camino mueve el contenido: {moved}");
}

#[test]
fn pressing_the_track_jumps_to_that_position() {
    let (mut test, _) = TestWindow::new(|_| Page);
    test.simulate_click(294.0, 190.0);
    let jumped = offset(&mut test);
    assert!(jumped > 1_500.0, "pulsar cerca del final lleva casi al final: {jumped}");
}

#[test]
fn markers_are_plain_data() {
    let marker = Marker { fraction: 0.5, color: aura_ui::core::Rgba::new(1.0, 0.0, 0.0, 1.0) };
    assert_eq!(marker.fraction, 0.5);
}