mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
remove tests from mtxchat app
This commit is contained in:
parent
f88afd1a1a
commit
0632e510be
4 changed files with 1 additions and 41 deletions
|
|
@ -40,4 +40,3 @@ url = "2.2.2"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
test-chat-ui = []
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub(crate) const SERVER_NAME_MTXCHAT: &str = "_Matrix chat_";
|
pub(crate) const SERVER_NAME_MTXCHAT: &str = "_Chat UI test_";
|
||||||
|
|
||||||
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
#[derive(Debug, num_derive::FromPrimitive, num_derive::ToPrimitive)]
|
||||||
pub enum MtxchatOp {
|
pub enum MtxchatOp {
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
#![cfg_attr(target_os = "none", no_main)]
|
#![cfg_attr(target_os = "none", no_main)]
|
||||||
|
|
||||||
mod api;
|
mod api;
|
||||||
#[cfg(feature="test-chat-ui")]
|
|
||||||
mod tests;
|
|
||||||
|
|
||||||
use api::*;
|
use api::*;
|
||||||
use chat::{Chat, Event, POST_TEXT_MAX};
|
use chat::{Chat, Event, POST_TEXT_MAX};
|
||||||
|
|
@ -100,8 +98,6 @@ fn wrapped_main() -> ! {
|
||||||
let mut mtxchat = MtxChat::new(&chat);
|
let mut mtxchat = MtxChat::new(&chat);
|
||||||
let mut first_focus = true;
|
let mut first_focus = true;
|
||||||
let mut user_post: Option<String> = None;
|
let mut user_post: Option<String> = None;
|
||||||
#[cfg(feature="test-chat-ui")]
|
|
||||||
tests::test_ui(&chat);
|
|
||||||
loop {
|
loop {
|
||||||
let msg = xous::receive_message(sid).unwrap();
|
let msg = xous::receive_message(sid).unwrap();
|
||||||
log::debug!("got message {:?}", msg);
|
log::debug!("got message {:?}", msg);
|
||||||
|
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
use chat::Chat;
|
|
||||||
|
|
||||||
pub fn test_ui(chat: &Chat) {
|
|
||||||
let tt = ticktimer_server::Ticktimer::new().unwrap();
|
|
||||||
let pddb = pddb::Pddb::new();
|
|
||||||
// nuke any existing test dictionary, if it exists
|
|
||||||
pddb.delete_dict("tests.ui", None).ok();
|
|
||||||
pddb.sync().ok();
|
|
||||||
|
|
||||||
// re-create the test room from scratch every time
|
|
||||||
chat.dialogue_set("tests.ui", Some("test_room")).expect("couldn't set dialog");
|
|
||||||
|
|
||||||
// generate a list of test posts that are repeatable each time
|
|
||||||
chat.post_add("alice", 1_700_000_000, "hello world!", None).ok();
|
|
||||||
chat.post_add("bob", 1_700_000_002, "hi alice!", None).ok();
|
|
||||||
for i in 0..5 {
|
|
||||||
chat.post_add("alice", 1_700_000_005 + i*4, &format!("alice sez {}", i), None).ok();
|
|
||||||
chat.post_add("bob", 1_700_000_006 + i*4, &format!("bob sez {}", i), None).ok();
|
|
||||||
chat.post_add("trent", 1_700_000_007 + i*4, &format!("trent sez {}", i), None).ok();
|
|
||||||
}
|
|
||||||
chat.post_add("alice", 1_700_001_000, "eom", None).ok();
|
|
||||||
|
|
||||||
log::info!("triggering save");
|
|
||||||
xous::send_message(
|
|
||||||
chat.cid(),
|
|
||||||
xous::Message::new_scalar(chat::ChatOp::DialogueSave as usize, 0, 0, 0, 0),
|
|
||||||
)
|
|
||||||
.expect("failed to send new inbound msgs");
|
|
||||||
|
|
||||||
log::info!("test done, displaying result");
|
|
||||||
loop {
|
|
||||||
// just idle so that the main loop of mtxchat doesn't trigger and interfere with the test
|
|
||||||
tt.sleep_ms(5000).ok();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue