Commit 93fb2928 authored by Christian Stenger's avatar Christian Stenger
Browse files

Squish: Added new test cases/suite for welcome page



Change-Id: Id01582e881b8150a76336bb4f3ea6511c4bcd249
Done-with: Jan Kerekes
Done-with: Pavol Grainda
Reviewed-by: default avatarRobert Loehning <robert.loehning@digia.com>
parent 8b9cc83b
......@@ -7,6 +7,7 @@
:*Qt Creator.Start Debugging_Core::Internal::FancyToolButton {text='Start Debugging' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator.findEdit_Utils::FilterLineEdit {name='findEdit' type='Utils::FilterLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator_Core::Internal::FancyToolButton {occurrence='3' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator_Help::Internal::HelpViewer {type='Help::Internal::HelpViewer' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator_Utils::FilterLineEdit {type='Utils::FilterLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:*Qt Creator_Utils::IconButton {occurrence='4' type='Utils::IconButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:About Qt Creator_Core::Internal::VersionDialog {type='Core::Internal::VersionDialog' unnamed='1' visible='1' windowTitle='About Qt Creator'}
......@@ -28,6 +29,7 @@
:CMake Wizard.Run CMake_QPushButton {text='Run CMake' type='QPushButton' unnamed='1' visible='1' window=':CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard'}
:CMake Wizard_CMakeProjectManager::Internal::CMakeOpenProjectWizard {type='CMakeProjectManager::Internal::CMakeOpenProjectWizard' unnamed='1' visible='1' windowTitle='CMake Wizard'}
:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget' name='groupBox' title='Behavior' type='QGroupBox' visible='1'}
:CreateProject_QStyleItem {clip='false' container=':Qt Creator_QDeclarativeView' enabled='true' text='Create Project' type='LinkedText' unnamed='1' visible='true'}
:DebugModeWidget.Breakpoints_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.Break' type='QDockWidget' visible='1' windowTitle='Breakpoints'}
:DebugModeWidget.Debugger Log_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.Output' type='QDockWidget' visible='1' windowTitle='Debugger Log'}
:DebugModeWidget.Debugger Toolbar_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger Toolbar' type='QDockWidget' visible='1' windowTitle='Debugger Toolbar'}
......@@ -40,6 +42,7 @@
:Dialog_QmlJSEditor::Internal::ComponentNameDialog {name='QmlJSEditor__Internal__ComponentNameDialog' type='QmlJSEditor::Internal::ComponentNameDialog' visible='1' windowTitle='Move Component into Separate File'}
:Edit Environment_ProjectExplorer::EnvironmentItemsDialog {type='ProjectExplorer::EnvironmentItemsDialog' unnamed='1' visible='1' windowTitle='Edit Environment'}
:Failed to start application_QMessageBox {type='QMessageBox' unnamed='1' visible='1' windowTitle='Failed to start application'}
:Form.Startup_QGroupBox {container=':qt_tabwidget_stackedwidget.Form_QWidget' name='startupGroupBox' title='Startup' type='QGroupBox' visible='1'}
:Generator:_QComboBox {buddy=':CMake Wizard.Generator:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:Hits_QCLuceneResultWidget {aboveWidget=':Hits_QLabel' type='QCLuceneResultWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Hits_QLabel {text~='\\\\d+ - \\\\d+ of \\\\d+ Hits' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
......@@ -49,6 +52,9 @@
:New.templateCategoryView_QTreeView {name='templateCategoryView' type='QTreeView' visible='1' window=':New_Core::Internal::NewDialog'}
:New_Core::Internal::NewDialog {name='Core__Internal__NewDialog' type='Core::Internal::NewDialog' visible='1' windowTitle='New'}
:Next_QPushButton {text~='(Next.*|Continue)' type='QPushButton' visible='1'}
:Open File.File name:_QLabel {name='fileNameLabel' text='File name:' type='QLabel' visible='1' window=':Open File_QFileDialog'}
:Open File_QFileDialog {name='QFileDialog' type='QFileDialog' visible='1' windowTitle='Open File'}
:OpenProject_QStyleItem {clip='false' container=':Qt Creator_QDeclarativeView' enabled='true' text='Open Project' type='LinkedText' unnamed='1' visible='true'}
:Options.Cancel_QPushButton {text='Cancel' type='QPushButton' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'}
:Options.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'}
:Options.qt_tabwidget_stackedwidget_QStackedWidget {name='qt_tabwidget_stackedwidget' type='QStackedWidget' visible='1' window=':Options_Core::Internal::SettingsDialog'}
......@@ -57,12 +63,16 @@
:Options_QListView {type='QListView' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'}
:QML Debugging.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':QML Debugging_QMessageBox'}
:QML Debugging_QMessageBox {type='QMessageBox' unnamed='1' visible='1' windowTitle='QML Debugging'}
:QWebPage {type='QWebPage' unnamed='1'}
:Qt Creator.Add Bookmark_QToolButton {text='Add Bookmark' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Analyzer Toolbar_QDockWidget {name='Analyzer Toolbar' type='QDockWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Analyzer Toolbar'}
:Qt Creator.CloseFind_QToolButton {name='close' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Compile Output_Core::OutputWindow {type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Compile Output'}
:Qt Creator.DebugModeWidget_QSplitter {name='DebugModeWidget' type='QSplitter' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Go to Help Mode_QToolButton {text='Go to Help Mode' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Help_Search for:_QLineEdit {leftWidget=':Qt Creator.Search for:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'}
:Qt Creator.Project.Menu.Project_QMenu {name='Project.Menu.Project' type='QMenu' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.ReRun_QToolButton {toolTip='Re-run this run-configuration' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Replace All_QToolButton {name='replaceAllButton' text='Replace All' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
......@@ -80,7 +90,9 @@
:Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Find::Internal::SearchResultTreeView {type='Find::Internal::SearchResultTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Help::Internal::HelpViewer {type='Help::Internal::HelpViewer' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_HelpSelector_QComboBox {occurrence='3' type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Issues_Core::Internal::OutputPaneToggleButton {occurrence='1' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_QDeclarativeView {type='QDeclarativeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_QHelpContentWidget {type='QHelpContentWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_QTableView {type='QTableView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
......@@ -95,14 +107,17 @@
:QtSupport__Internal__QtVersionManager.QLabel {container=':qt_tabwidget_stackedwidget.QtSupport__Internal__QtVersionManager_QtSupport::Internal::QtOptionsPageWidget' type='QLabel' unnamed='1' visible='1'}
:QtSupport__Internal__QtVersionManager.qmake_QLabel {container=':qt_tabwidget_stackedwidget.QtSupport__Internal__QtVersionManager_QtSupport::Internal::QtOptionsPageWidget' name='qmakePath' type='QLabel' visible='1'}
:QtSupport__Internal__QtVersionManager.qtdirList_QTreeWidget {container=':qt_tabwidget_stackedwidget.QtSupport__Internal__QtVersionManager_QtSupport::Internal::QtOptionsPageWidget' name='qtdirList' type='QTreeWidget' visible='1'}
:Startup.contextHelpComboBox_QComboBox {container=':Form.Startup_QGroupBox' name='contextHelpComboBox' type='QComboBox' visible='1'}
:Symbol Server_Utils::CheckableMessageBox {type='Utils::CheckableMessageBox' unnamed='1' visible='1' windowTitle='Symbol Server'}
:addToVersionControlComboBox_QComboBox {name='addToVersionControlComboBox' type='QComboBox' visible='1'}
:fileNameEdit_QLineEdit {buddy=':Open File.File name:_QLabel' name='fileNameEdit' type='QLineEdit' visible='1'}
:formFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Form file:_QLabel' name='formFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'}
:frame.templateDescription_QTextBrowser {container=':New.frame_QFrame' name='templateDescription' type='QTextBrowser' visible='1'}
:headerFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Header file:_QLabel' name='headerFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'}
:popupFrame_Proposal_QListView {container=':popupFrame_TextEditor::GenericProposalWidget' type='QListView' unnamed='1' visible='1'}
:popupFrame_TextEditor::GenericProposalWidget {name='m_popupFrame' type='TextEditor::GenericProposalWidget' visible='1'}
:qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='CppTools__Internal__CompletionSettingsPage' type='QWidget' visible='1'}
:qt_tabwidget_stackedwidget.Form_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='Help__Internal__GeneralSettingsPage' type='QWidget' visible='1' windowTitle='Form'}
:qt_tabwidget_stackedwidget.QtSupport__Internal__QtVersionManager_QtSupport::Internal::QtOptionsPageWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='QtSupport__Internal__QtVersionManager' type='QtSupport::Internal::QtOptionsPageWidget' visible='1'}
:qt_tabwidget_stackedwidget_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' type='QWidget' unnamed='1' visible='1'}
:scrollArea.Create Build Configurations:_QComboBox_2 {container=':Qt Gui Application.scrollArea_QScrollArea' leftWidget=':scrollArea.Create Build Configurations:_QLabel_2' type='QComboBox' unnamed='1' visible='1'}
......
......@@ -12,9 +12,14 @@ def __handleProcessExited__(object, exitCode):
global processExited
processExited = True
def openQmakeProject(projectPath, targets=QtQuickConstants.Targets.DESKTOP):
def openQmakeProject(projectPath, targets = QtQuickConstants.Targets.DESKTOP, fromWelcome = False):
cleanUpUserFiles(projectPath)
invokeMenuItem("File", "Open File or Project...")
if fromWelcome:
mouseClick(waitForObject(":OpenProject_QStyleItem"), 5, 5, 0, Qt.LeftButton)
if not platform.system() == "Darwin":
waitFor("waitForObject(':fileNameEdit_QLineEdit').focus == True")
else:
invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(projectPath)
try:
# handle update generated files dialog
......@@ -78,8 +83,11 @@ def shadowBuildDir(path, project, qtVersion, debugVersion):
# because the Simulator target is added for some cases even when Simulator has not
# been set up inside Qt versions/Toolchains
# this list can be used in __chooseTargets__()
def __createProjectSelectType__(category, template):
invokeMenuItem("File", "New File or Project...")
def __createProjectSelectType__(category, template, fromWelcome = False):
if fromWelcome:
mouseClick(waitForObject(":CreateProject_QStyleItem"), 5, 5, 0, Qt.LeftButton)
else:
invokeMenuItem("File", "New File or Project...")
categoriesView = waitForObject("{type='QTreeView' name='templateCategoryView'}", 20000)
clickItem(categoriesView, "Projects." + category, 5, 5, 0, Qt.LeftButton)
templatesView = waitForObject("{name='templatesView' type='QListView'}", 20000)
......@@ -199,12 +207,14 @@ def createProject_Qt_Console(path, projectName, checks = True):
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 10000)
__verifyFileCreation__(path, expectedFiles)
def createNewQtQuickApplication(workingDir, projectName = None, templateFile = None, targets = QtQuickConstants.Targets.DESKTOP, qtQuickVersion=1):
def createNewQtQuickApplication(workingDir, projectName = None, templateFile = None,
targets = QtQuickConstants.Targets.DESKTOP, qtQuickVersion=1,
fromWelcome=False):
if templateFile:
available = __createProjectSelectType__(" Applications", "Qt Quick Application (from Existing QML File)")
available = __createProjectSelectType__(" Applications", "Qt Quick Application (from Existing QML File)", fromWelcome)
else:
available = __createProjectSelectType__(" Applications", "Qt Quick %d Application (Built-in Elements)"
% qtQuickVersion)
% qtQuickVersion, fromWelcome)
projectName = __createProjectSetNameAndPath__(workingDir, projectName)
if templateFile:
baseLineEd = waitForObject("{type='Utils::BaseValidatingLineEdit' unnamed='1' visible='1'}", 20000)
......
import __builtin__
# appends to line, by typing <typeWhat> after <insertAfterLine> text into <codeArea> widget
def appendToLine(codeArea, insertAfterLine, typeWhat):
......@@ -50,3 +51,23 @@ def changeAutocompleteToManual():
selectFromCombo(":Behavior.completionTrigger_QComboBox", "Manually")
verifyEnabled(":Options.OK_QPushButton")
clickButton(waitForObject(":Options.OK_QPushButton"))
# wait and verify if object item exists/not exists
def checkIfObjectItemExists(object, item, timeout = 3000):
try:
waitForObjectItem(object, item, timeout)
return True
except:
return False
# this function creates a string holding the real name of a Qml Item
# param type defines the Qml type (support is limited)
# param container defines the container of the Qml item - can be a real or symbolic name
# param clip defines the state of the clip property (true/false)
# param text a string holding the complete text property (e.g. "text='example'", "text~='ex.*'")
def getQmlItem(type, container, clip, text=""):
if (container.startswith(":")):
container = "'%s'" % container
clip = ("%s" % __builtin__.bool(clip)).lower()
return ("{clip='%s' container=%s enabled='true' %s type='%s' unnamed='1' visible='true'}"
% (clip, container, text, type))
\ No newline at end of file
......@@ -453,3 +453,20 @@ def iterateQtVersions(keepOptionsOpen=False, additionalFunction=None, *argsForAd
return result, additionalResult
else:
return result
# set "Always Start Full Help" in "Tools" -> "Options..." -> "Help" -> "General"
def setAlwaysStartFullHelp():
invokeMenuItem("Tools", "Options...")
waitForObjectItem(":Options_QListView", "Help")
clickItem(":Options_QListView", "Help", 5, 5, 0, Qt.LeftButton)
clickTab(waitForObject(":Options.qt_tabwidget_tabbar_QTabBar"), "General")
selectFromCombo(":Startup.contextHelpComboBox_QComboBox", "Always Start Full Help")
clickButton(waitForObject(":Options.OK_QPushButton"))
def removePackagingDirectory(projectPath):
qtcPackaging = os.path.join(projectPath, "qtc_packaging")
if os.path.exists(qtcPackaging):
test.log("Removing old packaging directory '%s'" % qtcPackaging)
deleteDirIfExists(qtcPackaging)
else:
test.log("Couldn't remove packaging directory '%s' - did not exist." % qtcPackaging)
QT_PLATFORM_PLUGIN=nonesuch
AUT=qtcreator
CLASS=
CLASSPATH=
CWD=
ENVVARS=envvars
HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAP=../objects.map
TEST_CASES=tst_WELP01 tst_WELP02 tst_WELP03 tst_WELP04
VERSION=2
WRAPPERS=Qt
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
webPageContentLoadedValue = 0
gettingStartedText = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Getting Started'")
# wait until help gets loaded
def webPageContentLoaded(obj, param):
global webPageContentLoadedValue
objectClass = str(obj.metaObject().className())
if objectClass in ("QWebPage", "Help::Internal::HelpViewer"):
webPageContentLoadedValue += 1
def clickItemVerifyHelpCombo(qmlItem, expectedHelpComboText, testDetails):
global gettingStartedText
webPageContentLoadedValue = 0
mouseClick(waitForObject(qmlItem), 5, 5, 0, Qt.LeftButton)
waitFor("webPageContentLoadedValue == 4", 5000)
test.compare(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText,
expectedHelpComboText, testDetails)
# select "Welcome" page from left toolbar again
switchViewTo(ViewConstants.WELCOME)
test.verify(checkIfObjectExists(gettingStartedText),
"Verifying: Getting Started topic is being displayed.")
def main():
global webPageContentLoadedValue, gettingStartedText
# open Qt Creator
startApplication("qtcreator" + SettingsPath)
installLazySignalHandler(":QWebPage","loadFinished(bool)", "webPageContentLoaded")
installLazySignalHandler(":*Qt Creator_Help::Internal::HelpViewer", "loadFinished(bool)",
"webPageContentLoaded")
setAlwaysStartFullHelp()
if not test.verify(checkIfObjectExists(gettingStartedText),
"Verifying: Qt Creator displays Welcome Page with Getting Started."):
mouseClick(waitForObject(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='Getting Started'")), 5, 5, 0, Qt.LeftButton)
qmlItem = getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False, "text='User Guide'")
expectedText = "QtCreator : Qt Creator Manual"
testDetails = "Verifying: Help with Creator Documentation is being opened."
# select "User Guide" topic
clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails)
# check "Online Community" link
test.verify(checkIfObjectExists(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='Online Community'")),
"Verifying: Link to Qt forums exists.")
test.verify(checkIfObjectExists(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='Labs'")),
"Verifying: Link to Qt Labs – Developers blog exists.")
qmlItem = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, "text='IDE Overview'")
expectedText = "QtCreator : IDE Overview"
testDetails = "Verifying: Help with IDE Overview topic is being opened."
# select "IDE Overview"
clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails)
qmlItem = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, "text='User Interface'")
expectedText = "QtCreator : User Interface"
testDetails = "Verifying: Help with User Interface topic is being opened."
# select "User interface"
clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails)
# select "Building and Running an Example Application"
webPageContentLoadedValue = 0
mouseClick(waitForObject(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Building and Running an Example Application'")),
5, 5, 0, Qt.LeftButton)
waitFor("webPageContentLoadedValue == 4", 5000)
checkPattern = "QtCreator : Building and Running an Example( Application)?"
checkText = str(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText)
if not test.verify(re.search(checkPattern, checkText),
"Verifying: Building and Running an Example is opened."):
test.fail("Pattern does not match: '%s', text found in QComboBox is: "
"'%s'" % (checkPattern, checkText))
# select "Welcome" page from left toolbar again
switchViewTo(ViewConstants.WELCOME)
test.verify(checkIfObjectExists(gettingStartedText),
"Verifying: Getting Started topic is being displayed.")
# select "Start Developing"
mouseClick(waitForObject(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Start Developing'")), 5, 5, 0, Qt.LeftButton)
test.verify(checkIfObjectExists(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Tutorials'")),
"Verifying: Tutorials are opened in Welcome Page.")
# exit Qt Creator
invokeMenuItem("File", "Exit")
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
def main():
# prepare example project
sourceExample = os.path.join(sdkPath, "Examples", "4.7", "declarative", "animation", "basics",
"property-animation")
if not neededFilePresent(sourceExample):
return
# open Qt Creator
startApplication("qtcreator" + SettingsPath)
if not test.verify(checkIfObjectExists(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Getting Started'")),
"Verifying: Qt Creator displays Welcome Page with Getting Started."):
mouseClick(waitForObject(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='Getting Started'")), 5, 5, 0, Qt.LeftButton)
# select "Develop" topic
mouseClick(waitForObject(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='Develop'")), 5, 5, 0, Qt.LeftButton)
sessionsText = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, "text='Sessions'")
recentProjText = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Recent Projects'")
test.verify(checkIfObjectExists(sessionsText) and checkIfObjectExists(recentProjText),
"Verifying: 'Develop' with 'Recently used sessions' and "
"'Recently used Projects' is being opened.")
# select "Create Project" and try to create a new project.
# create Qt Quick application from "Welcome" page -> "Develop" tab
createNewQtQuickApplication(tempDir(), "SampleApp", fromWelcome = True)
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}",
"sourceFilesRefreshed(QStringList)")
test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
" text='SampleApp' type='QModelIndex'}"),
"Verifying: The project is opened in 'Edit' mode after configuring.")
# go to "Welcome page" -> "Develop" topic again.
switchViewTo(ViewConstants.WELCOME)
test.verify(checkIfObjectExists(sessionsText) and checkIfObjectExists(recentProjText),
"Verifying: 'Develop' with 'Sessions' and 'Recent Projects' is opened.")
# select "Open project" and select any project.
# copy example project to temp directory
examplePath = os.path.join(prepareTemplate(sourceExample), "propertyanimation.pro")
# open example project from "Welcome" page -> "Develop" tab
openQmakeProject(examplePath, fromWelcome = True)
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}",
"sourceFilesRefreshed(QStringList)")
test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
" text='propertyanimation' type='QModelIndex'}"),
"Verifying: The project is opened in 'Edit' mode after configuring.")
# go to "Welcome page" -> "Develop" again and check if there is an information about
# recent projects in "Recent Projects".
switchViewTo(ViewConstants.WELCOME)
test.verify(checkIfObjectExists(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='propertyanimation'")) and
checkIfObjectExists(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='SampleApp'")),
"Verifying: 'Develop' is opened and the recently created and "
"opened project can be seen in 'Recent Projects'.")
# exit Qt Creator
invokeMenuItem("File", "Exit")
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
webPageContentLoadedValue = 0
# wait until help gets loaded
def webPageContentLoaded(obj, param):
global webPageContentLoadedValue
objectClass = str(obj.metaObject().className())
if objectClass in ("QWebPage", "Help::Internal::HelpViewer"):
webPageContentLoadedValue += 1
def isLoaded():
if platform.system() == "Darwin":
return webPageContentLoadedValue == 1
else:
return webPageContentLoadedValue == 3
def handlePackagingMessageBoxes():
if platform.system() == "Darwin":
messageBox = "{type='QMessageBox' unnamed='1' visible='1'}"
else:
messageBox = ("{type='QMessageBox' unnamed='1' visible='1' "
"windowTitle='Add Packaging Files to Project'}")
while (True):
try:
waitForObject(messageBox, 3000)
clickButton(waitForObject("{text='Yes' type='QPushButton' unnamed='1' visible='1' "
"window=%s}" % messageBox))
except:
break
def main():
global webPageContentLoadedValue
if platform.system() in ('Microsoft', 'Windows'):
test.log("Test case is currently disabled on Windows because it constantly crashes the AUT")
return
# open Qt Creator
startApplication("qtcreator" + SettingsPath)
installLazySignalHandler(":QWebPage","loadFinished(bool)", "webPageContentLoaded")
installLazySignalHandler(":*Qt Creator_Help::Internal::HelpViewer", "loadFinished(bool)",
"webPageContentLoaded")
setAlwaysStartFullHelp()
if not test.verify(checkIfObjectExists(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Getting Started'")),
"Verifying: Qt Creator displays Welcome Page with Getting Started."):
mouseClick(waitForObject(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='Getting Started'")), 5, 5, 0, Qt.LeftButton)
# select "Examples" topic
mouseClick(waitForObject(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='Examples'")), 5, 5, 0, Qt.LeftButton)
test.verify(checkIfObjectExists(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Examples'")),
"Verifying: 'Examples' topic is opened and the examples are shown.")
# select an example and run example
webPageContentLoadedValue = 0
cleanUpUserFiles(sdkPath + "/Examples/4.7/opengl/2dpainting/2dpainting.pro")
removePackagingDirectory(sdkPath + "/Examples/4.7/opengl/2dpainting")
mouseClick(waitForObject(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Search in Examples...'")), 5, 5, 0, Qt.LeftButton)
searchTutsAndExmpl = getQmlItem("TextInput", ":Qt Creator_QDeclarativeView", False)
replaceEditorContent(waitForObject(searchTutsAndExmpl), "qwerty")
test.verify(checkIfObjectExists("{clip='true' container=':Qt Creator_QDeclarativeView' "
"enabled='true' id='captionItem' type='Text' unnamed='1' "
"visible='true'}", False),
"Verifying: 'Tutorials' topic is opened and nothing is shown.")
replaceEditorContent(waitForObject(searchTutsAndExmpl), "2d painting")
twoDPainting = getQmlItem("Text", ":Qt Creator_QDeclarativeView", True, "text~='2D Painting.*'")
test.verify(checkIfObjectExists(twoDPainting),
"Verifying: Text and Video tutorials are shown.")
mouseClick(waitForObject(twoDPainting), 5, 5, 0, Qt.LeftButton)
handlePackagingMessageBoxes()
waitFor("isLoaded()", 5000)
test.verify("2D Painting Example" in str(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText),
"Verifying: The example application is opened.")
switchViewTo(ViewConstants.EDIT)
test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
" text='2dpainting' type='QModelIndex'}"),
"Verifying: The project is shown in 'Edit' mode.")
openItemContextMenu(waitForObject(":Qt Creator_Utils::NavigationTreeView"),
"2dpainting", 5, 5, 0)
activateItem(waitForObjectItem(":Qt Creator.Project.Menu.Project_QMenu",
'Close Project "2dpainting"'))
# close example and go to "Welcome" page -> "Examples" again and choose another example
webPageContentLoadedValue = 0
switchViewTo(ViewConstants.WELCOME)
cleanUpUserFiles(sdkPath + "/Examples/4.7/itemviews/addressbook/addressbook.pro")
removePackagingDirectory(sdkPath + "/Examples/4.7/itemviews/addressbook")
replaceEditorContent(waitForObject(searchTutsAndExmpl),
"address book")
addressBook = getQmlItem("Text", ":Qt Creator_QDeclarativeView", True, "text~='Address Book.*'")
test.verify(checkIfObjectExists(addressBook),
"Verifying: Text and Video tutorials are shown.")
mouseClick(waitForObject(addressBook), 5, 5, 0, Qt.LeftButton)
handlePackagingMessageBoxes()
waitFor("isLoaded()", 5000)
test.verify("Address Book Example" in str(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText),
"Verifying: First example is closed and another application is opened.")
# close second example application
switchViewTo(ViewConstants.EDIT)
test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
" text='propertyanimation' type='QModelIndex'}", False) and
checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"
" text='addressbook' type='QModelIndex'}"),
"Verifying: The project is shown in 'Edit' mode while old project isn't.")
openItemContextMenu(waitForObject(":Qt Creator_Utils::NavigationTreeView"),
"addressbook", 5, 5, 0)
activateItem(waitForObjectItem(":Qt Creator.Project.Menu.Project_QMenu",
'Close Project "addressbook"'))
navTree = waitForObject(":Qt Creator_Utils::NavigationTreeView")
res = waitFor("navTree.model().rowCount(navTree.rootIndex()) == 0", 2000)
test.verify(not checkIfObjectItemExists(":Qt Creator_Utils::NavigationTreeView", "addressbook"),
"Verifying: The second example is closed.")
# clean up created packaging directories
removePackagingDirectory(sdkPath + "/Examples/4.7/opengl/2dpainting")
removePackagingDirectory(sdkPath + "/Examples/4.7/itemviews/addressbook")
# exit Qt Creator
invokeMenuItem("File", "Exit")
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
def main():
# open Qt Creator
startApplication("qtcreator" + SettingsPath)
if not test.verify(checkIfObjectExists(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Getting Started'")),
"Verifying: Qt Creator displays Welcome Page with Getting Started."):
mouseClick(waitForObject(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='Getting Started'")), 5, 5, 0, Qt.LeftButton)
# select "Tutorials" topic
mouseClick(waitForObject(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='Tutorials'")), 5, 5, 0, Qt.LeftButton)
mouseClick(waitForObject(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Search in Tutorials...'")), 5, 5, 0, Qt.LeftButton)
searchTutsAndExmpl = getQmlItem("TextInput", ":Qt Creator_QDeclarativeView", False)
replaceEditorContent(waitForObject(searchTutsAndExmpl), "qwerty")
test.verify(checkIfObjectExists(getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Tutorials'")) and
checkIfObjectExists("{clip='true' container=':Qt Creator_QDeclarativeView' "
"enabled='true' id='captionItem' type='Text' unnamed='1' "
"visible='true'}", False),
"Verifying: 'Tutorials' topic is opened and nothing is shown.")
replaceEditorContent(waitForObject(searchTutsAndExmpl),
"building and running an example application")
bldRunExmpl = getQmlItem("Text", ":Qt Creator_QDeclarativeView", True,
"text='Building and Running an Example Application'")
test.verify(checkIfObjectExists(bldRunExmpl), "Verifying: Text and Video tutorials are shown.")
# select a text tutorial
mouseClick(waitForObject(bldRunExmpl), 5, 5, 0, Qt.LeftButton)
test.verify(checkIfObjectExists(":Qt Creator.Go to Help Mode_QToolButton") and
checkIfObjectExists(":DebugModeWidget.Debugger Toolbar_QDockWidget", False) and
checkIfObjectExists(":Qt Creator.Analyzer Toolbar_QDockWidget", False),
"Verifying: The tutorial is opened and located to the right part. "
"The view is in 'Edit' mode.")
# go to "Welcome" page -> "Tutorials" topic again and check the video tutorial link
switchViewTo(ViewConstants.WELCOME)
replaceEditorContent(waitForObject(searchTutsAndExmpl), "meet qt quick")
test.verify(checkIfObjectExists(getQmlItem("Text", ":Qt Creator_QDeclarativeView", True,
"text='Meet Qt Quick'")),
"Verifying: Link to the video tutorial exists.")
# exit Qt Creator
invokeMenuItem("File", "Exit")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment