mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-02-21 18:49:04 +01:00
wip: test: fixing up the tests
- should bring back the rest of the mental model - and allow me to prune it!
This commit is contained in:
parent
ce2eeaee7f
commit
2a7e981b9c
5 changed files with 93 additions and 95 deletions
|
|
@ -0,0 +1,33 @@
|
|||
use crate::*;
|
||||
|
||||
#[test] fn test_tui_engine () -> Usually<()> {
|
||||
//use std::sync::{Arc, RwLock};
|
||||
struct TestComponent(String);
|
||||
impl Draw<TuiOut> for TestComponent {
|
||||
fn draw (&self, _to: &mut TuiOut) {}
|
||||
}
|
||||
impl Handle<TuiIn> for TestComponent {
|
||||
fn handle (&mut self, _from: &TuiIn) -> Perhaps<bool> {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
let engine = Tui::run(false, TestComponent("hello world".into()))?;
|
||||
engine.read().unwrap().exited.store(true, std::sync::atomic::Ordering::Relaxed);
|
||||
//engine.run(&state)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
//#[test] fn test_parse_key () {
|
||||
////use KeyModifiers as Mods;
|
||||
//let _test = |x: &str, y|assert_eq!(KeyMatcher::new(x).build(), Some(Event::Key(y)));
|
||||
////test(":x",
|
||||
////KeyEvent::new(KeyCode::Char('x'), Mods::NONE));
|
||||
////test(":ctrl-x",
|
||||
////KeyEvent::new(KeyCode::Char('x'), Mods::CONTROL));
|
||||
////test(":alt-x",
|
||||
////KeyEvent::new(KeyCode::Char('x'), Mods::ALT));
|
||||
////test(":shift-x",
|
||||
////KeyEvent::new(KeyCode::Char('x'), Mods::SHIFT));
|
||||
////test(":ctrl-alt-shift-x",
|
||||
////KeyEvent::new(KeyCode::Char('x'), Mods::CONTROL | Mods::ALT | Mods::SHIFT ));
|
||||
//}
|
||||
Loading…
Add table
Add a link
Reference in a new issue