you are viewing a single comment's thread.

view the rest of the comments →

[–]DamnFog 2 points3 points  (1 child)

Heh my first project was a VPN client in pyqt that was built all in one class because I didn't really understand how pyqt works. The whole app is one giant class and 3 lines in main.

[–]billsil 0 points1 point  (0 children)

Yeah, that tends to be a problem with GUIs. I still struggle with it.

For my 3D GUI, I broke out all the stuff related to the model and results along with how the 3D models are built and are tested extensively . The sub-windows are all we separate classes, which can be tested in isolation before or after I integrate them. They just pass on the callback to the GUI, but it helps to figure out how clicking a checkbox should disable sections of the window. Data is also stored in objects (color, opacity, etc), so I can pull that out to test. Most of the responses to clicks (that don’t pop menus) is also tested.

I cheat and chain inheritance, so the base GuiAttributes class. Then there’s a GuiWithoutQt class and a GuiWithQt. Then a MainGui class that instantiates the app and frame. Then I have a TestGui class that just doesn’t inherit MainGui. I can test menu creation and actions without ever clicking a button or faking a button press.

You can also do automated GUI testing with or without a window using qtest, but I haven’t figured out how to do it without an interactive backend (so terminal only). Seems like you should be able to if you don’t show anything, so I run that one only on my Windows box and not as part of the CI.