Introduce tester feature flag
This commit is contained in:
parent
ed528c9c53
commit
1821dc7ff0
13 changed files with 488 additions and 640 deletions
51
devtools/src/tester/null.rs
Normal file
51
devtools/src/tester/null.rs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
use crate::Program;
|
||||
use crate::core::window;
|
||||
use crate::core::{Element, Theme};
|
||||
use crate::runtime::Task;
|
||||
use crate::widget::horizontal_space;
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub struct Tester<P: Program> {
|
||||
_type: PhantomData<P::Message>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Message {}
|
||||
|
||||
#[allow(missing_debug_implementations)]
|
||||
pub struct Tick<P: Program> {
|
||||
_type: PhantomData<P::Message>,
|
||||
}
|
||||
|
||||
impl<P: Program> Tester<P> {
|
||||
pub fn new() -> Self {
|
||||
Self { _type: PhantomData }
|
||||
}
|
||||
|
||||
pub fn is_busy(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn update(&mut self, _program: &P, _message: Message) -> Task<Tick<P>> {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
pub fn tick(&mut self, _program: &P, _tick: Tick<P>) -> Task<Tick<P>> {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
pub fn view<'a, T: 'static>(
|
||||
&'a self,
|
||||
_program: &P,
|
||||
_window: window::Id,
|
||||
_current: impl FnOnce() -> Element<'a, T, Theme, P::Renderer>,
|
||||
_emulate: impl Fn(Tick<P>) -> T + 'a,
|
||||
) -> Element<'a, T, Theme, P::Renderer> {
|
||||
horizontal_space().into()
|
||||
}
|
||||
|
||||
pub fn controls(&self) -> Element<'_, Message, Theme, P::Renderer> {
|
||||
horizontal_space().into()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue