Introduce new iced_selector subcrate and refactor Operation

This commit is contained in:
Héctor Ramón Jiménez 2025-08-23 01:44:17 +02:00
parent 8ca25d627f
commit 63142d34fc
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
29 changed files with 839 additions and 521 deletions

View file

@ -349,7 +349,8 @@ mod toast {
renderer: &Renderer,
operation: &mut dyn Operation,
) {
operation.container(None, layout.bounds(), &mut |operation| {
operation.container(None, layout.bounds());
operation.traverse(&mut |operation| {
self.content.as_widget().operate(
&mut state.children[0],
layout,
@ -580,7 +581,8 @@ mod toast {
renderer: &Renderer,
operation: &mut dyn widget::Operation,
) {
operation.container(None, layout.bounds(), &mut |operation| {
operation.container(None, layout.bounds());
operation.traverse(&mut |operation| {
self.toasts
.iter()
.zip(self.state.iter_mut())

View file

@ -613,8 +613,8 @@ fn presets() -> impl Iterator<Item = iced::application::Preset<Todos, Message>>
mod tests {
use super::*;
use iced::widget;
use iced::{Settings, Theme};
use iced_test::selector::id;
use iced_test::{Error, Simulator};
fn simulator(todos: &Todos) -> Simulator<'_, Message> {
@ -633,7 +633,7 @@ mod tests {
let _command = todos.update(Message::Loaded(Err(LoadError::File)));
let mut ui = simulator(&todos);
let _input = ui.click(id("new-task"))?;
let _input = ui.click(widget::Id::new("new-task"))?;
let _ = ui.typewrite("Create the universe");
let _ = ui.tap_key(keyboard::key::Named::Enter);