Add image and hash snapshot-based testing to iced_test

This commit is contained in:
Héctor Ramón Jiménez 2024-12-06 04:06:41 +01:00
parent 8e3636d769
commit 1aeb317f2d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
17 changed files with 280 additions and 105 deletions

View file

@ -31,6 +31,7 @@
//! }
//! ```
use crate::program::{self, Program};
use crate::theme;
use crate::window;
use crate::{
Element, Executor, Font, Result, Settings, Size, Subscription, Task,
@ -38,8 +39,6 @@ use crate::{
use std::borrow::Cow;
pub use crate::shell::program::{Appearance, DefaultStyle};
/// Creates an iced [`Application`] given its title, update, and view logic.
///
/// # Example
@ -76,7 +75,7 @@ pub fn application<State, Message, Theme, Renderer>(
where
State: 'static,
Message: Send + std::fmt::Debug + 'static,
Theme: Default + DefaultStyle,
Theme: Default + theme::Base,
Renderer: program::Renderer,
{
use std::marker::PhantomData;
@ -94,7 +93,7 @@ where
for Instance<State, Message, Theme, Renderer, Update, View>
where
Message: Send + std::fmt::Debug + 'static,
Theme: Default + DefaultStyle,
Theme: Default + theme::Base,
Renderer: program::Renderer,
Update: self::Update<State, Message>,
View: for<'a> self::View<'a, State, Message, Theme, Renderer>,
@ -352,7 +351,7 @@ impl<P: Program> Application<P> {
/// Sets the style logic of the [`Application`].
pub fn style(
self,
f: impl Fn(&P::State, &P::Theme) -> Appearance,
f: impl Fn(&P::State, &P::Theme) -> theme::Style,
) -> Application<
impl Program<State = P::State, Message = P::Message, Theme = P::Theme>,
> {