diff --git a/tester/src/lib.rs b/tester/src/lib.rs index 6b3ed9ff..16e661dd 100644 --- a/tester/src/lib.rs +++ b/tester/src/lib.rs @@ -16,6 +16,7 @@ use crate::core::Length::Fill; use crate::core::alignment::Horizontal::Right; use crate::core::border; use crate::core::mouse; +use crate::core::theme; use crate::core::window; use crate::core::{Color, Element, Font, Settings, Size, Theme}; use crate::futures::futures::channel::mpsc; @@ -95,6 +96,14 @@ where ) -> Element<'a, Self::Message, Self::Theme, Self::Renderer> { state.view(&self.program, window).map(Message) } + + fn theme(&self, state: &Self::State, window: window::Id) -> Option { + state + .theme(&self.program, window) + .as_ref() + .and_then(theme::Base::palette) + .map(|palette| Theme::custom("Tester", palette)) + } } /// A tester decorates a [`Program`] definition and attaches a test recorder on top. @@ -399,6 +408,19 @@ impl Tester

{ self.edit = None; } + fn theme(&self, program: &P, window: window::Id) -> Option { + match &self.state { + State::Empty => None, + State::Idle { state } => program.theme(state, window), + State::Recording { emulator } | State::Playing { emulator, .. } => { + emulator.theme(program) + } + State::Asserting { state, window, .. } => { + program.theme(state, *window) + } + } + } + fn preset<'a>( &self, program: &'a P,