Add screenshot helpers to iced_test

This commit is contained in:
Héctor Ramón Jiménez 2025-11-12 00:53:10 +01:00
parent ea614387f4
commit 085c8fae8d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
10 changed files with 183 additions and 78 deletions

View file

@ -59,7 +59,7 @@ impl Example {
image::Handle::from_rgba(
screenshot.size.width,
screenshot.size.height,
screenshot.bytes,
screenshot.rgba,
),
));
}
@ -105,7 +105,7 @@ impl Example {
image::Handle::from_rgba(
screenshot.size.width,
screenshot.size.height,
screenshot.bytes,
screenshot.rgba,
),
));
self.crop_error = None;
@ -243,7 +243,7 @@ async fn save_to_png(screenshot: Screenshot) -> Result<String, PngError> {
tokio::task::spawn_blocking(move || {
img::save_buffer(
&path,
&screenshot.bytes,
&screenshot.rgba,
screenshot.size.width,
screenshot.size.height,
ColorType::Rgba8,

View file

@ -20,7 +20,8 @@ pub fn main() -> iced::Result {
application().run()
}
fn application() -> Application<impl Program<Message = Message>> {
fn application() -> Application<impl Program<Message = Message, Theme = Theme>>
{
iced::application(Todos::new, Todos::update, Todos::view)
.subscription(Todos::subscription)
.title(Todos::title)