use std::borrow::Cow;
use std::time::Duration;
use telar::{DevAction, DevPlugin, DrawCommand, Key, ModifiersState, SegmentNodeInfo};
#[derive(Default)]
struct Ruler {
frames: usize,
}
impl DevPlugin for Ruler {
fn on_frame<'a>(
&mut self,
base: &'a [DrawCommand],
_window_w: f32,
_window_h: f32,
_tree_dirty: bool,
) -> Cow<'a, [DrawCommand]> {
self.frames += 1;
Cow::Borrowed(base)
}
fn keepalive_interval(&self) -> Option<Duration> {
None
}
fn on_key(&mut self, _key: &Key, _modifiers: ModifiersState) -> DevAction {
DevAction::None
}
fn on_pointer_pressed(&mut self, _x: f32, _y: f32) -> bool {
false
}
fn on_tree(&mut self, _nodes: &[SegmentNodeInfo]) {}
}
struct Blank;
impl telar::App for Blank {
fn root(&self) -> Box<dyn telar::Component> {
unreachable!("this test never runs the app, it only type-checks the door")
}
}
#[test]
fn an_overlay_of_your_own_installs_through_the_facade_alone() {
#[allow(dead_code)]
fn _install() {
telar::run_app_with_devtools::<Blank, Ruler>(
telar::AppConfig::default(),
Blank,
"door-test",
);
}
}