Skip to content

autoclose feature for tests? #37

@Andi-K

Description

@Andi-K

I think we need to implement inside show_gui() something like
I'll implement this:

if env::var("KISSUI_AUTOCLOSE") {
   init_fn().add_child(
       Timer::new()
       .set_interval(10000)
       .set_on_interval(|_ : Timer|{CallbackStatus::Close})
       .start())
} 

The PR is coming soon, just need to impl add_child().

@cybergeek94

If you have any ideas for some unit tests that we can add without needing a GUI to actually launch (since Travis-CI workers are headless), let me know. I'd like to be able to catch as many logic errors as we can with cargo test.

I didn't really dealt with cargo test and Travis-CI yet.
Testing a GUI without using it sounds hard to do.
But i see Travis-CI can run Firefox and may IUP/GTK too.
Then we can use kiss_ui::timer::Timer to autoclose the GUI and test everything we want.
Or do i miss something?

Furthermore we can use ImageMagick and write a script for a advanced test:

  • set the environment variable KISSUI_AUTOCLOSE
  • loop through the examples
    • cargo run --example x
    • make a screenshot import -window
    • compare it with the screenshot on github
    • report if the screenshots aren't equal or cargo's exits status is not 0

If we can't run this script on Travis-CI we just keep in mind that different environments produce different screenshots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions