summaryrefslogtreecommitdiff
path: root/tests/system
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-07-25 13:18:31 +0200
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-07-25 13:18:31 +0200
commit6896546ba5a6ae59416fe4f527294ba731235218 (patch)
treeb5b5c8b554f6dcdf391459d996100dbb265e55d1 /tests/system
parente2ce17ef00218af3db35118b036ebf19834b86e8 (diff)
parent1dd9a54ab63d267268b6262b11c7b0189370f174 (diff)
downloadqt-creator-6896546ba5a6ae59416fe4f527294ba731235218.tar.gz
Merge remote-tracking branch 'origin/2.8'
Conflicts: src/plugins/cpptools/cppmodelmanager.cpp Change-Id: I0e69dfad951eb81d8008f5ca05e8fb6999ae2c8a
Diffstat (limited to 'tests/system')
-rw-r--r--tests/system/objects.map1
-rw-r--r--tests/system/shared/build_utils.py27
-rwxr-xr-xtests/system/suite_APTW/shared/aptw.py59
-rw-r--r--tests/system/suite_APTW/tst_APTW01/test.py1
-rw-r--r--tests/system/suite_APTW/tst_APTW02/test.py1
-rw-r--r--tests/system/suite_tools/suite.conf2
-rw-r--r--tests/system/suite_tools/tst_designer_autocomplete/test.py75
-rwxr-xr-xtests/system/tools/findUnusedObjects.py37
8 files changed, 124 insertions, 79 deletions
diff --git a/tests/system/objects.map b/tests/system/objects.map
index 795411c158..c70178fb8e 100644
--- a/tests/system/objects.map
+++ b/tests/system/objects.map
@@ -67,6 +67,7 @@
:FormEditorStack.PushButton_QPushButton {container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack' name='pushButton' text='PushButton' type='QPushButton' visible='1'}
:FormEditorStack.centralWidget_QDesignerWidget {container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack' name='centralWidget' type='QDesignerWidget' visible='1'}
:FormEditorStack_qdesigner_internal::FormWindow {container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack' type='qdesigner_internal::FormWindow' unnamed='1' visible='1'}
+:FormEditorStack_qdesigner_internal::PropertyLineEdit {container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack' type='qdesigner_internal::PropertyLineEdit' unnamed='1' visible='1'}
:Generator:_QComboBox {buddy=':CMake Wizard.Generator:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:Go to slot.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Go to slot_QDialog'}
:Go to slot.Select signal_QGroupBox {name='groupBox' title='Select signal' type='QGroupBox' visible='1' window=':Go to slot_QDialog'}
diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py
index b9ac5b1610..4fbfd313ab 100644
--- a/tests/system/shared/build_utils.py
+++ b/tests/system/shared/build_utils.py
@@ -225,3 +225,30 @@ def verifyBuildConfig(targetCount, currentTarget, shouldBeDebug=False, enableSha
pass
clickButton(waitForObject(":scrollArea.Details_Utils::DetailsButton"))
switchViewTo(ViewConstants.EDIT)
+
+# verify if building and running of project was successful
+def verifyBuildAndRun():
+ # check compile output if build successful
+ checkCompile()
+ # check application output log
+ appOutput = logApplicationOutput()
+ if appOutput:
+ test.verify(re.search(".* exited with code \d+", str(appOutput)) and
+ re.search('[Ss]tarting.*', str(appOutput)),
+ "Verifying if built app started and closed successfully.")
+
+# run project for debug and release
+def runVerify(checkedTargets):
+ availableConfigs = iterateBuildConfigs(len(checkedTargets))
+ if not availableConfigs:
+ test.fatal("Haven't found build configurations, quitting")
+ invokeMenuItem("File", "Save All")
+ invokeMenuItem("File", "Exit")
+ # select debug configuration
+ for kit, config in availableConfigs:
+ selectBuildConfig(len(checkedTargets), kit, config)
+ test.log("Using build config '%s'" % config)
+ if not runAndCloseApp():
+ return
+ verifyBuildAndRun()
+ mouseClick(waitForObject(":*Qt Creator.Clear_QToolButton"))
diff --git a/tests/system/suite_APTW/shared/aptw.py b/tests/system/suite_APTW/shared/aptw.py
deleted file mode 100755
index 449924bc37..0000000000
--- a/tests/system/suite_APTW/shared/aptw.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-## Contact: http://www.qt-project.org/legal
-##
-## This file is part of Qt Creator.
-##
-## Commercial License Usage
-## Licensees holding valid commercial Qt licenses may use this file in
-## accordance with the commercial license agreement provided with the
-## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and Digia. For licensing terms and
-## conditions see http://qt.digia.com/licensing. For further information
-## use the contact form at http://qt.digia.com/contact-us.
-##
-## GNU Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 2.1 as published by the Free Software
-## Foundation and appearing in the file LICENSE.LGPL included in the
-## packaging of this file. Please review the following information to
-## ensure the GNU Lesser General Public License version 2.1 requirements
-## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-##
-## In addition, as a special exception, Digia gives you certain additional
-## rights. These rights are described in the Digia Qt LGPL Exception
-## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-##
-#############################################################################
-
-# shared script for APTW suite
-# helping to run and close app
-# verification
-
-# verify if building and running of project was successful
-def verifyBuildAndRun():
- # check compile output if build successful
- checkCompile()
- # check application output log
- appOutput = logApplicationOutput()
- if appOutput:
- test.verify(re.search(".* exited with code \d+", str(appOutput)) and
- re.search('[Ss]tarting.*', str(appOutput)),
- "Verifying if built app started and closed successfully.")
-
-# run project for debug and release
-def runVerify(checkedTargets):
- availableConfigs = iterateBuildConfigs(len(checkedTargets))
- if not availableConfigs:
- test.fatal("Haven't found build configurations, quitting")
- invokeMenuItem("File", "Save All")
- invokeMenuItem("File", "Exit")
- # select debug configuration
- for kit, config in availableConfigs:
- selectBuildConfig(len(checkedTargets), kit, config)
- test.log("Using build config '%s'" % config)
- if not runAndCloseApp():
- return
- verifyBuildAndRun()
- mouseClick(waitForObject(":*Qt Creator.Clear_QToolButton"))
diff --git a/tests/system/suite_APTW/tst_APTW01/test.py b/tests/system/suite_APTW/tst_APTW01/test.py
index 6f9cff4aed..7799d009e8 100644
--- a/tests/system/suite_APTW/tst_APTW01/test.py
+++ b/tests/system/suite_APTW/tst_APTW01/test.py
@@ -29,7 +29,6 @@
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
-source("../shared/aptw.py")
# test New Qt Gui Application build and run for release and debug option
def main():
diff --git a/tests/system/suite_APTW/tst_APTW02/test.py b/tests/system/suite_APTW/tst_APTW02/test.py
index f77b33336d..fcab9592d9 100644
--- a/tests/system/suite_APTW/tst_APTW02/test.py
+++ b/tests/system/suite_APTW/tst_APTW02/test.py
@@ -29,7 +29,6 @@
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
-source("../shared/aptw.py")
# test New Qt Quick Application build and run for release and debug option
def main():
diff --git a/tests/system/suite_tools/suite.conf b/tests/system/suite_tools/suite.conf
index 8a0230c0e3..6363d78f1e 100644
--- a/tests/system/suite_tools/suite.conf
+++ b/tests/system/suite_tools/suite.conf
@@ -7,6 +7,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAP=../objects.map
-TEST_CASES=tst_designer_goto_slot
+TEST_CASES=tst_designer_autocomplete tst_designer_goto_slot
VERSION=2
WRAPPERS=Qt
diff --git a/tests/system/suite_tools/tst_designer_autocomplete/test.py b/tests/system/suite_tools/tst_designer_autocomplete/test.py
new file mode 100644
index 0000000000..e8c7ce5c1c
--- /dev/null
+++ b/tests/system/suite_tools/tst_designer_autocomplete/test.py
@@ -0,0 +1,75 @@
+#############################################################################
+##
+## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+## Contact: http://www.qt-project.org/legal
+##
+## This file is part of Qt Creator.
+##
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and Digia. For licensing terms and
+## conditions see http://qt.digia.com/licensing. For further information
+## use the contact form at http://qt.digia.com/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Digia gives you certain additional
+## rights. These rights are described in the Digia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+#############################################################################
+
+source("../../shared/qtcreator.py")
+
+def main():
+ startApplication("qtcreator" + SettingsPath)
+ if not startedWithoutPluginError():
+ return
+ createProject_Qt_GUI(tempDir(), "DesignerTestApp")
+ selectFromLocator("mainwindow.ui")
+ dragAndDrop(waitForObject("{container=':qdesigner_internal::WidgetBoxCategoryListView'"
+ "text='Push Button' type='QModelIndex'}"), 5, 5,
+ ":FormEditorStack_qdesigner_internal::FormWindow", 20, 50, Qt.CopyAction)
+ for buttonName in [None, "aDifferentName", "anotherDifferentName", "pushButton"]:
+ if buttonName:
+ openContextMenu(waitForObject("{container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack'"
+ "text='PushButton' type='QPushButton' visible='1'}"), 5, 5, 1)
+ activateItem(waitForObjectItem("{type='QMenu' unnamed='1' visible='1'}", "Change objectName..."))
+ typeLines(waitForObject(":FormEditorStack_qdesigner_internal::PropertyLineEdit"), buttonName)
+ else:
+ # Verify that everything works without ever changing the name
+ buttonName = "pushButton"
+ selectFromLocator("mainwindow.cpp")
+ editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
+ for tryDotOperator in [False, True]:
+ if not placeCursorToLine(editor, "ui->setupUi(this);"):
+ earlyExit("Maybe the project template changed.")
+ return
+ type(editor, "<Return>")
+ type(editor, "ui")
+ if tryDotOperator:
+ snooze(1)
+ type(editor, ".")
+ waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500)
+ else:
+ type(editor, "-")
+ snooze(1)
+ type(editor, ">")
+ nativeType("%s" % buttonName[0])
+ test.verify(waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500),
+ "Verify that GenericProposalWidget is being shown.")
+ nativeType("<Return>")
+ test.verify(waitFor('str(lineUnderCursor(editor)).strip() == "ui->%s" % buttonName', 1000),
+ 'Comparing line "%s" to expected "%s"' % (lineUnderCursor(editor), "ui->%s" % buttonName))
+ type(editor, "<Shift+Delete>") # Delete line
+ selectFromLocator("mainwindow.ui")
+ invokeMenuItem("File", "Save All")
+ invokeMenuItem("File", "Exit")
diff --git a/tests/system/tools/findUnusedObjects.py b/tests/system/tools/findUnusedObjects.py
index ada182b9c9..d79e31ea31 100755
--- a/tests/system/tools/findUnusedObjects.py
+++ b/tests/system/tools/findUnusedObjects.py
@@ -40,17 +40,11 @@ lastToken = [None, None]
stopTokens = ('OP', 'NAME', 'NUMBER', 'ENDMARKER')
def parseCommandLine():
- global directory, onlyRemovable, fileType
- scriptChoice = ('Python', 'JavaScript', 'Perl', 'Tcl', 'Ruby')
+ global directory, onlyRemovable
parser = OptionParser("\n%prog [OPTIONS] [DIRECTORY]")
parser.add_option("-o", "--only-removable", dest="onlyRemovable",
action="store_true", default=False,
help="list removable objects only")
- parser.add_option("-t", "--type", dest='fileType', type="choice",
- choices=scriptChoice,
- default='Python', nargs=1, metavar='LANG',
- help="script language of the Squish tests (" +
- ", ".join(scriptChoice) + "; default: %default)")
(options, args) = parser.parse_args()
if len(args) == 0:
directory = os.path.abspath(".")
@@ -61,19 +55,12 @@ def parseCommandLine():
parser.print_help()
sys.exit(1)
onlyRemovable = options.onlyRemovable
- fileType = options.fileType
def collectObjects():
global objMap
data = getFileContent(objMap)
return map(lambda x: x.strip().split("\t", 1)[0], data.strip().splitlines())
-def getFileSuffix():
- global fileType
- fileSuffixes = {'Python':'.py', 'JavaScript':'.js', 'Perl':'.pl',
- 'Tcl':'.tcl', 'Ruby':'.rb'}
- return fileSuffixes.get(fileType, None)
-
def handleStringsWithTrailingBackSlash(origStr):
try:
while True:
@@ -101,13 +88,29 @@ def handle_token(tokenType, token, (startRow, startCol), (endRow, endCol), line)
# store the stop token as lastToken
lastToken = [tokenize.tok_name[tokenType], str(token)]
+def handleDataFiles(openFile, separator):
+ global useCounts
+ # ignore header line
+ openFile.readline()
+ for line in openFile:
+ currentTokens = line.split(separator)
+ for token in currentTokens:
+ stripped = token.strip().strip('"')
+ if stripped in useCounts:
+ useCounts[stripped] = useCounts[stripped] + 1
+
def findUsages():
global directory, objMap
- suffix = getFileSuffix()
+ suffixes = (".py", ".csv", ".tsv")
for root, dirnames, filenames in os.walk(directory):
- for filename in filter(lambda x: x.endswith(suffix), filenames):
+ for filename in filter(lambda x: x.endswith(suffixes), filenames):
currentFile = open(os.path.join(root, filename))
- tokenize.tokenize(currentFile.readline, handle_token)
+ if filename.endswith(".py"):
+ tokenize.tokenize(currentFile.readline, handle_token)
+ elif filename.endswith(".csv"):
+ handleDataFiles(currentFile, ",")
+ elif filename.endswith(".tsv"):
+ handleDataFiles(currentFile, "\t")
currentFile.close()
currentFile = open(objMap)
tokenize.tokenize(currentFile.readline, handle_token)