From ac430542ae24bfe5d19cdff0a0d44e6f8406527e Mon Sep 17 00:00:00 2001 From: Jan Kerekes Date: Mon, 7 May 2012 10:58:35 +0200 Subject: [PATCH 1/3] Added new test cases (QMLS06, QMLS07, QMLS08) to QMLS suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit initial commit Change-Id: I3be474d8def1161e60421030a799e297e21fc4fe Reviewed-by: Robert Löhning Reviewed-by: Christian Stenger --- tests/system/suite_QMLS/suite.conf | 2 +- tests/system/suite_QMLS/tst_QMLS06/test.py | 41 +++++++++++++++ tests/system/suite_QMLS/tst_QMLS07/test.py | 25 +++++++++ tests/system/suite_QMLS/tst_QMLS08/test.py | 60 ++++++++++++++++++++++ 4 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 tests/system/suite_QMLS/tst_QMLS06/test.py create mode 100644 tests/system/suite_QMLS/tst_QMLS07/test.py create mode 100644 tests/system/suite_QMLS/tst_QMLS08/test.py diff --git a/tests/system/suite_QMLS/suite.conf b/tests/system/suite_QMLS/suite.conf index 73de021e6d5..321ab6db4b5 100644 --- a/tests/system/suite_QMLS/suite.conf +++ b/tests/system/suite_QMLS/suite.conf @@ -5,6 +5,6 @@ ENVVARS=envvars HOOK_SUB_PROCESSES=false IMPLICITAUTSTART=0 LANGUAGE=Python -TEST_CASES=tst_QMLS01 tst_QMLS02 tst_QMLS03 tst_QMLS04 tst_QMLS05 +TEST_CASES=tst_QMLS01 tst_QMLS02 tst_QMLS03 tst_QMLS04 tst_QMLS05 tst_QMLS06 tst_QMLS07 tst_QMLS08 VERSION=2 WRAPPERS=Qt diff --git a/tests/system/suite_QMLS/tst_QMLS06/test.py b/tests/system/suite_QMLS/tst_QMLS06/test.py new file mode 100644 index 00000000000..61cc9165191 --- /dev/null +++ b/tests/system/suite_QMLS/tst_QMLS06/test.py @@ -0,0 +1,41 @@ +source("../shared/qmls.py") + +def main(): + editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "}") + if not editorArea: + return + type(editorArea, "") + testingItemText = "Item { x: 10; y: 20; width: 10 }" + type(editorArea, testingItemText) + for i in range(30): + type(editorArea, "") + invokeMenuItem("File", "Save All") + # invoke Refactoring - Wrap Component in Loader + numLinesExpected = len(str(editorArea.plainText).splitlines()) + 10 + ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) + activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring")) + activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Wrap Component in Loader")) + # wait until refactoring ended + waitFor("len(str(editorArea.plainText).splitlines()) >= numLinesExpected", 5000) + # verify if refactoring was properly applied + verifyMessage = "Verifying wrap component in loader functionality at element line." + type(editorArea, "") + type(editorArea, "") + verifyCurrentLine(editorArea, "Component {", verifyMessage) + type(editorArea, "") + verifyCurrentLine(editorArea, "id: component_Item", verifyMessage) + type(editorArea, "") + verifyCurrentLine(editorArea, testingItemText, verifyMessage) + type(editorArea, "") + verifyCurrentLine(editorArea, "}", verifyMessage) + type(editorArea, "") + verifyCurrentLine(editorArea, "Loader {", verifyMessage) + type(editorArea, "") + verifyCurrentLine(editorArea, "id: loader_Item", verifyMessage) + type(editorArea, "") + verifyCurrentLine(editorArea, "sourceComponent: component_Item", verifyMessage) + type(editorArea, "") + verifyCurrentLine(editorArea, "}", verifyMessage) + # save and exit + invokeMenuItem("File", "Save All") + invokeMenuItem("File", "Exit") diff --git a/tests/system/suite_QMLS/tst_QMLS07/test.py b/tests/system/suite_QMLS/tst_QMLS07/test.py new file mode 100644 index 00000000000..ff149e49296 --- /dev/null +++ b/tests/system/suite_QMLS/tst_QMLS07/test.py @@ -0,0 +1,25 @@ +source("../shared/qmls.py") + +def main(): + editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp", "Rectangle {") + if not editorArea: + return + type(editorArea, "") + type(editorArea, "Color") + for i in range(3): + type(editorArea, "") + invokeMenuItem("File", "Save All") + # invoke Refactoring - Add a message suppression comment. + numLinesExpected = len(str(editorArea.plainText).splitlines()) + 1 + ctxtMenu = openContextMenuOnTextCursorPosition(editorArea) + activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring")) + activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Add a comment to suppress this message")) + # wait until refactoring ended + waitFor("len(str(editorArea.plainText).splitlines()) >= numLinesExpected", 5000) + # verify if refactoring was properly applied + type(editorArea, "") + test.compare(str(lineUnderCursor(editorArea)).strip(), "// @disable-check M16", + "Verifying 'Add comment to suppress message' refactoring") + # save and exit + invokeMenuItem("File", "Save All") + invokeMenuItem("File", "Exit") diff --git a/tests/system/suite_QMLS/tst_QMLS08/test.py b/tests/system/suite_QMLS/tst_QMLS08/test.py new file mode 100644 index 00000000000..a505f0fd0f8 --- /dev/null +++ b/tests/system/suite_QMLS/tst_QMLS08/test.py @@ -0,0 +1,60 @@ +source("../shared/qmls.py") + +def verifyNextLineIndented(editorArea, expectedIndentation): + type(editorArea, "") + rawLine = str(lineUnderCursor(editorArea)) + indentedLine = rawLine.rstrip() + # handle special case if line has only whitespaces inside + if not indentedLine: + indentedLine = rawLine + unindentedLine = indentedLine.lstrip() + numSpaces = len(indentedLine) - len(unindentedLine) + # verify if indentation is valid (multiply of 4) and if has correct depth level + test.compare(numSpaces % 4, 0, "Verifying indentation spaces") + test.compare(numSpaces / 4, expectedIndentation, "Verifying indentation level") + +def verifyIndentation(editorArea): + #verify indentation + if not placeCursorToLine(editorArea, "id: rect"): + invokeMenuItem("File", "Save All") + invokeMenuItem("File", "Exit") + return False + type(editorArea, "") + expectedIndentations = [1,1,1,2,2,2,2,3,3,3,4,3,3,2,1] + for indentation in expectedIndentations: + verifyNextLineIndented(editorArea, indentation) + return True + +def main(): + editorArea = startQtCreatorWithNewAppAtQMLEditor(tempDir(), "SampleApp") + if not editorArea: + return + # prepare code for test - insert unindented code + lines = ['id: rect', 'property bool random: true', 'Text{', + 'anchors.bottom:parent.bottom', 'text: rect.random ? getRandom() : "I\'m fixed."', + '', 'function getRandom(){', 'var result="I\'m random: ";', + 'var chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";', + 'for(var i=0;i<8;++i)', 'result += chars.charAt(Math.floor(Math.random() * chars.length));', + 'return result + ".";'] + if not placeCursorToLine(editorArea, "Rectangle {"): + invokeMenuItem("File", "Exit") + return + type(editorArea, "") + typeLines(editorArea, lines) + # verify default indentation + if not verifyIndentation(editorArea): + return + # cancel indentation + type(editorArea, "") + for i in range(5): + type(editorArea, "") + # select unindented block + type(editorArea, "") + # do indentation + type(editorArea, "") + # verify invoked indentation + if not verifyIndentation(editorArea): + return + # save and exit + invokeMenuItem("File", "Save All") + invokeMenuItem("File", "Exit") From d7c9f3debaa20f6f68f2a2c689948b18b4cca9c2 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Mon, 14 May 2012 14:07:34 +0200 Subject: [PATCH 2/3] CMake: Fix crash in makestep if used in the deploystep list Task-number: QTCREATORBUG-7427 Change-Id: I8cc1e49e87d38c1a789bf3dee25b62668efc433d Reviewed-by: Tobias Hunger --- src/plugins/cmakeprojectmanager/makestep.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/makestep.cpp b/src/plugins/cmakeprojectmanager/makestep.cpp index 524ba5548a5..a5eb910e602 100644 --- a/src/plugins/cmakeprojectmanager/makestep.cpp +++ b/src/plugins/cmakeprojectmanager/makestep.cpp @@ -132,6 +132,8 @@ bool MakeStep::fromMap(const QVariantMap &map) bool MakeStep::init() { CMakeBuildConfiguration *bc = cmakeBuildConfiguration(); + if (!bc) + bc = static_cast(target()->activeBuildConfiguration()); QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets); Utils::QtcProcess::addArgs(&arguments, additionalArguments()); From 1f435bcbce3112e0e764b9f6190a7f6182ef4558 Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Tue, 15 May 2012 19:54:12 +1000 Subject: [PATCH 3/3] SVN: Fix project status command when no document open The SVN project status command is using currentFileTopLevel() for the working directory when it should be using currentProjectTopLevel(). If no document is open, currentFileTopLevel() will return an empty string which means the current working directory of Qt Creator is used. Change-Id: I848b1adf7166836c5d15e88796af77f8700a43f2 Reviewed-by: Tobias Hunger (cherry picked from commit 82a821fc9b7d0770db15dda0db538966beefd695) --- src/plugins/subversion/subversionplugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 2e63152bca1..b5dcaab70a6 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -1014,7 +1014,7 @@ void SubversionPlugin::projectStatus() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasProject(), return); - svnStatus(state.currentFileTopLevel(), state.relativeCurrentProject()); + svnStatus(state.currentProjectTopLevel(), state.relativeCurrentProject()); } void SubversionPlugin::describe(const QString &source, const QString &changeNr)