diff options
Diffstat (limited to 'tests/system/shared/welcome.py')
-rw-r--r-- | tests/system/shared/welcome.py | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/tests/system/shared/welcome.py b/tests/system/shared/welcome.py index 8066f27131..a5ba097ff1 100644 --- a/tests/system/shared/welcome.py +++ b/tests/system/shared/welcome.py @@ -4,30 +4,11 @@ def __childrenOfType__(parentObject, typeName): return [child for child in object.children(parentObject) if className(child) == typeName] -def __getWelcomeScreenButtonHelper__(buttonLabel, widgetWithQFrames, isUrlButton = False): - frames = __childrenOfType__(widgetWithQFrames, 'QWidget') - for frame in frames: - childCount = 1 # incorrect but okay for framed sidebar buttons - if isUrlButton: - childCount = len(__childrenOfType__(frame, 'QLabel')) - for occurrence in range(1, childCount + 1): - label = getChildByClass(frame, 'QLabel', occurrence) - if label is None: - continue - if str(label.text) == buttonLabel: - return frame, label - return None, None - -def getWelcomeScreenSideBarButton(buttonLabel, isUrlButton = False): - sideBar = waitForObject("{container={type='Welcome::Internal::SideArea' unnamed='1' " - "window=':Qt Creator_Core::Internal::MainWindow'} type='QWidget' " - "unnamed='1'}") - return __getWelcomeScreenButtonHelper__(buttonLabel, sideBar, isUrlButton) - -def getWelcomeScreenBottomButton(buttonLabel): - bottomArea = waitForObject("{type='Welcome::Internal::BottomArea' unnamed='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}") - return __getWelcomeScreenButtonHelper__(buttonLabel, bottomArea, False) + +def getWelcomeScreenSideBarButton(buttonLabel): + return ("{text='%s' type='QPushButton' unnamed='1' visible='1' " + "window=':Qt Creator_Core::Internal::MainWindow'}" % buttonLabel) + def getWelcomeTreeView(treeViewLabel): try: @@ -37,11 +18,11 @@ def getWelcomeTreeView(treeViewLabel): return None def switchToSubMode(subModeLabel): - wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton(subModeLabel) - frameAndLabelFound = all((wsButtonFrame, wsButtonLabel)) - if frameAndLabelFound: - mouseClick(wsButtonLabel) - return frameAndLabelFound + wsButton = getWelcomeScreenSideBarButton(subModeLabel) + buttonFound = object.exists(wsButton) + if buttonFound: + mouseClick(wsButton) + return buttonFound def findExampleOrTutorial(tableView, regex, verbose=False): filterModel = __childrenOfType__(tableView, 'QSortFilterProxyModel') |