Skip to content

Commit

Permalink
Switch Rust Todo app unit testing to use the new API to lcoate the li…
Browse files Browse the repository at this point in the history
…ne edit.
tronical committed Jul 15, 2024
1 parent 1c2a8f2 commit c90abe0
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions examples/todo/rust/lib.rs
Original file line number Diff line number Diff line change
@@ -174,14 +174,11 @@ fn press_add_adds_one_todo() {
use i_slint_backend_testing::ElementHandle;
let state = init();
state.todo_model.set_vec(vec![TodoItem { checked: false, title: "first".into() }]);
let line_edit = ElementHandle::visit_elements(&state.main_window, |element| {
if element.accessible_placeholder_text().as_deref() == Some("What needs to be done?") {
std::ops::ControlFlow::Break(element)
} else {
std::ops::ControlFlow::Continue(())
}
})
.unwrap();
let line_edit = i_slint_backend_testing::ElementRoot::root_element(&state.main_window)
.match_descendants()
.match_id("MainWindow::text-edit")
.find_first()
.unwrap();
assert_eq!(line_edit.accessible_value().unwrap(), "");
line_edit.set_accessible_value("second");

0 comments on commit c90abe0

Please sign in to comment.