mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-25 09:50:52 +00:00
35 lines
1,008 B
Rust
35 lines
1,008 B
Rust
|
|
#![allow(dead_code)]
|
||
|
|
use std::thread;
|
||
|
|
use gam::*;
|
||
|
|
|
||
|
|
use xous_names::XousNames;
|
||
|
|
|
||
|
|
pub(crate) fn spawn_test() {
|
||
|
|
thread::spawn({
|
||
|
|
move || {
|
||
|
|
let xns = XousNames::new().unwrap();
|
||
|
|
|
||
|
|
// test the modal dialog box function
|
||
|
|
let modals = modals::Modals::new(&xns).unwrap();
|
||
|
|
log::info!("test text input");
|
||
|
|
match modals.get_text_input("Test input", Some(test_validator), None) {
|
||
|
|
Ok(text) => {
|
||
|
|
log::info!("Input: {}", text.0);
|
||
|
|
}
|
||
|
|
_ => {
|
||
|
|
log::error!("get_text_input failed");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
log::info!("text input test done");
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
fn test_validator(input: TextEntryPayload, _opcode: u32) -> Option<xous_ipc::String::<256>> {
|
||
|
|
let text_str = input.as_str();
|
||
|
|
match text_str.parse::<u32>() {
|
||
|
|
Ok(_input_int) => None,
|
||
|
|
_ => return Some(xous_ipc::String::<256>::from_str("enter an integer value"))
|
||
|
|
}
|
||
|
|
}
|