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.
//! Una etiqueta seleccionable se puede seleccionar con el ratón y copiar, pero no editar.

use aura_ui::view::prelude::*;
use aura_ui::view::test_context::TestWindow;
use aura_ui::widgets::{TextInput, bind_widget_keys};

struct Host {
    label: Handle<TextInput>,
}

impl View for Host {
    fn view(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
        div().size_full().p_4().child(cx.render_child(self.label)).into_element()
    }
}

fn window() -> (TestWindow, Handle<Host>) {
    TestWindow::new(|window| {
        bind_widget_keys(&mut window.keymap);
        let focus = window.entities.focus.new_handle();
        let label = window.entities.insert(TextInput::selectable_label(focus, "error: archivo no encontrado"));
        Host { label }
    })
}

#[test]
fn select_all_and_copy_work_but_typing_does_not_edit() {
    let (mut test, host) = window();
    let label = test.read(host, |host| host.label);
    // Un clic enfoca la etiqueta (su texto empieza a unos 16 px del borde).
    test.simulate_click(40.0, 24.0);
    test.simulate_keystrokes("mod-a mod-c");
    let copied = test.window.entities.clipboard.read();
    assert_eq!(copied.as_deref(), Some("error: archivo no encontrado"));
    test.simulate_keystrokes("x backspace");
    test.read(label, |input| assert_eq!(input.text(), "error: archivo no encontrado", "solo lectura"));
}

#[test]
fn dragging_selects_part_of_the_text() {
    let (mut test, host) = window();
    let label = test.read(host, |host| host.label);
    test.simulate_drag((17.0, 24.0), (60.0, 24.0));
    test.simulate_keystrokes("mod-c");
    let copied = test.window.entities.clipboard.read().unwrap_or_default();
    assert!(!copied.is_empty() && "error: archivo no encontrado".starts_with(&copied), "copió {copied:?}");
    test.read(label, |input| assert!(!input.selection().is_empty()));
}