Is there a style for testing purposes?
-
I'd like to force Qt to always use the same font/colors etc. to minimize the risk that pixmap based gui tests breaks. How do I do this?
We have tried QApplication::setStyle("fusion") but this isn't aggressive enough.
Backgroud:
The test suite for our Qt desktop application has plenty of tests that rely on comparasion of pixmaps with reference images. Such tests are known to be brittle. In our case moving to a newer linux version broke all of them. Our tester will adress this by making new screenshots. It would be great if we had a way to lock down the appearance before re-doing the screenshots. -
Hi and welcome to the forums.
Nope. there is no such test style. Also, each platform has its own QStyle as to
get as close as possible to the native look.However, maybe you could use something like
https://doc.qt.io/qt-5/qtwidgets-widgets-styles-example.htmlif the goal is that it should just look the same regardless of platform/os version.
It might also be possible to use a global stylesheet to sort of getting the same look every time.
However, that would not be anything like the normal look. -
Hi
Well HMI testing is always funny.Since stylesheets sort of disables the normal drawing you might get away with a global
a stylesheet that sets the font and colors but Im not sure its enough say between Windows and
macOS.How strict is the image compare ? One pixels wrong and it fails ?