forked from qt-creator/qt-creator
Squish: Small fix and improvement for indent test
Change-Id: Ib34050986433bf9010da2e8cf71fe6651559c015 Reviewed-by: Bill King <bill.king@nokia.com> Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
This commit is contained in:
@@ -43,11 +43,10 @@ def prepareQmlFile():
|
|||||||
originalText = "%s" % editor.plainText
|
originalText = "%s" % editor.plainText
|
||||||
indented = editor.plainText
|
indented = editor.plainText
|
||||||
unindented = ""
|
unindented = ""
|
||||||
lines = str(indented).split("\n")
|
lines = str(indented).splitlines()
|
||||||
test.log("Using %d lines..." % len(lines))
|
test.log("Using %d lines..." % len(lines))
|
||||||
for line in lines:
|
for line in lines:
|
||||||
unindented += line.lstrip()+"\n"
|
unindented += line.lstrip()+"\n"
|
||||||
unindented=unindented[0:-1]
|
|
||||||
editor.plainText = unindented
|
editor.plainText = unindented
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -63,11 +62,13 @@ def testReIndent():
|
|||||||
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
"window=':Qt Creator_Core::Internal::MainWindow'}")
|
||||||
type(editor, "<Ctrl+A>")
|
type(editor, "<Ctrl+A>")
|
||||||
test.log("calling re-indent")
|
test.log("calling re-indent")
|
||||||
|
starttime = datetime.utcnow()
|
||||||
type(editor, "<Ctrl+I>")
|
type(editor, "<Ctrl+I>")
|
||||||
waitFor("textHasChanged==True", 20000)
|
waitFor("textHasChanged==True", 25000)
|
||||||
|
endtime = datetime.utcnow()
|
||||||
textAfterReIndent = "%s" % editor.plainText
|
textAfterReIndent = "%s" % editor.plainText
|
||||||
if originalText==textAfterReIndent:
|
if originalText==textAfterReIndent:
|
||||||
test.passes("Text successfully reindented...")
|
test.passes("Text successfully re-indented within %d seconds" % (endtime-starttime).seconds)
|
||||||
else:
|
else:
|
||||||
# shrink the texts - it's huge output that takes long time to finish & screenshot is taken as well
|
# shrink the texts - it's huge output that takes long time to finish & screenshot is taken as well
|
||||||
originalText = shrinkText(originalText, 20)
|
originalText = shrinkText(originalText, 20)
|
||||||
|
Reference in New Issue
Block a user