mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
This commit is contained in:
parent
21832453d9
commit
17506726cb
36 changed files with 280 additions and 271 deletions
|
|
@ -36,7 +36,7 @@ pub(crate) use std::io::{stdout, Stdout};
|
|||
|
||||
#[cfg(test)] #[test] fn test_tui_engine () -> Usually<()> {
|
||||
use crate::*;
|
||||
use std::sync::{Arc, RwLock};
|
||||
//use std::sync::{Arc, RwLock};
|
||||
struct TestComponent(String);
|
||||
impl Content<TuiOut> for TestComponent {
|
||||
fn content (&self) -> impl Render<TuiOut> {
|
||||
|
|
@ -44,21 +44,21 @@ pub(crate) use std::io::{stdout, Stdout};
|
|||
}
|
||||
}
|
||||
impl Handle<TuiIn> for TestComponent {
|
||||
fn handle (&mut self, from: &TuiIn) -> Perhaps<bool> {
|
||||
fn handle (&mut self, _from: &TuiIn) -> Perhaps<bool> {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
let engine = Tui::new()?;
|
||||
engine.read().unwrap().exited.store(true, std::sync::atomic::Ordering::Relaxed);
|
||||
let state = TestComponent("hello world".into());
|
||||
let state = std::sync::Arc::new(std::sync::RwLock::new(state));
|
||||
let _state = std::sync::Arc::new(std::sync::RwLock::new(state));
|
||||
//engine.run(&state)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_parse_key () {
|
||||
use KeyModifiers as Mods;
|
||||
let test = |x: &str, y|assert_eq!(KeyMatcher::new(x).build(), Some(Event::Key(y)));
|
||||
//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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue