Decouple iced_test from iced crate
This commit is contained in:
parent
1aeb317f2d
commit
1713ac49f2
3 changed files with 11 additions and 14 deletions
|
|
@ -72,7 +72,6 @@ unconditional-rendering = ["iced_winit/unconditional-rendering"]
|
||||||
iced_core.workspace = true
|
iced_core.workspace = true
|
||||||
iced_futures.workspace = true
|
iced_futures.workspace = true
|
||||||
iced_renderer.workspace = true
|
iced_renderer.workspace = true
|
||||||
iced_test.workspace = true
|
|
||||||
iced_widget.workspace = true
|
iced_widget.workspace = true
|
||||||
iced_winit.features = ["program"]
|
iced_winit.features = ["program"]
|
||||||
iced_winit.workspace = true
|
iced_winit.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -590,30 +590,29 @@ impl SavedState {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use iced::test;
|
use iced_test::{interface, load_font, selector, Error};
|
||||||
use iced::test::selector;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn it_creates_a_new_task() -> Result<(), test::Error> {
|
fn it_creates_a_new_task() -> Result<(), Error> {
|
||||||
test::load_font(Todos::ICON_FONT)?;
|
load_font(Todos::ICON_FONT)?;
|
||||||
|
|
||||||
let (mut todos, _command) = Todos::new();
|
let (mut todos, _command) = Todos::new();
|
||||||
let _command = todos.update(Message::Loaded(Err(LoadError::File)));
|
let _command = todos.update(Message::Loaded(Err(LoadError::File)));
|
||||||
|
|
||||||
let mut interface = test::interface(todos.view());
|
let mut ui = interface(todos.view());
|
||||||
let _input = interface.click("new-task")?;
|
let _input = ui.click("new-task")?;
|
||||||
|
|
||||||
interface.typewrite("Create the universe");
|
ui.typewrite("Create the universe");
|
||||||
interface.press_key(keyboard::key::Named::Enter);
|
ui.press_key(keyboard::key::Named::Enter);
|
||||||
|
|
||||||
for message in interface.into_messages() {
|
for message in ui.into_messages() {
|
||||||
let _command = todos.update(message);
|
let _command = todos.update(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut interface = test::interface(todos.view());
|
let mut ui = interface(todos.view());
|
||||||
let _ = interface.find(selector::text("Create the universe"))?;
|
let _ = ui.find(selector::text("Create the universe"))?;
|
||||||
|
|
||||||
let snapshot = interface.snapshot()?;
|
let snapshot = ui.snapshot()?;
|
||||||
assert!(
|
assert!(
|
||||||
snapshot.matches_hash("snapshots/creates_a_new_task")?,
|
snapshot.matches_hash("snapshots/creates_a_new_task")?,
|
||||||
"snapshots should match!"
|
"snapshots should match!"
|
||||||
|
|
|
||||||
|
|
@ -479,7 +479,6 @@ use iced_winit::runtime;
|
||||||
|
|
||||||
pub use iced_futures::futures;
|
pub use iced_futures::futures;
|
||||||
pub use iced_futures::stream;
|
pub use iced_futures::stream;
|
||||||
pub use iced_test as test;
|
|
||||||
|
|
||||||
#[cfg(feature = "highlighter")]
|
#[cfg(feature = "highlighter")]
|
||||||
pub use iced_highlighter as highlighter;
|
pub use iced_highlighter as highlighter;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue