diff --git a/tests/system/shared/suites_qtta.py b/tests/system/shared/suites_qtta.py index 452f1eef29f..2d3aa92dac3 100755 --- a/tests/system/shared/suites_qtta.py +++ b/tests/system/shared/suites_qtta.py @@ -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...") diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 49fb6b32c43..d6d216f4d5b 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -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) diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index 25383a9255d..49b20dfce38 100755 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -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." diff --git a/tests/system/suite_debugger/tst_simple_analyze/test.py b/tests/system/suite_debugger/tst_simple_analyze/test.py index 1565bcf1592..293fe1b05b3 100644 --- a/tests/system/suite_debugger/tst_simple_analyze/test.py +++ b/tests/system/suite_debugger/tst_simple_analyze/test.py @@ -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), ['', '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); } }']) + 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): + for item in dumpItems(model, column=i)[:4]: test.verify(item.endswith(' ms')) - test.verify(str(model.index(0, 8).data()).endswith(' ms')) - test.xverify(str(model.index(1, 8).data()).endswith(' ms')) # QTCREATORBUG-8996 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"]: diff --git a/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt47.tsv b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt47.tsv new file mode 100644 index 00000000000..ab9b1a25ba2 --- /dev/null +++ b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt47.tsv @@ -0,0 +1,3 @@ +"0" "1" "4" "9" +"" "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); } }" diff --git a/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50.tsv b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50.tsv new file mode 100644 index 00000000000..ce81e2d6ae3 --- /dev/null +++ b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50.tsv @@ -0,0 +1,7 @@ +"0" "1" "4" "9" +"" "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"")" +"" "Binding" "2" "Source code not available."