From 0632e510be273ec413ee54b6bcd1736cb12aa84d Mon Sep 17 00:00:00 2001 From: bunnie Date: Sat, 2 Dec 2023 16:09:37 +0800 Subject: [PATCH] remove tests from mtxchat app --- apps/mtxchat/Cargo.toml | 1 - apps/mtxchat/src/api.rs | 2 +- apps/mtxchat/src/main.rs | 4 ---- apps/mtxchat/src/tests.rs | 35 ----------------------------------- 4 files changed, 1 insertion(+), 41 deletions(-) delete mode 100644 apps/mtxchat/src/tests.rs diff --git a/apps/mtxchat/Cargo.toml b/apps/mtxchat/Cargo.toml index 675743321..c02f1e02d 100644 --- a/apps/mtxchat/Cargo.toml +++ b/apps/mtxchat/Cargo.toml @@ -40,4 +40,3 @@ url = "2.2.2" [features] default = [] -test-chat-ui = [] diff --git a/apps/mtxchat/src/api.rs b/apps/mtxchat/src/api.rs index 928450532..08609cca1 100644 --- a/apps/mtxchat/src/api.rs +++ b/apps/mtxchat/src/api.rs @@ -1,5 +1,5 @@ #[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)] pub enum MtxchatOp { diff --git a/apps/mtxchat/src/main.rs b/apps/mtxchat/src/main.rs index 04f1a29bd..e2b0dc668 100644 --- a/apps/mtxchat/src/main.rs +++ b/apps/mtxchat/src/main.rs @@ -2,8 +2,6 @@ #![cfg_attr(target_os = "none", no_main)] mod api; -#[cfg(feature="test-chat-ui")] -mod tests; use api::*; use chat::{Chat, Event, POST_TEXT_MAX}; @@ -100,8 +98,6 @@ fn wrapped_main() -> ! { let mut mtxchat = MtxChat::new(&chat); let mut first_focus = true; let mut user_post: Option = None; - #[cfg(feature="test-chat-ui")] - tests::test_ui(&chat); loop { let msg = xous::receive_message(sid).unwrap(); log::debug!("got message {:?}", msg); diff --git a/apps/mtxchat/src/tests.rs b/apps/mtxchat/src/tests.rs deleted file mode 100644 index 55aa9d19a..000000000 --- a/apps/mtxchat/src/tests.rs +++ /dev/null @@ -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(); - } -}