aboutsummaryrefslogtreecommitdiffstats
path: root/tests/system/suite_WELP
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2017-02-07 09:08:11 +0100
committerChristian Stenger <christian.stenger@qt.io>2017-02-13 11:58:30 +0000
commit9f6f5bfee2ec0476454540c440b9687d14ea7c3f (patch)
tree88b73d63d120a07192cd0c241af43bfd54f41fbb /tests/system/suite_WELP
parentc0f2bc254e5111db8aeca4c8fbc5780df1af26c2 (diff)
Squish: Adapt tst_WELP02 to latest Welcome page changes
Additionally move common used code for interacting with the Welcome page into separate file. Change-Id: If863ae529c7c81d095f310f0a34926b324c77fa8 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Diffstat (limited to 'tests/system/suite_WELP')
-rwxr-xr-xtests/system/suite_WELP/tst_WELP01/test.py21
-rw-r--r--tests/system/suite_WELP/tst_WELP02/test.py72
2 files changed, 50 insertions, 43 deletions
diff --git a/tests/system/suite_WELP/tst_WELP01/test.py b/tests/system/suite_WELP/tst_WELP01/test.py
index 3165aa0c8f..ffc16e087d 100755
--- a/tests/system/suite_WELP/tst_WELP01/test.py
+++ b/tests/system/suite_WELP/tst_WELP01/test.py
@@ -57,27 +57,6 @@ def waitForButtonsState(projectsActive, examplesActive, tutorialsActive, timeout
'and buttonActive(exmpButton) == examplesActive '
'and buttonActive(tutoButton) == tutorialsActive', timeout)
-def __getWelcomeScreenButtonHelper__(buttonLabel, widgetWithQFrames):
- frames = [child for child in object.children(widgetWithQFrames) if className(child) == 'QFrame']
- for frame in frames:
- label = getChildByClass(frame, 'QLabel')
- if str(label.text) == buttonLabel:
- return frame, label
- return None, None
-
-def getWelcomeScreenSideBarButton(buttonLabel):
- sideBar = waitForObject("{type='Welcome::Internal::SideBar' unnamed='1' "
- "window=':Qt Creator_Core::Internal::MainWindow'}")
- return __getWelcomeScreenButtonHelper__(buttonLabel, sideBar)
-
-def getWelcomeScreenMainButton(buttonLabel):
- stackedWidget = waitForObject("{type='QWidget' unnamed='1' visible='1' "
- "leftWidget={type='QWidget' unnamed='1' visible='1' "
- "leftWidget={type='Welcome::Internal::SideBar' unnamed='1' "
- "window=':Qt Creator_Core::Internal::MainWindow'}}}")
- currentStackWidget = stackedWidget.currentWidget()
- return __getWelcomeScreenButtonHelper__(buttonLabel, currentStackWidget)
-
def checkTableViewForContent(tableViewStr, expectedRegExTitle, section, atLeastOneText):
try:
tableView = findObject(tableViewStr) # waitForObject does not work - visible is 0?
diff --git a/tests/system/suite_WELP/tst_WELP02/test.py b/tests/system/suite_WELP/tst_WELP02/test.py
index 47baca1639..ae7b22e934 100644
--- a/tests/system/suite_WELP/tst_WELP02/test.py
+++ b/tests/system/suite_WELP/tst_WELP02/test.py
@@ -24,14 +24,44 @@
############################################################################
source("../../shared/qtcreator.py")
-source("../../shared/suites_qtta.py")
-
-welcomePage = ":Qt Creator.WelcomePage_QQuickWidget"
def checkTypeAndProperties(typePropertiesDetails):
for (qType, props, detail) in typePropertiesDetails:
- test.verify(checkIfObjectExists(getQmlItem(qType, welcomePage, False, props)),
- "Verifying: Qt Creator displays %s." % detail)
+ if qType == "QPushButton":
+ wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton(props)
+ test.verify(all((wsButtonFrame, wsButtonLabel)),
+ "Verifying: Qt Creator displays Welcome Page with %s." % detail)
+ elif qType == 'QTreeView':
+ treeView = getWelcomeTreeView(props)
+ test.verify(treeView is not None,
+ "Verifying: Qt Creator displays Welcome Page with %s." % detail)
+ elif qType == 'SessionModelIndex':
+ # for SessionModelIndex props must be a tuple with 2 elements, the first is just
+ # as for others (additional properties) while the second is either True or False and
+ # indicating whether to check the found index for being the default and current session
+ treeView = getWelcomeTreeView("Sessions")
+ if not treeView:
+ test.fatal("Failed to find Sessions tree view, cannot check for %s." % detail)
+ continue
+ indices = dumpIndices(treeView.model())
+ found = False
+ for index in indices:
+ if props[0] == str(index.data()):
+ # 257 -> DefaultSessionRole, 259 -> ActiveSessionRole [sessionmodel.h]
+ isDefaultAndCurrent = index.data(257).toBool() and index.data(259).toBool()
+ if not props[1] or isDefaultAndCurrent:
+ found = True
+ break
+ test.verify(found, "Verifying: Qt Creator displays Welcome Page with %s." % detail)
+ elif qType == 'ProjectModelIndex':
+ treeView = getWelcomeTreeView("Recent Projects")
+ if not treeView:
+ test.fatal("Failed to find Projects tree view, cannot check for %s." % detail)
+ continue
+ test.verify(props in dumpItems(treeView.model()),
+ "Verifying: Qt Creator displays Welcome Page with %s." % detail)
+ else:
+ test.fatal("Unhandled qType '%s' found..." % qType)
def main():
# prepare example project
@@ -44,11 +74,10 @@ def main():
if not startedWithoutPluginError():
return
- typePropDet = (("Button", "text='Get Started Now' id='gettingStartedButton'",
- "Get Started Now button"),
- ("Text", "text='Sessions' id='sessionsTitle'", "Sessions section"),
- ("Text", "text='default'", "default session listed"),
- ("Text", "text='Recent Projects' id='recentProjectsTitle'", "Projects section"),
+ typePropDet = (("QPushButton", "Get Started Now", "Get Started Now button"),
+ ("QTreeView", "Sessions", "Sessions section"),
+ ("SessionModelIndex", ("default", False), "default session listed"),
+ ("QTreeView", "Recent Projects", "Projects section")
)
checkTypeAndProperties(typePropDet)
@@ -59,12 +88,10 @@ def main():
"Verifying: The project is opened in 'Edit' mode after configuring.")
# go to "Welcome page" again and verify updated information
switchViewTo(ViewConstants.WELCOME)
- typePropDet = (("Text", "text='Sessions' id='sessionsTitle'", "Sessions section"),
- ("Text", "text='default (current session)'",
- "default session as current listed"),
- ("Text", "text='Recent Projects' id='recentProjectsTitle'", "Projects section"),
- ("Text", "text='SampleApp'",
- "current project listed in projects section")
+ typePropDet = (("QTreeView", "Sessions", "Sessions section"),
+ ("SessionModelIndex", ("default", True), "default session as current listed"),
+ ("QTreeView", "Recent Projects", "Projects section"),
+ ("ProjectModelIndex", "SampleApp", "current project listed in projects section")
)
checkTypeAndProperties(typePropDet)
@@ -77,11 +104,12 @@ def main():
"Verifying: The project is opened in 'Edit' mode after configuring.")
# go to "Welcome page" again and check if there is an information about recent projects
switchViewTo(ViewConstants.WELCOME)
- test.verify(checkIfObjectExists(getQmlItem("Text", welcomePage, False,
- "text='animation'")) and
- checkIfObjectExists(getQmlItem("Text", welcomePage, False,
- "text='SampleApp'")),
- "Verifying: 'Welcome page' displays information about recently created and "
- "opened projects.")
+ treeView = getWelcomeTreeView('Recent Projects')
+ if treeView is None:
+ test.fatal("Cannot verify Recent Projects on Welcome Page - failed to find tree view.")
+ else:
+ typePropDet = (("ProjectModelIndex", "animation", "one project"),
+ ("ProjectModelIndex", "SampleApp", "other project"))
+ checkTypeAndProperties(typePropDet)
# exit Qt Creator
invokeMenuItem("File", "Exit")