Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is there a style for testing purposes?
Qt 6.11 is out! See what's new in the release blog

Is there a style for testing purposes?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 419 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fbulow
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.html

      if 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.

      1 Reply Last reply
      1
      • F Offline
        F Offline
        fbulow
        wrote on last edited by
        #3

        @mrjj Thanks for this very creative answer!

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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 ?

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved