Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] Add basic testing infrastructure and documentation #951

Closed
AaronErhardt opened this issue Feb 24, 2022 · 4 comments · Fixed by #952
Closed

[FEATURE REQUEST] Add basic testing infrastructure and documentation #951

AaronErhardt opened this issue Feb 24, 2022 · 4 comments · Fixed by #952
Labels
gtk help wanted Extra attention is needed

Comments

@AaronErhardt
Copy link
Contributor

There should be some testing infrastructure for gtk4-rs apps and internal code that's reusable and documented.

At least something as a convenient entry point for running tests that rely on GTK (something similar to https://github.com/gtk-rs/gtk4-rs/blob/master/gtk4/src/lib.rs#L62).

I've seen gtk-rs/gtk-test#47 and to be honest, I don't have a lot of resources currently, too, but I hope we can at least work together to enable some basic functionality for the upcoming release.

@bilelmoussaoui
Copy link
Member

cc @jf2048 as you wanted the test_synced to be public as well

@bilelmoussaoui
Copy link
Member

I am not sure what would be needed other than making that function available + some examples. I wonder if the gtk_test_init would be any useful for this case?

@bilelmoussaoui bilelmoussaoui added gtk help wanted Extra attention is needed labels Feb 25, 2022
@jf2048
Copy link
Member

jf2048 commented Feb 25, 2022

Yes, it seems like that needs to be public (or it needs to be copied) if someone wants unit tests for any gtk widgets, or for gtk4-macros, libadwaita-rs, libshumate-rs, libpanel-rs, sourceview5-rs, etc. Seeing a gtk4-test would also be good and probably not too hard.

Perhaps it should be made into a macro that calls test_synced internally? That would avoid making it part of the public API:

#[gtk::test]
fn mytest() {
    // ...
}

And would also allow supporting async tests similar to #[tokio::test].

@jf2048
Copy link
Member

jf2048 commented Feb 25, 2022

This issue is still a problem though: #811

Although maybe it's not that bad in practice since the tests all run synchronously anyway?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gtk help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants