Squish: Enable running on Qt5

Change-Id: Id74f1f2162542cbac98f86bc0c0b049334cdf035
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
Christian Stenger
2013-08-08 11:26:13 +02:00
parent 393792956f
commit 4433f7aadd
10 changed files with 38 additions and 33 deletions

View File

@@ -33,11 +33,11 @@ import re
processStarted = False processStarted = False
processExited = False processExited = False
def __handleProcessStarted__(object): def __handleProcessStarted__(*args):
global processStarted global processStarted
processStarted = True processStarted = True
def __handleProcessExited__(object, exitCode): def __handleProcessExited__(*args):
global processExited global processExited
processExited = True processExited = True
@@ -330,8 +330,8 @@ def runAndCloseApp(withHookInto=False, executable=None, port=None, function=None
global processStarted, processExited global processStarted, processExited
processStarted = processExited = False processStarted = processExited = False
overrideInstallLazySignalHandler() overrideInstallLazySignalHandler()
installLazySignalHandler("{type='ProjectExplorer::ApplicationLauncher'}", "processStarted()", "__handleProcessStarted__") installLazySignalHandler("{type='QProcess'}", "started()", "__handleProcessStarted__")
installLazySignalHandler("{type='ProjectExplorer::ApplicationLauncher'}", "processExited(int)", "__handleProcessExited__") installLazySignalHandler("{type='QProcess'}", "finished(int,QProcess::ExitStatus)", "__handleProcessExited__")
runButton = waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton") runButton = waitForObject(":*Qt Creator.Run_Core::Internal::FancyToolButton")
clickButton(runButton) clickButton(runButton)
if sType != SubprocessType.QT_QUICK_UI: if sType != SubprocessType.QT_QUICK_UI:
@@ -445,7 +445,7 @@ def __closeSubprocessByHookingInto__(executable, port, function, sType, userDefT
"Using fallback of pushing STOP inside Creator.") "Using fallback of pushing STOP inside Creator.")
resetApplicationContextToCreator() resetApplicationContextToCreator()
__closeSubprocessByPushingStop__(sType) __closeSubprocessByPushingStop__(sType)
waitFor("processExited==True", 10000) waitFor("processExited==True and 'exited with code' in str(output.plainText)", 10000)
if not processExited: if not processExited:
test.warning("Sub-process seems not to have closed properly.") test.warning("Sub-process seems not to have closed properly.")
try: try:

View File

@@ -84,8 +84,8 @@ def main():
invokeMenuItem("File", "Save All") invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
def __handleFutureProgress__(obj): def __handleFutureProgress__(*args):
global searchFinished global searchFinished
if className(obj) == "Core::FutureProgress": if className(args[0]) == "Core::FutureProgress":
searchFinished = True searchFinished = True

View File

@@ -35,19 +35,20 @@ gettingStartedText = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False,
"text='Getting Started'") "text='Getting Started'")
# wait until help gets loaded # wait until help gets loaded
def webPageContentLoaded(obj, param): def webPageContentLoaded(*args):
global webPageContentLoadedValue global webPageContentLoadedValue
objectClass = str(obj.metaObject().className()) objectClass = str(args[0].metaObject().className())
if objectClass in ("QWebPage", "Help::Internal::HelpViewer"): if objectClass in ("QWebPage", "Help::Internal::HelpViewer"):
webPageContentLoadedValue += 1 webPageContentLoadedValue += 1
def clickItemVerifyHelpCombo(qmlItem, expectedHelpComboText, testDetails): def clickItemVerifyHelpCombo(qmlItem, expectedHelpComboRegex, testDetails):
global gettingStartedText global gettingStartedText
webPageContentLoadedValue = 0 webPageContentLoadedValue = 0
mouseClick(waitForObject(qmlItem), 5, 5, 0, Qt.LeftButton) mouseClick(waitForObject(qmlItem), 5, 5, 0, Qt.LeftButton)
waitFor("webPageContentLoadedValue == 4", 5000) waitFor("webPageContentLoadedValue == 4", 5000)
test.compare(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText, foundText = str(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText)
expectedHelpComboText, testDetails) if not test.verify(re.match(expectedHelpComboRegex, foundText), testDetails):
test.log("Found %s" % foundText)
# select "Welcome" page from left toolbar again # select "Welcome" page from left toolbar again
switchViewTo(ViewConstants.WELCOME) switchViewTo(ViewConstants.WELCOME)
test.verify(checkIfObjectExists(gettingStartedText), test.verify(checkIfObjectExists(gettingStartedText),
@@ -68,7 +69,7 @@ def main():
mouseClick(waitForObject(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False, mouseClick(waitForObject(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
"text='Getting Started'")), 5, 5, 0, Qt.LeftButton) "text='Getting Started'")), 5, 5, 0, Qt.LeftButton)
qmlItem = getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False, "text='User Guide'") qmlItem = getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False, "text='User Guide'")
expectedText = "QtCreator : Qt Creator Manual" expectedText = "(QtCreator : Qt Creator Manual)|(Qt Creator Manual [|] QtCreator)"
testDetails = "Verifying: Help with Creator Documentation is being opened." testDetails = "Verifying: Help with Creator Documentation is being opened."
# select "User Guide" topic # select "User Guide" topic
clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails) clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails)
@@ -80,12 +81,12 @@ def main():
"text='Blogs'")), "text='Blogs'")),
"Verifying: Link to Planet Qt exists.") "Verifying: Link to Planet Qt exists.")
qmlItem = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, "text='IDE Overview'") qmlItem = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, "text='IDE Overview'")
expectedText = "QtCreator : IDE Overview" expectedText = "(QtCreator : IDE Overview)|(IDE Overview [|] QtCreator)"
testDetails = "Verifying: Help with IDE Overview topic is being opened." testDetails = "Verifying: Help with IDE Overview topic is being opened."
# select "IDE Overview" # select "IDE Overview"
clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails) clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails)
qmlItem = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, "text='User Interface'") qmlItem = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, "text='User Interface'")
expectedText = "QtCreator : User Interface" expectedText = "(QtCreator : User Interface)|(User Interface [|]) QtCreator"
testDetails = "Verifying: Help with User Interface topic is being opened." testDetails = "Verifying: Help with User Interface topic is being opened."
# select "User interface" # select "User interface"
clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails) clickItemVerifyHelpCombo(qmlItem, expectedText, testDetails)
@@ -95,7 +96,8 @@ def main():
"text='Building and Running an Example Application'")), "text='Building and Running an Example Application'")),
5, 5, 0, Qt.LeftButton) 5, 5, 0, Qt.LeftButton)
waitFor("webPageContentLoadedValue == 4", 5000) waitFor("webPageContentLoadedValue == 4", 5000)
checkPattern = "QtCreator : Building and Running an Example( Application)?" checkPattern = ("(QtCreator : Building and Running an Example( Application)?)"
"|(Building and Running an Example( Application)? [|] QtCreator)")
checkText = str(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText) checkText = str(waitForObject(":Qt Creator_HelpSelector_QComboBox").currentText)
if not test.verify(re.search(checkPattern, checkText), if not test.verify(re.search(checkPattern, checkText),
"Verifying: Building and Running an Example is opened."): "Verifying: Building and Running an Example is opened."):

View File

@@ -33,9 +33,9 @@ source("../../shared/suites_qtta.py")
webPageContentLoadedValue = 0 webPageContentLoadedValue = 0
# wait until help gets loaded # wait until help gets loaded
def webPageContentLoaded(obj, param): def webPageContentLoaded(*args):
global webPageContentLoadedValue global webPageContentLoadedValue
objectClass = str(obj.metaObject().className()) objectClass = str(args[0].metaObject().className())
if objectClass in ("QWebPage", "Help::Internal::HelpViewer"): if objectClass in ("QWebPage", "Help::Internal::HelpViewer"):
webPageContentLoadedValue += 1 webPageContentLoadedValue += 1

View File

@@ -112,7 +112,7 @@ def main():
test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "Dummy::Dummy(int)") test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "Dummy::Dummy(int)")
invokeMenuItem("File", "Exit") invokeMenuItem("File", "Exit")
def __handleTextChanged__(object): def __handleTextChanged__(*args):
global textChanged global textChanged
textChanged = True textChanged = True

View File

@@ -206,7 +206,7 @@ def maskSpecialCharsForProjectTree(filename):
filename = filename.replace("/?","\\?").replace("/*","\\*") filename = filename.replace("/?","\\?").replace("/*","\\*")
return filename return filename
def __handleFutureProgress__(obj): def __handleFutureProgress__(*args):
global searchFinished global searchFinished
if className(obj) == "Core::FutureProgress": if className(args[0]) == "Core::FutureProgress":
searchFinished = True searchFinished = True

View File

@@ -76,7 +76,7 @@ def prepareQmlFile():
editor.plainText = "\n".join([line.lstrip() for line in lines]) + "\n" editor.plainText = "\n".join([line.lstrip() for line in lines]) + "\n"
return True return True
def handleTextChanged(object): def handleTextChanged(*args):
global textHasChanged global textHasChanged
textHasChanged = True textHasChanged = True

View File

@@ -160,6 +160,6 @@ def enableMaddePlugin():
"occurrence='%d'}" % (devSupport, maddePos)), 5, 5, 0, Qt.LeftButton) "occurrence='%d'}" % (devSupport, maddePos)), 5, 5, 0, Qt.LeftButton)
clickButton(":Installed Plugins.Close_QPushButton") clickButton(":Installed Plugins.Close_QPushButton")
def __handleTextChanged__(object): def __handleTextChanged__(*args):
global textChanged global textChanged
textChanged = True textChanged = True

View File

@@ -40,6 +40,9 @@ def main():
clickItem(":Options_QListView", "Environment", 14, 15, 0, Qt.LeftButton) clickItem(":Options_QListView", "Environment", 14, 15, 0, Qt.LeftButton)
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "General") clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "General")
languageName = testData.field(lang, "language") languageName = testData.field(lang, "language")
if "%1" in languageName:
country = str(QLocale.countryToString(QLocale(testData.field(lang, "ISO")).country()))
languageName = languageName.replace("%1", country)
selectFromCombo(":User Interface.languageBox_QComboBox", languageName) selectFromCombo(":User Interface.languageBox_QComboBox", languageName)
clickButton(waitForObject(":Options.OK_QPushButton")) clickButton(waitForObject(":Options.OK_QPushButton"))
clickButton(waitForObject(":Restart required.OK_QPushButton")) clickButton(waitForObject(":Restart required.OK_QPushButton"))

View File

@@ -1,10 +1,10 @@
"language" "File" "Exit" "language" "File" "Exit" "ISO"
"Czech (CzechRepublic)" "Soubor" "Ukončit" "Czech (CzechRepublic)" "Soubor" "Ukončit" "cs_CZ"
"German (Germany)" "Datei" "Beenden" "German (Germany)" "Datei" "Beenden" "de_DE"
"French (France)" "Fichier" "Quitter" "French (France)" "Fichier" "Quitter" "fr_FR"
"Japanese (Japan)" "ファイル(F)" "終了(X)" "Japanese (Japan)" "ファイル(F)" "終了(X)" "ja_JP"
"Polish (Poland)" "Plik" "Zakończ" "Polish (Poland)" "Plik" "Zakończ" "pl_PL"
"Russian (RussianFederation)" "Файл" "Выход" "Russian (%1)" "Файл" "Выход" "ru_RU"
"Slovenian (Slovenia)" "Datoteka" "Končaj" "Slovenian (Slovenia)" "Datoteka" "Končaj" "sl_SL"
"Chinese (China)" "文件(F)" "退出(X)" "Chinese (China)" "文件(F)" "退出(X)" "zh_CN"
"Chinese (Taiwan)" "檔案(F)" "離開(X)" "Chinese (Taiwan)" "檔案(F)" "離開(X)" "zh_TW"
1 language File Exit ISO
2 Czech (CzechRepublic) Soubor Ukončit cs_CZ
3 German (Germany) Datei Beenden de_DE
4 French (France) Fichier Quitter fr_FR
5 Japanese (Japan) ファイル(F) 終了(X) ja_JP
6 Polish (Poland) Plik Zakończ pl_PL
7 Russian (RussianFederation) Russian (%1) Файл Выход ru_RU
8 Slovenian (Slovenia) Datoteka Končaj sl_SL
9 Chinese (China) 文件(F) 退出(X) zh_CN
10 Chinese (Taiwan) 檔案(F) 離開(X) zh_TW