forked from qt-creator/qt-creator
Squish: Adapt tst_WELP03 to latest Welcome page changes
Change-Id: Ia62813cf94b31a82fedb191eaf11f752d1d30bf0 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
@@ -40,6 +40,33 @@ def handlePackagingMessageBoxes():
|
|||||||
except:
|
except:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def findExample(tableView, exampleRegex, verbose=False):
|
||||||
|
model = tableView.model()
|
||||||
|
children = [ch for ch in object.children(tableView) if className(ch) == 'QModelIndex']
|
||||||
|
for child in children:
|
||||||
|
if re.match(exampleRegex, str(child.text)):
|
||||||
|
if verbose:
|
||||||
|
test.log("Returning matching example '%s'." % str(child.text), exampleRegex)
|
||||||
|
return child
|
||||||
|
return None
|
||||||
|
|
||||||
|
def openExample(examplesLineEdit, input, exampleRegex, exampleName):
|
||||||
|
replaceEditorContent(examplesLineEdit, input)
|
||||||
|
tableView = waitForObject("{type='QTableView' unnamed='1' visible='1' "
|
||||||
|
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||||
|
waitFor('findExample(tableView, exampleRegex) is not None', 3000)
|
||||||
|
example = findExample(tableView, exampleRegex, True)
|
||||||
|
if test.verify(example is not None, "Verifying: Example (%s) is shown." % exampleName):
|
||||||
|
mouseClick(example)
|
||||||
|
handlePackagingMessageBoxes()
|
||||||
|
helpWidget = waitForObject(":Help Widget_Help::Internal::HelpWidget")
|
||||||
|
test.verify(waitFor('exampleName in str(helpWidget.windowTitle)', 5000),
|
||||||
|
"Verifying: The example application is opened inside Help.")
|
||||||
|
sendEvent("QCloseEvent", helpWidget)
|
||||||
|
# assume the correct kit is selected, hit Configure Project
|
||||||
|
clickButton(waitForObject(":Qt Creator.Configure Project_QPushButton"))
|
||||||
|
return example
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
welcomePage = ":Qt Creator.WelcomePage_QQuickWidget"
|
welcomePage = ":Qt Creator.WelcomePage_QQuickWidget"
|
||||||
# open Qt Creator
|
# open Qt Creator
|
||||||
@@ -51,46 +78,42 @@ def main():
|
|||||||
qchs.extend([os.path.join(p, "qtopengl.qch"), os.path.join(p, "qtwidgets.qch")])
|
qchs.extend([os.path.join(p, "qtopengl.qch"), os.path.join(p, "qtwidgets.qch")])
|
||||||
addHelpDocumentation(qchs)
|
addHelpDocumentation(qchs)
|
||||||
setAlwaysStartFullHelp()
|
setAlwaysStartFullHelp()
|
||||||
getStartedNow = getQmlItem("Button", welcomePage, False,
|
wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton('Get Started Now')
|
||||||
"text='Get Started Now' id='gettingStartedButton'")
|
if not test.verify(all((wsButtonFrame, wsButtonLabel)),
|
||||||
if not test.verify(checkIfObjectExists(getStartedNow),
|
|
||||||
"Verifying: Qt Creator displays Welcome Page with Getting Started."):
|
"Verifying: Qt Creator displays Welcome Page with Getting Started."):
|
||||||
test.fatal("Something's wrong - leaving test.")
|
test.fatal("Something's wrong - leaving test.")
|
||||||
invokeMenuItem("File", "Exit")
|
invokeMenuItem("File", "Exit")
|
||||||
return
|
return
|
||||||
# select "Examples" topic
|
# select "Examples" topic
|
||||||
mouseClick(waitForObject(getQmlItem("Button", welcomePage, False, "text='Examples'")),
|
wsButtonFrame, wsButtonLabel = getWelcomeScreenSideBarButton('Examples')
|
||||||
5, 5, 0, Qt.LeftButton)
|
if all((wsButtonFrame, wsButtonLabel)):
|
||||||
test.verify(checkIfObjectExists(getQmlItem("Text", welcomePage, False, "text='Examples'")),
|
mouseClick(wsButtonLabel)
|
||||||
|
expect = (("QTableView", "unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'",
|
||||||
|
"examples list"),
|
||||||
|
("QLineEdit", "placeholderText='Search in Examples...'", "examples search line edit"),
|
||||||
|
("QComboBox", "text~='.*Qt.*' visible='1'", "Qt version combo box"))
|
||||||
|
search = "{type='%s' %s}"
|
||||||
|
test.verify(all(map(checkIfObjectExists, (search % (exp[0], exp[1]) for exp in expect))),
|
||||||
"Verifying: 'Examples' topic is opened and the examples are shown.")
|
"Verifying: 'Examples' topic is opened and the examples are shown.")
|
||||||
|
|
||||||
|
examplesLineEdit = waitForObject(search % (expect[1][0], expect[1][1]))
|
||||||
|
mouseClick(examplesLineEdit)
|
||||||
|
combo = waitForObject(search % (expect[2][0], expect[2][1]))
|
||||||
|
test.log("Using examples from Kit %s." % str(combo.currentText))
|
||||||
|
replaceEditorContent(examplesLineEdit, "qwerty")
|
||||||
|
tableView = waitForObject(search % (expect[0][0], expect[0][1]))
|
||||||
|
waitFor('findExample(tableView, ".*") is None', 3000)
|
||||||
|
example = findExample(tableView, ".*", True)
|
||||||
|
test.verify(example is None, "Verifying: No example is shown.")
|
||||||
|
|
||||||
proFiles = map(lambda p: os.path.join(p, "opengl", "2dpainting", "2dpainting.pro"),
|
proFiles = map(lambda p: os.path.join(p, "opengl", "2dpainting", "2dpainting.pro"),
|
||||||
Qt5Path.getPaths(Qt5Path.EXAMPLES))
|
Qt5Path.getPaths(Qt5Path.EXAMPLES))
|
||||||
cleanUpUserFiles(proFiles)
|
cleanUpUserFiles(proFiles)
|
||||||
for p in proFiles:
|
for p in proFiles:
|
||||||
removePackagingDirectory(os.path.dirname(p))
|
removePackagingDirectory(os.path.dirname(p))
|
||||||
examplesLineEdit = getQmlItem("TextField", welcomePage,
|
|
||||||
False, "id='lineEdit' placeholderText='Search in Examples...'")
|
example = openExample(examplesLineEdit, "2d painting", "2D Painting.*", "2D Painting Example")
|
||||||
mouseClick(waitForObject(examplesLineEdit), 5, 5, 0, Qt.LeftButton)
|
if example is not None:
|
||||||
test.log("Using examples from Kit %s."
|
|
||||||
% (waitForObject(getQmlItem("ComboBox", welcomePage,
|
|
||||||
False, "id='comboBox'")).currentText))
|
|
||||||
replaceEditorContent(waitForObject(examplesLineEdit), "qwerty")
|
|
||||||
test.verify(checkIfObjectExists(getQmlItem("Delegate", welcomePage,
|
|
||||||
False, "id='delegate' radius='0' caption~='.*'"),
|
|
||||||
False), "Verifying: No example is shown.")
|
|
||||||
replaceEditorContent(waitForObject(examplesLineEdit), "2d painting")
|
|
||||||
twoDPainting = getQmlItem("Delegate", welcomePage,
|
|
||||||
False, "id='delegate' radius='0' caption~='2D Painting.*'")
|
|
||||||
test.verify(checkIfObjectExists(twoDPainting),
|
|
||||||
"Verifying: Example (2D Painting) is shown.")
|
|
||||||
mouseClick(waitForObject(twoDPainting), 5, 5, 0, Qt.LeftButton)
|
|
||||||
handlePackagingMessageBoxes()
|
|
||||||
helpWidget = waitForObject(":Help Widget_Help::Internal::HelpWidget")
|
|
||||||
test.verify(waitFor('"2D Painting Example" in str(helpWidget.windowTitle)', 5000),
|
|
||||||
"Verifying: The example application is opened inside Help.")
|
|
||||||
sendEvent("QCloseEvent", helpWidget)
|
|
||||||
# assume the correct kit is selected, hit Configure Project
|
|
||||||
clickButton(waitForObject(":Qt Creator.Configure Project_QPushButton"))
|
|
||||||
test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
|
test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
|
||||||
" text='2dpainting' type='QModelIndex'}"),
|
" text='2dpainting' type='QModelIndex'}"),
|
||||||
"Verifying: The project is shown in 'Edit' mode.")
|
"Verifying: The project is shown in 'Edit' mode.")
|
||||||
@@ -110,20 +133,10 @@ def main():
|
|||||||
cleanUpUserFiles(proFiles)
|
cleanUpUserFiles(proFiles)
|
||||||
for p in proFiles:
|
for p in proFiles:
|
||||||
removePackagingDirectory(os.path.dirname(p))
|
removePackagingDirectory(os.path.dirname(p))
|
||||||
examplesLineEditWidget = waitForObject(examplesLineEdit)
|
examplesLineEdit = waitForObject(search %(expect[1][0], expect[1][1]))
|
||||||
mouseClick(examplesLineEditWidget)
|
example = openExample(examplesLineEdit, "address book", "Address Book.*",
|
||||||
replaceEditorContent(examplesLineEditWidget, "address book")
|
"Address Book Example")
|
||||||
addressBook = getQmlItem("Delegate", welcomePage,
|
if example is not None:
|
||||||
False, "id='delegate' radius='0' caption~='Address Book.*'")
|
|
||||||
test.verify(checkIfObjectExists(addressBook), "Verifying: Example (address book) is shown.")
|
|
||||||
mouseClick(waitForObject(addressBook), 5, 5, 0, Qt.LeftButton)
|
|
||||||
handlePackagingMessageBoxes()
|
|
||||||
helpWidget = waitForObject(":Help Widget_Help::Internal::HelpWidget")
|
|
||||||
test.verify(waitFor('"Address Book Example" in str(helpWidget.windowTitle)', 5000),
|
|
||||||
"Verifying: The example application is opened inside Help.")
|
|
||||||
sendEvent("QCloseEvent", helpWidget)
|
|
||||||
# assume the correct kit is selected, hit Configure Project
|
|
||||||
clickButton(waitForObject(":Qt Creator.Configure Project_QPushButton"))
|
|
||||||
# close second example application
|
# close second example application
|
||||||
test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
|
test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
|
||||||
" text='propertyanimation' type='QModelIndex'}", False) and
|
" text='propertyanimation' type='QModelIndex'}", False) and
|
||||||
|
Reference in New Issue
Block a user