implement shellchat test modals

remove modals feature ux_tests
This commit is contained in:
nworbnhoj 2022-05-25 10:29:21 +10:00
parent f19b2ac939
commit 342e8e82b1
5 changed files with 10 additions and 11 deletions

View file

@ -32,6 +32,5 @@ fast_image_resize = "0.9.2"
utralib = { path = "../../utralib"}
[features]
ux_tests = []
tts = []
default = ["ux_tests"]
default = []

View file

@ -2,6 +2,7 @@
pub mod api;
use api::*;
pub mod tests;
use bit_field::BitField;
use core::cell::Cell;

View file

@ -27,7 +27,6 @@
/// a `TextResponseValid` message which pumps the work queue.
mod api;
use api::*;
mod tests;
use gam::Bitmap;
use xous::{msg_blocking_scalar_unpack, msg_scalar_unpack, send_message, Message};
@ -126,11 +125,6 @@ fn xmain() -> ! {
let mut list_hash = HashMap::<String, usize>::new();
let mut list_selected = 0u32;
if cfg!(feature = "ux_tests") {
tt.sleep_ms(1000).unwrap();
tests::spawn_test();
}
let mut token_lock: Option<[u32; 4]> = None;
let trng = trng::Trng::new(&xns).unwrap();
// this is a random number that serves as a "default" that cannot be guessed

View file

@ -3,6 +3,7 @@ use gam::*;
use std::thread;
use xous_names::XousNames;
use image::io::{Reader};
use super::*;
const RADIO_TEST: [&'static str; 4] = ["zebra", "cow", "horse", "cat"];
@ -15,12 +16,12 @@ const CHECKBOX_TEST: [&'static str; 5] = ["happy", "😃", "安", "peaceful", ".
///
/// Each thread will create a series of Modal primitives, including progess bars, notifications,
/// check boxes and radio boxes.
pub(crate) fn spawn_test() {
pub fn spawn_test() {
// spawn two threads that compete for modal resources, to test the interlocking mechanisms
thread::spawn({
move || {
let xns = XousNames::new().unwrap();
let modals = modals::Modals::new(&xns).unwrap();
let modals = Modals::new(&xns).unwrap();
let tt = ticktimer_server::Ticktimer::new().unwrap();
// 0. multi-modal test
@ -84,7 +85,7 @@ pub(crate) fn spawn_test() {
thread::spawn({
move || {
let xns = XousNames::new().unwrap();
let modals = modals::Modals::new(&xns).unwrap();
let modals = Modals::new(&xns).unwrap();
// 1. test radio box
for item in RADIO_TEST {

View file

@ -10,6 +10,7 @@ use core::fmt::Write;
use core::sync::atomic::{AtomicBool, Ordering, AtomicU32};
use std::sync::Arc;
use num_traits::*;
use modals;
use std::time::Instant;
@ -608,6 +609,9 @@ impl<'a> ShellCmdApi<'a> for Test {
write!(ret, "Ship mode request denied").unwrap();
}
}
"modals" => {
modals::tests::spawn_test();
}
_ => {
() // do nothing
}