Conversation
Font selection is platform-dependent.
Contributor
|
This is a remarkable milestone for Iced. GG Héctor 🙌 |
|
WDYT about me taking some of the above text (currently doc dcomments in lib.rs) and examples and adding that to the repo as a README.md? Do you see a future in this repo...I wanted to try it for some headless use with existing tests (that open a UI), then move on to proper UI testing... |
|
Also, a publish of current iced_test to crates.io would be nice: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a brand new crate for headless mode testing:
iced_test.This crate features a
Simulatortype that can be used to simulate user interactions and query anyElementproduced byiced.Basic Usage
Let's assume we want to test the classical counter interface.
First, we will want to create a
Simulatorof our interface:Now we can simulate a user interacting with our interface. Let's use
Simulator::clickto click the counter buttons:Simulator::clicktakes aSelector. ASelectordescribes a way to query the widgets of an interface. In this case,selector::textlets us select a widget by the text it contains.We can now process any messages produced by these interactions and then assert that the final value of our counter is indeed
1!We can even rebuild the interface to make sure the counter displays the proper value with
Simulator::find:And that's it! That's the gist of testing
icedapplications!Simulatorcontains additional operations you can use to simulate more interactions—liketap_keyortypewrite—and even perform snapshot testing!