VNOX-Client/examples/clipboard_probe.rs
loki5512344 f04691c3cd
chore(client): checkpoint deployed features and unfinished server management
User requested a checkpoint and stopped all agents. Deployed artifacts remain the last verified releases; unfinished settings/categories/forums are preserved as WIP. See TODO/roadmap for verification and remaining release/updater work.
2026-11-01 15:31:21 +01:00

38 lines
1.5 KiB
Rust

//! Native clipboard smoke test: `cargo run --example clipboard_probe`.
//! Focus starts in the ordinary field. Paste a non-sensitive test string with
//! Ctrl+V; Tab moves through password and multiline inputs.
//! Set VNOX_CLIPBOARD_EXPECT to report equality without logging clipboard data.
slint::slint! {
import { LineEdit, TextEdit, VerticalBox } from "std-widgets.slint";
export component ClipboardProbe inherits Window {
title: "VNOX Clipboard Probe";
width: 440px;
height: 260px;
callback changed(string, string);
init => { ordinary.focus(); }
VerticalBox {
ordinary := LineEdit { placeholder-text: "Ordinary input";
edited(value) => { root.changed("ordinary", value); }
}
LineEdit { placeholder-text: "Password input"; input-type: password;
edited(value) => { root.changed("password", value); }
}
TextEdit { edited => { root.changed("multiline", self.text); } }
}
}
}
fn main() -> Result<(), slint::PlatformError> {
let window = ClipboardProbe::new()?;
let expected = std::env::var("VNOX_CLIPBOARD_EXPECT").ok();
window.on_changed(move |field, text| {
let matches = expected
.as_deref()
.map(|expected| expected == text.as_str());
println!(
"field={field} chars={} matches_expected={matches:?}",
text.chars().count()
);
});
window.run()
}