SquishTests: Adapt to dark theme

Depending on the OS QC may be started with dark theming.
As we use the color of the buttons on the welcome page to
decide whether a button is active or not we need to adapt
the expected colors to cover dark theming as well.

Change-Id: I844b1e2cf4b44ce9501a4ef4a850331ca9983e3c
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
This commit is contained in:
Christian Stenger
2023-03-23 15:12:08 +01:00
parent ac4aaf5e23
commit 73227535a4

View File

@@ -19,11 +19,14 @@ def clickItemVerifyHelpCombo(button, expectedHelpComboRegex, testDetails):
"Verifying: '%s' button is being displayed." % getStarted) "Verifying: '%s' button is being displayed." % getStarted)
def buttonActive(button): def buttonActive(button):
# colors of the default theme for active button on Welcome page # colors of the default theme for active button on Welcome page
(activeRed, activeGreen, activeBlue) = (69, 206, 85) defaultActiveRGB = (69, 206, 85)
# colors of the dark theme for active button on Welcome page
darkActiveRGB = (54, 193, 72)
# QPalette::Window (used background color of Welcome page buttons) # QPalette::Window (used background color of Welcome page buttons)
enumQPaletteWindow = 10 enumQPaletteWindow = 10
color = button.palette.color(enumQPaletteWindow) color = button.palette.color(enumQPaletteWindow)
return color.red == activeRed and color.green == activeGreen and color.blue == activeBlue current = (color.red, color.green, color.blue)
return current == defaultActiveRGB or current == darkActiveRGB
def waitForButtonsState(projectsActive, examplesActive, tutorialsActive, timeout=5000): def waitForButtonsState(projectsActive, examplesActive, tutorialsActive, timeout=5000):
projButton = getWelcomeScreenSideBarButton('Projects')[0] projButton = getWelcomeScreenSideBarButton('Projects')[0]