forked from qt-creator/qt-creator
Squish: Add workaround for tst_QMLS04
Additionally added user-defined exception to JIRA class for usage inside workaround functions. Change-Id: I1f6c6c269dd93e00f69741af36c4de3324693da9 Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user