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

@ -1,9 +1,10 @@
use crate::core::mouse;
use crate::core::theme;
use crate::core::time::Instant;
use crate::core::window::Id;
use crate::core::{Point, Size};
use crate::graphics::Compositor;
use crate::program::{DefaultStyle, Program, State};
use crate::program::{Program, State};
use std::collections::BTreeMap;
use std::sync::Arc;
@ -14,7 +15,7 @@ pub struct WindowManager<P, C>
where
P: Program,
C: Compositor<Renderer = P::Renderer>,
P::Theme: DefaultStyle,
P::Theme: theme::Base,
{
aliases: BTreeMap<winit::window::WindowId, Id>,
entries: BTreeMap<Id, Window<P, C>>,
@ -24,7 +25,7 @@ impl<P, C> WindowManager<P, C>
where
P: Program,
C: Compositor<Renderer = P::Renderer>,
P::Theme: DefaultStyle,
P::Theme: theme::Base,
{
pub fn new() -> Self {
Self {
@ -132,7 +133,7 @@ impl<P, C> Default for WindowManager<P, C>
where
P: Program,
C: Compositor<Renderer = P::Renderer>,
P::Theme: DefaultStyle,
P::Theme: theme::Base,
{
fn default() -> Self {
Self::new()
@ -144,7 +145,7 @@ pub struct Window<P, C>
where
P: Program,
C: Compositor<Renderer = P::Renderer>,
P::Theme: DefaultStyle,
P::Theme: theme::Base,
{
pub raw: Arc<winit::window::Window>,
pub state: State<P>,
@ -160,7 +161,7 @@ impl<P, C> Window<P, C>
where
P: Program,
C: Compositor<Renderer = P::Renderer>,
P::Theme: DefaultStyle,
P::Theme: theme::Base,
{
pub fn position(&self) -> Option<Point> {
self.raw