Testing backend #2297
-
Hi all, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
To clarify - are we asking about functionality you would use in a test harness, or functionality to generally evaluate the state of some window/widget property? If it's the former: you're looking for the Dummy backend. It's a fully compliant Toga backend, but without any actual GUI elements - but it does have tooling to log and test what the GUI has done. It allows you to test functionality independent of an actual GUI, and it's a lot easier to run in a test harness, because you don't need any GUI to be present. Toga's core uses the dummy backend to verify that the API works as expected. It's not very well documented at present, but the functionality exists. However, if you're looking for a way to evaluate widget properties at runtime - it depends on what you're looking to check. Visibility of widgets is managed by the style; so if the style has visibility=hidden (ie mywidget.style.visibility == "hidden") then the widget won't be visible. Non-style widget properties (eg enabled) and window properties will be exposed as properties on the actual widget/window. |
Beta Was this translation helpful? Give feedback.
We can only test the features that the underlying toolkit allows us to test. If GTK doesn't provide a way to evaluate if the dialog has been displayed, then there's not much we can do. As long as we can retain code coverage, exercising all possible code paths, that's sufficient. We definitely don't want to get into the game of re-implementing core GTK features - at some level, we have to be able to assume that that "gtk_show_dialog()" will, in fact, show a dialog :-)
That said - one thing that might be worth investigating is whether you can get an indirect signal from the window. The dialog is attached to the window, which suggests there might be some property on the window that has one m…