forked from qt-creator/qt-creator
Squish: Prepare tst_simple_analyze for Qt5
Change-Id: I91caa064e002cc2ab409ec9b1c30ec57c1adb5a9 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -33,13 +33,6 @@ def checkSyntaxError(issuesView, expectedTextsArray, warnIfMoreIssues = True):
|
||||
return True
|
||||
return False
|
||||
|
||||
# wait and verify if object exists/not exists
|
||||
def checkIfObjectExists(name, shouldExist = True, timeout = 3000, verboseOnFail = False):
|
||||
result = waitFor("object.exists(name) == shouldExist", timeout)
|
||||
if verboseOnFail and not result:
|
||||
test.log("checkIfObjectExists() failed for '%s'" % name)
|
||||
return result
|
||||
|
||||
# change autocomplete options to manual
|
||||
def changeAutocompleteToManual():
|
||||
invokeMenuItem("Tools", "Options...")
|
||||
|
@@ -601,3 +601,15 @@ def writeTestResults(folder):
|
||||
for cat in categories:
|
||||
resultFile.write("%s:%d\n" % (cat, test.resultCount(cat)))
|
||||
resultFile.close()
|
||||
|
||||
# wait and verify if object exists/not exists
|
||||
def checkIfObjectExists(name, shouldExist = True, timeout = 3000, verboseOnFail = False):
|
||||
result = waitFor("object.exists(name) == shouldExist", timeout)
|
||||
if verboseOnFail and not result:
|
||||
test.log("checkIfObjectExists() failed for '%s'" % name)
|
||||
return result
|
||||
|
||||
# wait for progress bar(s) to appear and disappear
|
||||
def progressBarWait():
|
||||
checkIfObjectExists("{type='Core::Internal::ProgressBar' unnamed='1'}", True, 2000)
|
||||
checkIfObjectExists("{type='Core::Internal::ProgressBar' unnamed='1'}", False, 60000)
|
||||
|
@@ -34,11 +34,6 @@ def getHighlightsInHtml(htmlCode):
|
||||
test.log(res)
|
||||
return res
|
||||
|
||||
# wait for indexing progress bar to appear and disappear
|
||||
def progressBarWait():
|
||||
checkIfObjectExists("{type='Core::Internal::ProgressBar' unnamed='1'}", True, 2000)
|
||||
checkIfObjectExists("{type='Core::Internal::ProgressBar' unnamed='1'}", False, 60000)
|
||||
|
||||
def main():
|
||||
global textHasChanged
|
||||
noMatch = "Your search did not match any documents."
|
||||
|
@@ -26,8 +26,9 @@ def main():
|
||||
if not availableConfigs:
|
||||
test.fatal("Haven't found a suitable Qt version (need Qt 4.7.4) - leaving without debugging.")
|
||||
for kit, config in availableConfigs:
|
||||
test.log("Selecting '%s' as build config" % config)
|
||||
selectBuildConfig(len(checkedTargets), kit, config)
|
||||
qtVersion = selectBuildConfig(len(checkedTargets), kit, config)[0]
|
||||
test.log("Selected kit using Qt %s" % qtVersion)
|
||||
progressBarWait() # progress bars move buttons
|
||||
verifyBuildConfig(len(checkedTargets), kit, True, enableQmlDebug=True)
|
||||
# explicitly build before start debugging for adding the executable as allowed program to WinFW
|
||||
invokeMenuItem("Build", "Rebuild All")
|
||||
@@ -53,21 +54,41 @@ def main():
|
||||
if safeClickTab("Events"):
|
||||
model = waitForObject(":Events.QmlProfilerEventsTable_QmlProfiler::"
|
||||
"Internal::QmlProfilerEventsMainView").model()
|
||||
test.compare(model.rowCount(), 2) # Only two lines with Qt 4.7, more with Qt 4.8
|
||||
test.compare(dumpItems(model, column=0), ['<program>', 'main.qml:14'])
|
||||
test.compare(dumpItems(model, column=1), ['Binding', 'Signal'])
|
||||
test.compare(dumpItems(model, column=2), ['100.00 %', '100.00 %'])
|
||||
test.compare(dumpItems(model, column=4), ['1', '2'])
|
||||
test.compare(dumpItems(model, column=9), ['Main Program', 'triggered(): { var i; for (i = 1; i < 2500; ++i) '
|
||||
'{ var j = i * i; console.log(j); } }'])
|
||||
for i in [3, 5, 6, 7]:
|
||||
for item in dumpItems(model, column=i):
|
||||
test.verify(item.endswith(' ms'))
|
||||
if qtVersion.startswith("5."):
|
||||
compareEventsTab(model, "events_qt50.tsv")
|
||||
else:
|
||||
compareEventsTab(model, "events_qt47.tsv")
|
||||
test.verify(str(model.index(0, 8).data()).endswith(' ms'))
|
||||
test.xverify(str(model.index(1, 8).data()).endswith(' ms')) # QTCREATORBUG-8996
|
||||
test.compare(dumpItems(model, column=2)[0], '100.00 %')
|
||||
for i in [3, 5, 6, 7]:
|
||||
for item in dumpItems(model, column=i)[:4]:
|
||||
test.verify(item.endswith(' ms'))
|
||||
deleteAppFromWinFW(workingDir, projectName, False)
|
||||
invokeMenuItem("File", "Exit")
|
||||
|
||||
def compareEventsTab(model, file):
|
||||
significantColumns = [0, 1, 4, 9]
|
||||
|
||||
expectedTable = []
|
||||
for record in testData.dataset(file):
|
||||
expectedTable.append([testData.field(record, str(col)) for col in significantColumns])
|
||||
foundTable = []
|
||||
for row in range(model.rowCount()):
|
||||
foundTable.append([str(model.index(row, col).data()) for col in significantColumns])
|
||||
|
||||
test.compare(model.rowCount(), len(expectedTable),
|
||||
"Checking number of rows in Events table")
|
||||
if not test.verify(containsOnce(expectedTable, foundTable),
|
||||
"Verifying that Events table matches expected values"):
|
||||
test.log("Events displayed by Creator: %s" % foundTable)
|
||||
|
||||
def containsOnce(tuple, items):
|
||||
for item in items:
|
||||
if tuple.count(item) != 1:
|
||||
return False
|
||||
return True
|
||||
|
||||
def safeClickTab(tab):
|
||||
for bar in [":*Qt Creator.JavaScript_QTabBar",
|
||||
":*Qt Creator.Events_QTabBar"]:
|
||||
|
3
tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt47.tsv
vendored
Normal file
3
tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt47.tsv
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"0" "1" "4" "9"
|
||||
"<program>" "Binding" "1" "Main Program"
|
||||
"main.qml:14" "Signal" "2" "triggered(): { var i; for (i = 1; i < 2500; ++i) { var j = i * i; console.log(j); } }"
|
|
7
tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50.tsv
vendored
Normal file
7
tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50.tsv
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"0" "1" "4" "9"
|
||||
"<program>" "Binding" "1" "Main Program"
|
||||
"main.qml:1" "Create" "1" "main.qml"
|
||||
"main.qml:14" "Signal" "2" "triggered(): { var i; for (i = 1; i < 2500; ++i) { var j = i * i; console.log(j); } }"
|
||||
"main.qml:1" "Compile" "1" "main.qml"
|
||||
"main.qml:7" "Binding" "1" "text: qsTr(""Hello World"")"
|
||||
"<bytecode>" "Binding" "2" "Source code not available."
|
|
Reference in New Issue
Block a user