aura-gui 0.2.2

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.
//! El ejemplo del README debe compilar y comportarse como dice.

use aura_ui::prelude::*;

struct Contador {
    clics: u32,
}

impl View for Contador {
    fn view(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
        div()
            .page()
            .center()
            .gap_4()
            .child(div().card().p_6().text_lg().child(format!("Clics: {}", self.clics)))
            .child(Button::new("Sumar").on_click(cx.click(|this, _| this.clics += 1)))
    }
}

#[test]
fn readme_counter_is_centered_and_clickable() {
    let mut window = Window::new(Theme::dark(), Size::new(px(400.0), px(300.0)), 1.0);
    let handle = window.set_root(Contador { clics: 0 });
    window.draw(None);

    let scene = window.scene();
    assert_eq!(scene.shadows.len(), 1, "card usa una sombra SDF");
    let button = scene.quads.last().expect("el botón pinta un quad");
    let [x, y, width, height] = button.bounds;
    assert!((x + width / 2.0 - 200.0).abs() < 1.0, "el botón está centrado en horizontal");

    let center = Point::new(px(x + width / 2.0), px(y + height / 2.0));
    window.handle_event(&InputEvent::MouseDown { position: center, button: MouseButton::Left });
    window.handle_event(&InputEvent::MouseUp { position: center, button: MouseButton::Left });
    assert_eq!(window.entities.read(handle).map(|view| view.clics), Some(1));
}