Squish: Fix tst_tasks_handling

Change-Id: I58a818864b495d1ecf2923abd50cf848ba368195
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
Christian Stenger
2014-09-19 08:16:31 +02:00
parent 669ed1af38
commit 149f420550

View File

@@ -95,21 +95,21 @@ def getBuildIssuesTypeCounts(model):
def main(): def main():
tasksFile, issueTypes = generateMockTasksFile() tasksFile, issueTypes = generateMockTasksFile()
issuesLabel = ("{text='%d' type='QLabel' unnamed='1' visible='1' " expectedNo = sum(issueTypes)
"window=':Qt Creator_Core::Internal::MainWindow'}" % (sum(issueTypes)))
startApplication("qtcreator" + SettingsPath) startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError(): if not startedWithoutPluginError():
return return
ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton")
model = waitForObject(":Qt Creator.Issues_QListView").model()
test.verify(model.rowCount() == 0, 'Got an empty issue list to start from.')
invokeMenuItem("File", "Open File or Project...") invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(tasksFile) selectFromFileDialog(tasksFile)
starttime = datetime.utcnow() starttime = datetime.utcnow()
waitFor("object.exists(issuesLabel)", 10000) waitFor("model.rowCount() == expectedNo", 10000)
endtime = datetime.utcnow() endtime = datetime.utcnow()
differenceMS = (endtime - starttime).microseconds + (endtime - starttime).seconds * 1000000 differenceMS = (endtime - starttime).microseconds + (endtime - starttime).seconds * 1000000
test.verify(differenceMS < 2000000, "Verifying whether loading the tasks " test.verify(differenceMS < 2000000, "Verifying whether loading the tasks "
"file took less than 2s. (%dµs)" % differenceMS) "file took less than 2s. (%dµs)" % differenceMS)
ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton")
model = waitForObject(":Qt Creator.Issues_QListView").model()
others, errors, warnings = getBuildIssuesTypeCounts(model) others, errors, warnings = getBuildIssuesTypeCounts(model)
test.compare(issueTypes, [warnings, errors, others], test.compare(issueTypes, [warnings, errors, others],
"Verifying whether all expected errors, warnings and other tasks are listed.") "Verifying whether all expected errors, warnings and other tasks are listed.")
@@ -120,8 +120,8 @@ def main():
waitFor("model.rowCount() == issueTypes[1]", 2000) waitFor("model.rowCount() == issueTypes[1]", 2000)
test.compare(model.rowCount(), issueTypes[1], "Verifying only errors are listed.") test.compare(model.rowCount(), issueTypes[1], "Verifying only errors are listed.")
ensureChecked(warnButton, True) ensureChecked(warnButton, True)
waitFor("model.rowCount() == sum(issueTypes)", 2000) waitFor("model.rowCount() == expectedNo", 2000)
test.compare(model.rowCount(), sum(issueTypes), "Verifying all tasks are listed.") test.compare(model.rowCount(), expectedNo, "Verifying all tasks are listed.")
# check filtering by 'My Tasks' # check filtering by 'My Tasks'
checkOrUncheckMyTasks() checkOrUncheckMyTasks()
@@ -129,8 +129,8 @@ def main():
test.compare(model.rowCount(), 0, test.compare(model.rowCount(), 0,
"Verifying whether unchecking 'My Tasks' hides all tasks from tasks file.") "Verifying whether unchecking 'My Tasks' hides all tasks from tasks file.")
checkOrUncheckMyTasks() checkOrUncheckMyTasks()
waitFor("model.rowCount() == sum(issueTypes)", 2000) waitFor("model.rowCount() == expectedNo", 2000)
test.compare(model.rowCount(), sum(issueTypes), test.compare(model.rowCount(), expectedNo,
"Verifying whether checking 'My Tasks' displays all tasks from tasks file.") "Verifying whether checking 'My Tasks' displays all tasks from tasks file.")
# check filtering by 'My Tasks' and 'Show Warnings' # check filtering by 'My Tasks' and 'Show Warnings'
@@ -145,8 +145,8 @@ def main():
test.compare(model.rowCount(), 0, test.compare(model.rowCount(), 0,
"Verifying whether enabling 'Show Warnings' still displays nothing.") "Verifying whether enabling 'Show Warnings' still displays nothing.")
checkOrUncheckMyTasks() checkOrUncheckMyTasks()
waitFor("model.rowCount() == sum(issueTypes)", 2000) waitFor("model.rowCount() == expectedNo", 2000)
test.compare(model.rowCount(), sum(issueTypes), test.compare(model.rowCount(), expectedNo,
"Verifying whether checking 'My Tasks' displays all again.") "Verifying whether checking 'My Tasks' displays all again.")
ensureChecked(warnButton, False) ensureChecked(warnButton, False)
waitFor("model.rowCount() == issueTypes[1]", 2000) waitFor("model.rowCount() == issueTypes[1]", 2000)