mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
cleanup + update tests; add 'just test'
This commit is contained in:
parent
62a0e8c17c
commit
4ae31bbba0
11 changed files with 45 additions and 1470 deletions
|
|
@ -17,8 +17,8 @@ mod tui_border; pub use self::tui_border::*;
|
|||
pub(crate) use std::sync::{Arc, RwLock, atomic::{AtomicBool, Ordering::*}};
|
||||
pub(crate) use std::io::{stdout, Stdout};
|
||||
|
||||
pub use ::better_panic;
|
||||
pub(crate) use better_panic::{Settings, Verbosity};
|
||||
pub use ::better_panic; pub(crate) use better_panic::{Settings, Verbosity};
|
||||
pub use ::palette; pub(crate) use ::palette::{*, convert::*, okhsl::*};
|
||||
|
||||
pub use ::crossterm;
|
||||
pub(crate) use crossterm::{
|
||||
|
|
@ -36,9 +36,25 @@ pub(crate) use ratatui::{
|
|||
buffer::Cell
|
||||
};
|
||||
|
||||
pub use ::palette;
|
||||
pub(crate) use ::palette::{
|
||||
*,
|
||||
convert::*,
|
||||
okhsl::*
|
||||
};
|
||||
|
||||
#[cfg(test)] #[test] fn test_tui_engine () -> Usually<()> {
|
||||
use crate::tui::*;
|
||||
use std::sync::{Arc, RwLock};
|
||||
struct TestComponent(String);
|
||||
impl Content<Tui> for TestComponent {
|
||||
fn content (&self) -> Option<impl Content<Tui>> {
|
||||
Some(self.0.as_str())
|
||||
}
|
||||
}
|
||||
impl Handle<Tui> for TestComponent {
|
||||
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));
|
||||
engine.run(&state)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue