Commit 6e2db0b6 authored by Eike Ziller's avatar Eike Ziller
Browse files

Merge remote-tracking branch 'origin/2.5'

parents e3c354d8 79ca1f3d
......@@ -207,6 +207,7 @@ def getEditorForFileSuffix(curFile):
"tcc", "tpp", "t++", "c", "cu", "m", "mm", "hh", "hxx", "h++", "hpp", "hp"]
qmlEditorSuffixes = ["qml", "qmlproject", "js", "qs", "qtt"]
proEditorSuffixes = ["pro", "pri", "prf"]
glslEditorSuffixes= ["frag", "vert", "fsh", "vsh", "glsl", "shader", "gsh"]
suffix = __getFileSuffix__(curFile)
if suffix in cppEditorSuffixes:
editor = waitForObject("{type='CppEditor::Internal::CPPEditorWidget' unnamed='1' "
......@@ -217,6 +218,9 @@ def getEditorForFileSuffix(curFile):
elif suffix in proEditorSuffixes:
editor = waitForObject("{type='Qt4ProjectManager::Internal::ProFileEditorWidget' unnamed='1' "
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
elif suffix in glslEditorSuffixes:
editor = waitForObject("{type='GLSLEditor::GLSLTextEditorWidget' unnamed='1' "
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
else:
test.log("Trying PlainTextEditor (file suffix: %s)" % suffix)
try:
......@@ -235,3 +239,52 @@ def __getFileSuffix__(fileName):
return None
else:
return suffix[1]
def maskSpecialCharsForSearchResult(filename):
filename = filename.replace("_", "\\_").replace(".","\\.")
return filename
def validateSearchResult(expectedCount):
searchResult = waitForObject(":Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton")
ensureChecked(searchResult)
resultTreeView = waitForObject("{type='Find::Internal::SearchResultTreeView' unnamed='1' "
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}")
counterLabel = waitForObject("{type='QLabel' unnamed='1' visible='1' text?='*matches found.' "
"window=':Qt Creator_Core::Internal::MainWindow'}")
matches = cast((str(counterLabel.text)).split(" ", 1)[0], "int")
test.compare(matches, expectedCount, "Verified match count.")
model = resultTreeView.model()
for row in range(model.rowCount()):
index = model.index(row, 0)
itemText = str(model.data(index).toString())
doubleClickItem(resultTreeView, maskSpecialCharsForSearchResult(itemText), 5, 5, 0, Qt.LeftButton)
test.log("%d occurrences in %s" % (model.rowCount(index), itemText))
for chRow in range(model.rowCount(index)):
chIndex = model.index(chRow, 0, index)
resultTreeView.scrollTo(chIndex)
text = str(chIndex.data())
rect = resultTreeView.visualRect(chIndex)
doubleClick(resultTreeView, rect.x+5, rect.y+5, 0, Qt.LeftButton)
editor = getEditorForFileSuffix(itemText)
waitFor("lineUnderCursor(editor) == text", 2000)
test.compare(lineUnderCursor(editor), text)
# this function invokes context menu and command from it
def invokeContextMenuItem(editorArea, command1, command2 = None):
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command1, 1000))
if command2:
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), command2, 1000))
# this function invokes the "Find Usages" item from context menu
# param editor an editor object
# param line a line in editor (content of the line as a string)
# param typeOperation a key to type
# param n how often repeat the type operation?
def invokeFindUsage(editor, line, typeOperation, n=1):
if not placeCursorToLine(editor, line, True):
return False
for i in range(n):
type(editor, typeOperation)
invokeContextMenuItem(editor, "Find Usages")
return True
......@@ -26,6 +26,10 @@ def openQmakeProject(projectPath, targets=QtQuickConstants.Targets.DESKTOP):
selectFromCombo(waitForObject(":Qt Creator.Create Build Configurations:_QComboBox", 180000),
"For Each Qt Version One Debug And One Release")
__chooseTargets__(targets)
if targets & QtQuickConstants.Targets.DESKTOP:
ensureChecked("{text='Shadow build' type='QCheckBox' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}")
configureButton = waitForObject("{text='Configure Project' type='QPushButton' unnamed='1' visible='1'"
"window=':Qt Creator_Core::Internal::MainWindow'}", 20000)
clickButton(configureButton)
......@@ -275,7 +279,8 @@ def __chooseTargets__(targets=QtQuickConstants.Targets.DESKTOP, availableTargets
available = availableTargets
else:
# following targets depend on the build environment - added for further/later tests
available = [QtQuickConstants.Targets.MAEMO5, QtQuickConstants.Targets.EMBEDDED_LINUX,
available = [QtQuickConstants.Targets.DESKTOP,
QtQuickConstants.Targets.MAEMO5, QtQuickConstants.Targets.EMBEDDED_LINUX,
QtQuickConstants.Targets.SIMULATOR, QtQuickConstants.Targets.HARMATTAN]
if platform.system() in ('Windows', 'Microsoft'):
available += [QtQuickConstants.Targets.SYMBIAN]
......
......@@ -35,8 +35,11 @@ def checkSyntaxError(issuesView, expectedTextsArray, warnIfMoreIssues = True):
return False
# wait and verify if object exists/not exists
def checkIfObjectExists(name, shouldExist = True, timeout = 3000):
return waitFor("object.exists(name) == shouldExist", timeout)
def checkIfObjectExists(name, shouldExist = True, timeout = 3000, verboseOnFail = False):
result = waitFor("object.exists(name) == shouldExist", timeout)
if verboseOnFail and not result:
test.log("checkIfObjectExists() failed for '%s'" % name)
return result
# change autocomplete options to manual
def changeAutocompleteToManual():
......@@ -47,4 +50,3 @@ def changeAutocompleteToManual():
selectFromCombo(":Behavior.completionTrigger_QComboBox", "Manually")
verifyEnabled(":Options.OK_QPushButton")
clickButton(waitForObject(":Options.OK_QPushButton"))
:*Qt Creator.Find_Find::Internal::FindToolBar {name='Find__Internal__FindWidget' type='Find::Internal::FindToolBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Find'}
:Behavior.Autocomplete common prefix_QCheckBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='partiallyComplete' text='Autocomplete common prefix' type='QCheckBox' visible='1'}
:Behavior.completionTrigger_QComboBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='completionTrigger' type='QComboBox' visible='1'}
:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget' name='groupBox' title='Behavior' type='QGroupBox' visible='1'}
......@@ -7,9 +8,17 @@
:Options.qt_tabwidget_tabbar_QTabBar {name='qt_tabwidget_tabbar' type='QTabBar' visible='1' window=':Options_Core::Internal::SettingsDialog'}
:Options_Core::Internal::SettingsDialog {type='Core::Internal::SettingsDialog' unnamed='1' visible='1' windowTitle~='(Options|Preferences)'}
:Options_QListView {type='QListView' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'}
:Qt Creator.CloseFind_QToolButton {name='close' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Create Build Configurations:_QComboBox {leftWidget=':Qt Creator.Create Build Configurations:_QLabel' type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Create Build Configurations:_QLabel {text='Create build configurations:' type='QLabel' unnamed='1' 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.Replace All_QToolButton {name='replaceAllButton' text='Replace All' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Replace_QToolButton {name='replaceButton' text='Replace' type='QToolButton' 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.replaceEdit_Utils::FilterLineEdit {name='replaceEdit' type='Utils::FilterLineEdit' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' unnamed='1' visible='1' windowTitle?='*Qt Creator'}
:Qt Creator_CppEditor::Internal::CPPEditorWidget {type='CppEditor::Internal::CPPEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_SearchResult_Core::Internal::OutputPaneToggleButton {occurrence='2' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:addToVersionControlComboBox_QComboBox {name='addToVersionControlComboBox' type='QComboBox' visible='1'}
:m_popupFrame_QListView {container=':m_popupFrame_TextEditor::GenericProposalWidget' type='QListView' unnamed='1' visible='1'}
......
......@@ -5,6 +5,6 @@ ENVVARS=envvars
HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
TEST_CASES=tst_CSUP01 tst_CSUP02
TEST_CASES=tst_CSUP01 tst_CSUP02 tst_CSUP04 tst_CSUP05
VERSION=2
WRAPPERS=Qt
source("../../shared/suites_qtta.py")
source("../../shared/qtcreator.py")
# entry of test
def main():
global searchFinished
# prepare example project
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/animation/basics/property-animation")
if not neededFilePresent(sourceExample):
return
# copy example project to temp directory
templateDir = prepareTemplate(sourceExample)
examplePath = templateDir + "/propertyanimation.pro"
startApplication("qtcreator" + SettingsPath)
# open example project
openQmakeProject(examplePath)
installLazySignalHandler("{type='Core::FutureProgress' unnamed='1'}", "finished()", "__handleFutureProgress__")
# wait for parsing to complete
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
# open test .pro project.
test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation"),
"Verifying if: Project is opened.")
# open .cpp file in editor
doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton)
test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
"Verifying if: .cpp file is opened in Edit mode.")
# place cursor on line "QmlApplicationViewer viewer;"
editorWidget = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
searchFinished = False
# invoke find usages from context menu on word "viewer"
if not invokeFindUsage(editorWidget, "QmlApplicationViewer viewer;", "<Left>", 10):
invokeMenuItem("File", "Exit")
return
# wait until search finished and verify search results
waitFor("searchFinished")
validateSearchResult(17)
result = re.search("QmlApplicationViewer", str(editorWidget.plainText))
test.verify(result, "Verifying if: The list of all usages of the selected text is displayed in Search Results. "
"File with used text is opened.")
# move cursor to the other word and test Find Usages function by pressing Ctrl+Shift+U.
doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton)
if not placeCursorToLine(editorWidget, "viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);"):
return
for i in range(4):
type(editorWidget, "<Left>")
searchFinished = False
type(editorWidget, "<Ctrl+Shift+U>")
# wait until search finished and verify search results
waitFor("searchFinished")
validateSearchResult(3)
# exit qt creator
invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit")
# no cleanup needed, as whole testing directory gets properly removed after test finished
def __handleFutureProgress__(obj):
global searchFinished
if className(obj) == "Core::FutureProgress":
searchFinished = True
source("../../shared/suites_qtta.py")
source("../../shared/qtcreator.py")
# entry of test
def main():
# prepare example project
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/animation/basics/property-animation")
if not neededFilePresent(sourceExample):
return
# copy example project to temp directory
templateDir = prepareTemplate(sourceExample)
examplePath = templateDir + "/propertyanimation.pro"
startApplication("qtcreator" + SettingsPath)
# open example project
openQmakeProject(examplePath)
# wait for parsing to complete
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)")
test.verify(waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation"),
"Verifying if: Project is opened.")
# open .cpp file in editor
doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.Sources.main\\.cpp", 5, 5, 0, Qt.LeftButton)
test.verify(checkIfObjectExists(":Qt Creator_CppEditor::Internal::CPPEditorWidget"),
"Verifying if: .cpp file is opened in Edit mode.")
# select some word for example "viewer" and press Ctrl+F.
editorWidget = findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
if not placeCursorToLine(editorWidget, "QmlApplicationViewer viewer;"):
invokeMenuItem("File", "Exit")
return
type(editorWidget, "<Left>")
for i in range(6):
type(editorWidget, "<Shift+Left>")
type(editorWidget, "<Ctrl+F>")
# verify if find toolbar exists and if search text contains selected word
test.verify(checkIfObjectExists(":*Qt Creator.Find_Find::Internal::FindToolBar"),
"Verifying if: Find/Replace pane is displayed at the bottom of the view.")
test.compare(waitForObject(":Qt Creator.findEdit_Utils::FilterLineEdit").displayText, "viewer",
"Verifying if: Find line edit contains 'viewer' text.")
# insert some word to "Replace with:" field and select "Replace All".
replaceEditorContent(waitForObject(":Qt Creator.replaceEdit_Utils::FilterLineEdit"), "find")
oldCodeText = str(editorWidget.plainText)
clickButton(waitForObject(":Qt Creator.Replace All_QToolButton"))
mouseClick(waitForObject(":Qt Creator.replaceEdit_Utils::FilterLineEdit"), 5, 5, 0, Qt.LeftButton)
newCodeText = str(editorWidget.plainText)
test.compare(newCodeText, oldCodeText.replace("viewer", "find").replace("Viewer", "find"),
"Verifying if: Found text is replaced with new word properly.")
# select some other word in .cpp file and select "Edit" -> "Find/Replace".
clickButton(waitForObject(":Qt Creator.CloseFind_QToolButton"))
placeCursorToLine(editorWidget, "find.setOrientation(QmlApplicationfind::ScreenOrientationAuto);")
for i in range(25):
type(editorWidget, "<Left>")
for i in range(18):
type(editorWidget, "<Shift+Left>")
invokeMenuItem("Edit", "Find/Replace", "Find/Replace")
replaceEditorContent(waitForObject(":Qt Creator.replaceEdit_Utils::FilterLineEdit"), "QmlApplicationViewer")
oldCodeText = str(editorWidget.plainText)
clickButton(waitForObject(":Qt Creator.Replace_QToolButton"))
newCodeText = str(editorWidget.plainText)
# "::" is used to replace only one occurrence by python
test.compare(newCodeText, oldCodeText.replace("QmlApplicationfind::", "QmlApplicationViewer::"),
"Verifying if: Only selected word is replaced, the rest of found words are not replaced.")
# close Find/Replace tab.
clickButton(waitForObject(":Qt Creator.CloseFind_QToolButton"))
test.verify(checkIfObjectExists(":*Qt Creator.Find_Find::Internal::FindToolBar", False),
"Verifying if: Find/Replace tab is closed.")
# exit qt creator
invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit")
# no cleanup needed, as whole testing directory gets properly removed after test finished
QT_PLATFORM_PLUGIN=nonesuch
:About Qt Creator.Close_QPushButton {text='Close' type='QPushButton' unnamed='1' visible='1' window=':About Qt Creator_Core::Internal::VersionDialog'}
:About Qt Creator.Label {text?='*Qt Creator*' type='QLabel' unnamed='1' visible='1' window=':About Qt Creator_Core::Internal::VersionDialog'}
:About Qt Creator_Core::Internal::VersionDialog {type='Core::Internal::VersionDialog' unnamed='1' visible='1' windowTitle='About Qt Creator'}
:Add Bookmark.+_QToolButton {name='toolButton' text='+' type='QToolButton' visible='1' window=':Add Bookmark_BookmarkDialog'}
:Add Bookmark.New Folder_QPushButton {name='newFolderButton' text='New Folder' type='QPushButton' visible='1' window=':Add Bookmark_BookmarkDialog'}
:Add Bookmark.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Add Bookmark_BookmarkDialog'}
:Add Bookmark.line_QFrame {name='line' type='QFrame' visible='1' window=':Add Bookmark_BookmarkDialog'}
:Add Bookmark.line_QMenu {aboveWidget=':Add Bookmark.line_QFrame' type='QMenu' unnamed='1' visible='1' window=':Add Bookmark_BookmarkDialog'}
:Add Bookmark.treeView_QTreeView {name='treeView' type='QTreeView' visible='1' window=':Add Bookmark_BookmarkDialog'}
:Add Bookmark_BookmarkDialog {name='BookmarkDialog' type='BookmarkDialog' visible='1' windowTitle='Add Bookmark'}
:Folder 1.Folder 2_QModelIndex {column='0' container=':Sample.Folder 1_QModelIndex' text='Folder 2' type='QModelIndex'}
:Folder 2.Qt Creator : Building and Running an Example_QModelIndex {column='0' container=':Folder 1.Folder 2_QModelIndex' text?='Qt Creator : Building and Running an Example*' type='QModelIndex'}
:Getting Started.Building and Running an Example_QModelIndex {column='0' container=':Qt Creator Manual*.Getting Started_QModelIndex' text='Building and Running an Example' type='QModelIndex'}
: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'}
:New Folder.Qt Creator : Qt Creator Manual_QModelIndex {column='0' container=':Sample.New Folder_QModelIndex' text='Qt Creator : Qt Creator Manual' type='QModelIndex'}
:Next_QPushButton {text~='(Next.*|Continue)' type='QPushButton' visible='1'}
:Options.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'}
:Options.qt_tabwidget_tabbar_QTabBar {name='qt_tabwidget_tabbar' type='QTabBar' visible='1' window=':Options_Core::Internal::SettingsDialog'}
:Options_Core::Internal::SettingsDialog {type='Core::Internal::SettingsDialog' unnamed='1' visible='1' windowTitle~='Options|Preferences'}
:Options_QListView {type='QListView' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'}
:Qt Creator Manual QModelIndex {column='0' container=':Qt Creator_QHelpContentWidget' text='Qt Creator Manual 2.5.1' type='QModelIndex'}
:Qt Creator Manual*.Getting Started_QModelIndex {column='0' container=':Qt Creator Manual QModelIndex' text='Getting Started' type='QModelIndex'}
:Qt Creator.+_QToolButton {text='+' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Add Bookmark_QToolButton {text='Add Bookmark' type='QToolButton' unnamed='1' 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.Search for:_QLabel {text='Search for:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Search for:_QLineEdit {leftWidget=':Qt Creator.Search for:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Search_QPushButton {text='Search' type='QPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.with all of the words:_QLabel {text='with <B>all</B> of the words:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.with all of the words:_QLineEdit {leftWidget=':Qt Creator.with all of the words:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.with at least one of the words:_QLabel {text='with <B>at least one</B> of the words:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.with at least one of the words:_QLineEdit {leftWidget=':Qt Creator.with at least one of the words:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.with exact phrase:_QLabel {text='with <B>exact phrase</B>:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.with exact phrase:_QLineEdit {leftWidget=':Qt Creator.with exact phrase:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.without the words:_QLabel {text='<B>without</B> the words:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.without the words:_QLineEdit {leftWidget=':Qt Creator.without the words:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.words similar to:_QLabel {text='words <B>similar</B> to:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.words similar to:_QLineEdit {leftWidget=':Qt Creator.words similar to:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Core::Internal::CommandComboBox {occurrence='2' type='Core::Internal::CommandComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Core::Internal::CommandComboBox_2 {type='Core::Internal::CommandComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' unnamed='1' visible='1' windowTitle?='*Qt Creator'}
:Qt Creator_Help::Internal::HelpViewer {type='Help::Internal::HelpViewer' 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_QHelpSearchQueryWidget {type='QHelpSearchQueryWidget' 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'}
:Qt Creator_TreeView {type='TreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Reference Documentation_QModelIndex {column='0' container=':Qt Creator_QHelpContentWidget' text='Qt Reference Documentation' type='QModelIndex'}
:Sample.Folder 1_QModelIndex {column='0' container=':Sample_QModelIndex' text='Folder 1' type='QModelIndex'}
:Sample.New Folder_QModelIndex {column='0' container=':Sample_QModelIndex' text?='New Folder*' type='QModelIndex'}
:Sample_QModelIndex {column='0' container=':Qt Creator_TreeView' text='Sample' type='QModelIndex'}
:addToVersionControlComboBox_QComboBox {name='addToVersionControlComboBox' type='QComboBox' visible='1'}
:treeView.Sample_QModelIndex {column='0' container=':Add Bookmark.treeView_QTreeView' text='Sample' type='QModelIndex'}
:treeView.Yes_QPushButton {container=':Add Bookmark.treeView_QTreeView' text='Yes' type='QPushButton' unnamed='1' visible='1'}
:treeView_QExpandingLineEdit {container=':Add Bookmark.treeView_QTreeView' type='QExpandingLineEdit' unnamed='1' visible='1'}
AUT=qtcreator
CLASS=
CLASSPATH=
ENVVARS=envvars
HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
TEST_CASES=tst_HELP02 tst_HELP04 tst_HELP05 tst_HELP06
VERSION=2
WRAPPERS=Qt
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
# test Qt Creator version information from file and dialog
def getQtCreatorVersionFromDialog():
chk = re.search("(?<=Qt Creator)\s\d+.\d+.\d+" , str(waitForObject(':About Qt Creator.Label' ).text))
try:
ver = chk.group(0).strip()
return ver
except:
test.fail("Failed to get the exact version from Dialog")
return ""
def getQtCreatorVersionFromFile():
qtCreatorPriFileName = "../../../../qtcreator.pri"
# open file <qtCreatorPriFileName> and read version
fileText = open(qtCreatorPriFileName, "r").read()
chk = re.search("(?<=QTCREATOR_VERSION =)\s\d+.\d+.\d+", fileText)
try:
ver = chk.group(0).strip()
return ver
except:
test.fail("Failed to get the exact version from File")
return ""
def main():
expectedVersion = getQtCreatorVersionFromFile()
if not expectedVersion:
test.fatal("Can't find version from file.")
return
startApplication("qtcreator" + SettingsPath)
if platform.system() == "Darwin":
invokeMenuItem("Help", "About Qt Creator")
else:
invokeMenuItem("Help", "About Qt Creator...")
# verify qt creator version
waitForObject(":About Qt Creator_Core::Internal::VersionDialog")
actualVersion = getQtCreatorVersionFromDialog()
test.verify(actualVersion == expectedVersion,
"Verifying if version is good. Current version is: " + actualVersion + ", expected version is: " + expectedVersion)
# close and verify about dialog closed
clickButton(waitForObject(":About Qt Creator.Close_QPushButton"))
test.verify(checkIfObjectExists(":About Qt Creator_Core::Internal::VersionDialog", False),
"Verifying if About dialog closed.")
# exit qt creator
invokeMenuItem("File", "Exit")
# verify if qt creator closed properly
test.verify(checkIfObjectExists(":Qt Creator_Core::Internal::MainWindow", False),
"Verifying if Qt Creator closed.")
# no cleanup needed
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
import re
# test search in help mode and advanced search
searchKeywordDictionary={ "deployment":True, "deplmint":False, "build":True, "bld":False }
def __getSelectedText__():
try:
selText = findObject(":Qt Creator_Help::Internal::HelpViewer").selectedText
if className(selText) != 'instancemethod':
return str(selText)
except:
pass
try:
hv = findObject(":Qt Creator_Help::Internal::HelpViewer")
selText = getHighlightsInHtml(str(hv.toHtml()))
except:
test.warning("Could not get highlighted text.")
selText = ''
return str(selText)
def __handleTextChanged__(obj):
global textHasChanged
textHasChanged = True
def getHighlightsInHtml(htmlCode):
pattern = re.compile('color:#ff0000;">(.*?)</span>')
res = ""
for curr in pattern.finditer(htmlCode):
if curr.group(1) in res:
continue
res += "%s " % curr.group(1)
test.log(res)
return res
# wait for indexing progress bar to appear and disappear
def progressBarWait():
checkIfObjectExists("{type='Core::Internal::ProgressBar' unnamed='1'}", True, 2000)
checkIfObjectExists("{type='Core::Internal::ProgressBar' unnamed='1'}", False, 60000)
def main():
global textHasChanged
noMatch = "Your search did not match any documents."
startApplication("qtcreator" + SettingsPath)
installLazySignalHandler(":Qt Creator_Help::Internal::HelpViewer", "textChanged()", "__handleTextChanged__")
addHelpDocumentationFromSDK()
# switch to help mode
switchViewTo(ViewConstants.HELP)
# verify that search widget is accessible
mouseClick(waitForObjectItem(":Qt Creator_Core::Internal::CommandComboBox_2", "Search"))
test.verify(checkIfObjectExists(":Qt Creator_QHelpSearchQueryWidget"),
"Verifying search widget visibility.")
# try to search empty string
clickButton(waitForObject(":Qt Creator.Search_QPushButton"))
progressBarWait()
test.verify(waitFor("noMatch in "
"str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 2000),
"Verifying if search did not match anything.")
# workaround for "endless waiting cursor"
mouseClick(waitForObject(":Qt Reference Documentation_QModelIndex"))
# try to search keyword from list
for searchKeyword,shouldFind in searchKeywordDictionary.items():
mouseClick(waitForObject(":Qt Creator.Search for:_QLineEdit"))
replaceEditorContent(":Qt Creator.Search for:_QLineEdit", searchKeyword)
type(waitForObject(":Qt Creator.Search for:_QLineEdit"), "<Return>")
progressBarWait()
if shouldFind:
test.verify(waitFor("re.match('[1-9]\d* - [1-9]\d* of [1-9]\d* Hits',"
"str(findObject(':Hits_QLabel').text))", 2000),
"Verifying if search results found with 1+ hits for: " + searchKeyword)
textHasChanged = False
selText = __getSelectedText__()
# click in the widget, tab to first item and press enter
mouseClick(waitForObject(":Hits_QCLuceneResultWidget"), 1, 1, 0, Qt.LeftButton)
type(waitForObject(":Hits_QCLuceneResultWidget"), "<Tab>")
type(waitForObject(":Hits_QCLuceneResultWidget"), "<Return>")
waitFor("textHasChanged or selText != __getSelectedText__()")
# verify if search keyword is found in results
test.verify(searchKeyword.lower() in __getSelectedText__().lower(),
searchKeyword + " search result can be found")
else:
test.verify(waitFor("noMatch in "
"str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 1000),
"Verifying if search did not match anything for: " + searchKeyword)
# advanced search - setup
clickButton(waitForObject(":Qt Creator.+_QToolButton"))
type(waitForObject(":Qt Creator.words similar to:_QLineEdit"), "deploy")
type(waitForObject(":Qt Creator.without the words:_QLineEdit"), "bookmark")
type(waitForObject(":Qt Creator.with exact phrase:_QLineEdit"), "sql in qt")
type(waitForObject(":Qt Creator.with all of the words:_QLineEdit"), "designer sql")
type(waitForObject(":Qt Creator.with at least one of the words:_QLineEdit"), "printing")
# advanced search - do search
clickButton(waitForObject(":Qt Creator.Search_QPushButton"))
progressBarWait()
# verify that advanced search results found
test.verify(waitFor("re.search('1 - 2 of 2 Hits',"
"str(findObject(':Hits_QLabel').text))", 3000),
"Verifying if 2 search results found")
resultsView = waitForObject(":Hits_QCLuceneResultWidget")
mouseClick(resultsView, 1, 1, 0, Qt.LeftButton)
type(resultsView, "<Tab>")
type(resultsView, "<Return>")
test.verify("printing" in str(findObject(":Qt Creator_Help::Internal::HelpViewer").selectedText).lower(),
"printing advanced search result can be found")
for i in range(2):
type(resultsView, "<Tab>")
type(resultsView, "<Return>")
test.verify("sql" in str(findObject(":Qt Creator_Help::Internal::HelpViewer").selectedText).lower(),
"sql advanced search result can be found")
# verify if simple search is properly disabled
test.verify(findObject(":Qt Creator.Search for:_QLineEdit").enabled == False,
"Verifying if simple search is not active in advanced mode.")
# exit
invokeMenuItem("File", "Exit")
# no cleanup needed
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
# test context sensitive help in edit mode
# place cursor to <lineText> keyword, in <editorArea>, and verify help to contain <helpText>
def verifyInteractiveQMLHelp(lineText, helpText):
editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
# go to the specified word
placeCursorToLine(editorArea, lineText)
homeKey = "<Home>"
if platform.system() == "Darwin":
homeKey = "<Ctrl+Left>"
type(editorArea, homeKey)
else:
type(editorArea, homeKey)
# call help
type(editorArea, "<F1>")
test.verify(helpText in str(waitForObject(":Qt Creator_Help::Internal::HelpViewer").title),
"Verifying if help is opened with documentation for '%s'." % helpText)
def main():
startApplication("qtcreator" + SettingsPath)
addHelpDocumentationFromSDK()
# create qt quick application
createNewQtQuickApplication(tempDir(), "SampleApp")
# verify Rectangle help
verifyInteractiveQMLHelp("Rectangle {", "QML Rectangle Element")
# go back to edit mode
switchViewTo(ViewConstants.EDIT)
# verify MouseArea help
verifyInteractiveQMLHelp("MouseArea {", "QML MouseArea Element")
# exit
invokeMenuItem("File","Exit")
# no cleanup needed
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
# test bookmark functionality
def renameBookmarkFolder(view, item, newName):
openItemContextMenu(view, item, 5, 5, 0)
activateItem(waitForObjectItem(":Add Bookmark.line_QMenu", "Rename Folder"))
replaceEditorContent(waitForObject(":treeView_QExpandingLineEdit"), newName)
type(waitForObject(":treeView_QExpandingLineEdit"), "<Return>")
return
def main():
startApplication("qtcreator" + SettingsPath)
# goto help mode and click on topic
switchViewTo(ViewConstants.HELP)
doubleClick(":Qt Creator Manual QModelIndex", 5, 5, 0, Qt.LeftButton)
doubleClick(":Qt Creator Manual*.Getting Started_QModelIndex", 5, 5, 0, Qt.LeftButton)
mouseClick(waitForObject(":Getting Started.Building and Running an Example_QModelIndex"), 5, 5, 0, Qt.LeftButton)
# open bookmarks window
clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton"))
clickButton(waitForObject(":Add Bookmark.+_QToolButton"))
# create root bookmark directory
clickButton(waitForObject(":Add Bookmark.New Folder_QPushButton"))
# rename root bookmark directory
bookmarkView = waitForObject(":Add Bookmark.treeView_QTreeView")
renameBookmarkFolder(bookmarkView, "New Folder*", "Sample")
# create two more subfolders
clickButton(waitForObject(":Add Bookmark.New Folder_QPushButton"))
renameBookmarkFolder(bookmarkView, "Sample.New Folder*", "Folder 1")
clickButton(waitForObject(":Add Bookmark.New Folder_QPushButton"))
renameBookmarkFolder(bookmarkView, "Sample.Folder 1.New Folder*", "Folder 2")
clickButton(waitForObject(":Add Bookmark.OK_QPushButton"))
mouseClick(":Qt Creator Manual QModelIndex", 5, 5, 0, Qt.LeftButton)
type(waitForObject(":Qt Creator_QHelpContentWidget"), "<Down>")
clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton"))
clickButton(waitForObject(":Add Bookmark.+_QToolButton"))
# click on "Sample" and create new directory under it
mouseClick(waitForObject(":treeView.Sample_QModelIndex"))