remove tests from mtxchat app

This commit is contained in:
bunnie 2023-12-02 16:09:37 +08:00
parent f88afd1a1a
commit 0632e510be
4 changed files with 1 additions and 41 deletions

View file

@ -40,4 +40,3 @@ url = "2.2.2"
[features]
default = []
test-chat-ui = []

View file

@ -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 {

View file

@ -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<String> = None;
#[cfg(feature="test-chat-ui")]
tests::test_ui(&chat);
loop {
let msg = xous::receive_message(sid).unwrap();
log::debug!("got message {:?}", msg);

View file

@ -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();
}
}