summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/system/shared/workarounds.py53
-rw-r--r--tests/system/suite_QMLS/tst_QMLS04/test.py20
2 files changed, 64 insertions, 9 deletions
diff --git a/tests/system/shared/workarounds.py b/tests/system/shared/workarounds.py
index 961c57fab4..7c8d2ddc75 100644
--- a/tests/system/shared/workarounds.py
+++ b/tests/system/shared/workarounds.py
@@ -64,6 +64,13 @@ JIRA_URL='https://bugreports.qt-project.org/browse'
class JIRA:
__instance__ = None
+ # internal exception to be used inside workaround functions (lack of having return values)
+ class JiraException(Exception):
+ def __init__(self, value):
+ self.value = value
+ def __str__(self):
+ return repr(self.value)
+
# Helper class
class Bug:
CREATOR = 'QTCREATORBUG'
@@ -117,7 +124,15 @@ class JIRA:
functionToCall = JIRA.getInstance().__bugs__.get("%s-%d" % (bugType, number), None)
if functionToCall:
test.warning("Using workaround for %s-%d" % (bugType, number))
- functionToCall(*args)
+ try:
+ functionToCall(*args)
+ except:
+ t, v = sys.exc_info()[0:2]
+ if t == JIRA.JiraException:
+ raise JIRA.JiraException(v)
+ else:
+ test.warning("Exception caught while executing workaround function.",
+ "%s (%s)" % (str(t), str(v)))
return True
else:
JIRA.getInstance()._exitFatal_(bugType, number)
@@ -245,6 +260,7 @@ class JIRA:
def __initBugDict__(self):
self.__bugs__= {
'QTCREATORBUG-6853':self._workaroundCreator6853_,
+ 'QTCREATORBUG-11548':self._workaroundCreator11548_
}
# helper function - will be called if no workaround for the requested bug is deposited
def _exitFatal_(self, bugType, number):
@@ -255,3 +271,38 @@ class JIRA:
def _workaroundCreator6853_(self, *args):
if "Release" in args[0] and platform.system() == "Linux":
snooze(2)
+
+ def _workaroundCreator11548_(self, *args):
+ if len(args) != 3:
+ test.fatal("Need 3 arguments (project directory, project name, path to the file to "
+ "be added to the qrc file) to perform workaround.")
+ raise JIRA.JiraException("Wrong invocation of _workaroundCreator11548_().")
+ (pDir, pName, fPath) = args
+ try:
+ selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Projects")
+ navigator = waitForObject(":Qt Creator_Utils::NavigationTreeView")
+ try:
+ openItemContextMenu(navigator, "%s.Resources.qml\.qrc" % pName, 5, 5, 0)
+ except:
+ treeElement = addBranchWildcardToRoot("%s.Resources.qml\.qrc" % pName)
+ openItemContextMenu(navigator, treeElement, 5, 5, 0)
+ if platform.system() == 'Darwin':
+ waitFor("macHackActivateContextMenuItem('Add Existing Files...')", 6000)
+ else:
+ activateItem(waitForObjectItem(":Qt Creator.Project.Menu.Folder_QMenu",
+ "Add Existing Files..."))
+ selectFromFileDialog(fPath)
+ # handle version control if necessary
+ try:
+ dlg = ("{name='Core__Internal__AddToVcsDialog' type='Core::Internal::AddToVcsDialog' "
+ "visible='1' windowTitle='Add to Version Control'}")
+ waitForObject(dlg, 3000)
+ clickButton(waitForObject("{text='No' type='QPushButton' unnamed='1' "
+ "visible='1' window=%s}" % dlg))
+ except:
+ pass
+ # known issue with running inside Squish
+ setWindowState(waitForObject(":Qt Creator_Core::Internal::MainWindow"), WindowState.Normal)
+ except:
+ test.fatal("Failed to perform workaround for QTCREATORBUG-11548")
+ raise JIRA.JiraException("Failed to perform workaround for QTCREATORBUG-11548")
diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py
index 305c1e9568..123da338d8 100644
--- a/tests/system/suite_QMLS/tst_QMLS04/test.py
+++ b/tests/system/suite_QMLS/tst_QMLS04/test.py
@@ -56,8 +56,8 @@ def main():
test.passes("Refactoring was properly applied in source file")
else:
test.fail("Refactoring of Text to MyComponent failed in source file. Content of editor:\n%s" % codeText)
- myCompTE = "SampleApp.QML.qml.MyComponent\\.qml"
- appeared = False
+ myCompTE = "SampleApp.Resources.qml\\.qrc./.qml/MyComponent\\.qml"
+ filePath = os.path.join(projectDir, "SampleApp", "qml", "MyComponent.qml")
# there should be new QML file generated with name "MyComponent.qml"
try:
waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", myCompTE, 3000)
@@ -65,10 +65,15 @@ def main():
try:
waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", addBranchWildcardToRoot(myCompTE), 1000)
except:
- test.fail("Refactoring failed - file MyComponent.qml was not generated properly in project explorer")
- #save and exit
- invokeMenuItem("File", "Save All")
- invokeMenuItem("File", "Exit")
+ test.xverify(False, "Refactoring failed - file MyComponent.qml was not generated "
+ "properly in project explorer (QTCREATORBUG-11548")
+ try:
+ JIRA.performWorkaroundForBug(11548, JIRA.Bug.CREATOR, projectDir, "SampleApp", filePath)
+ except JIRA.JiraException:
+ #save and exit
+ invokeMenuItem("File", "Save All")
+ invokeMenuItem("File", "Exit")
+ return
test.passes("Refactoring - file MyComponent.qml was generated properly in project explorer")
# open MyComponent.qml file for verification
if not openDocument(myCompTE):
@@ -86,7 +91,6 @@ def main():
#save and exit
invokeMenuItem("File", "Save All")
# check if new file was created in file system
- test.verify(os.path.exists(projectDir + "/SampleApp/qml/MyComponent.qml"),
+ test.verify(os.path.exists(filePath),
"Verifying if MyComponent.qml exists in file system after save")
invokeMenuItem("File", "Exit")
-