forked from qt-creator/qt-creator
SquishTests: Make suite_tools Python3 compatible
Except for tst_designer_edit which needs a bigger update. Change-Id: I8300a9491ec34b4d8deeed39f02fc59281cc20c9 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -72,7 +72,7 @@ def pasteFile(sourceFile, protocol):
|
|||||||
try:
|
try:
|
||||||
outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
|
outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
|
||||||
waitFor("re.search('^https://', str(outputWindow.plainText)) is not None", 20000)
|
waitFor("re.search('^https://', str(outputWindow.plainText)) is not None", 20000)
|
||||||
output = filter(lambda x: len(x), str(outputWindow.plainText).splitlines())[-1]
|
output = list(filter(lambda x: len(x), str(outputWindow.plainText).splitlines()))[-1]
|
||||||
except:
|
except:
|
||||||
output = ""
|
output = ""
|
||||||
if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'):
|
if closeHTTPStatusAndPasterDialog(protocol, ':Send to Codepaster_CodePaster::PasteView'):
|
||||||
@@ -126,10 +126,11 @@ def fetchSnippet(protocol, description, pasteId, skippedPasting):
|
|||||||
waitFor("pasteModel.rowCount() == 1", 1000)
|
waitFor("pasteModel.rowCount() == 1", 1000)
|
||||||
waitFor("pasteModel.rowCount() > 1", 20000)
|
waitFor("pasteModel.rowCount() > 1", 20000)
|
||||||
if pasteId == invalidPasteId(protocol):
|
if pasteId == invalidPasteId(protocol):
|
||||||
try:
|
for currentItem in dumpItems(pasteModel):
|
||||||
pasteLine = filter(lambda str:description in str, dumpItems(pasteModel))[0]
|
if description in currentItem:
|
||||||
pasteId = pasteLine.split(" ", 1)[0]
|
pasteId = currentItem.split(" ", 1)[0]
|
||||||
except:
|
break
|
||||||
|
if pasteId == invalidPasteId(protocol):
|
||||||
test.fail("Could not find description line in list of pastes from %s" % protocol)
|
test.fail("Could not find description line in list of pastes from %s" % protocol)
|
||||||
clickButton(waitForObject(":PasteSelectDialog.Cancel_QPushButton"))
|
clickButton(waitForObject(":PasteSelectDialog.Cancel_QPushButton"))
|
||||||
return pasteId
|
return pasteId
|
||||||
@@ -242,7 +243,8 @@ def main():
|
|||||||
# QString QTextCursor::selectedText () const:
|
# QString QTextCursor::selectedText () const:
|
||||||
# "Note: If the selection obtained from an editor spans a line break, the text will contain a
|
# "Note: If the selection obtained from an editor spans a line break, the text will contain a
|
||||||
# Unicode U+2029 paragraph separator character instead of a newline \n character."
|
# Unicode U+2029 paragraph separator character instead of a newline \n character."
|
||||||
selectedText = str(editor.textCursor().selectedText()).replace(unichr(0x2029), "\n")
|
newParagraph = chr(0x2029) if sys.version_info.major > 2 else unichr(0x2029)
|
||||||
|
selectedText = str(editor.textCursor().selectedText()).replace(newParagraph, "\n")
|
||||||
invokeMenuItem("Tools", "Code Pasting", "Paste Snippet...")
|
invokeMenuItem("Tools", "Code Pasting", "Paste Snippet...")
|
||||||
test.compare(waitForObject(":stackedWidget.plainTextEdit_QPlainTextEdit").plainText,
|
test.compare(waitForObject(":stackedWidget.plainTextEdit_QPlainTextEdit").plainText,
|
||||||
selectedText, "Verify that dialog shows selected text from the editor")
|
selectedText, "Verify that dialog shows selected text from the editor")
|
||||||
|
@@ -65,7 +65,8 @@ def __clickCommit__(count):
|
|||||||
# find commit
|
# find commit
|
||||||
try:
|
try:
|
||||||
# Commits are listed in reverse chronologic order, so we have to invert count
|
# Commits are listed in reverse chronologic order, so we have to invert count
|
||||||
line = filter(lambda line: line.startswith("commit"), content.splitlines())[-count].strip()
|
line = list(filter(lambda line: line.startswith("commit"),
|
||||||
|
content.splitlines()))[-count].strip()
|
||||||
commit = line.split(" ", 1)[1]
|
commit = line.split(" ", 1)[1]
|
||||||
except:
|
except:
|
||||||
test.fail("Could not find the %d. commit - leaving test" % count)
|
test.fail("Could not find the %d. commit - leaving test" % count)
|
||||||
@@ -90,7 +91,7 @@ def __clickCommit__(count):
|
|||||||
{"Committer: %s, %s" % (id, time): True}]
|
{"Committer: %s, %s" % (id, time): True}]
|
||||||
for line, exp in zip(show.splitlines(), expected):
|
for line, exp in zip(show.splitlines(), expected):
|
||||||
expLine = list(exp.keys())[0]
|
expLine = list(exp.keys())[0]
|
||||||
isRegex = exp.values()[0]
|
isRegex = list(exp.values())[0]
|
||||||
if isRegex:
|
if isRegex:
|
||||||
test.verify(re.match(expLine, line), "Verifying commit header line '%s'" % line)
|
test.verify(re.match(expLine, line), "Verifying commit header line '%s'" % line)
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user