Commit 1776cee6 authored by Robert Loehning's avatar Robert Loehning Committed by Christian Stenger
Browse files

Squish: Check for elements in project tree



Change-Id: I11a74d6d9703871b20f9c0a59bf613717e6553ef
Reviewed-by: default avatarChristian Stenger <christian.stenger@nokia.com>
parent 79ca1f3d
import __builtin__
import re import re
processStarted = False processStarted = False
...@@ -467,3 +468,40 @@ def prepareTemplate(sourceExample): ...@@ -467,3 +468,40 @@ def prepareTemplate(sourceExample):
templateDir = os.path.abspath(tempDir() + "/template") templateDir = os.path.abspath(tempDir() + "/template")
shutil.copytree(sourceExample, templateDir) shutil.copytree(sourceExample, templateDir)
return templateDir return templateDir
def __iterateChildren__(model, parent, nestingLevel=0):
children = []
for currentIndex in [model.index(row, 0, parent) for row in range(model.rowCount(parent))]:
children.append([str(currentIndex.text), nestingLevel])
if model.hasChildren(currentIndex):
children.extend(__iterateChildren__(model, currentIndex, nestingLevel + 1))
return children
# This will write the data to a file which can then be used for comparing
def __writeProjectTreeFile__(projectTree, filename):
f = open(filename, "w+")
f.write('"text"\t"nestinglevel"\n')
for elem in projectTree:
f.write('"%s"\t"%s"\n' % (elem[0], elem[1]))
f.close()
def __getTestData__(record):
return [testData.field(record, "text"),
__builtin__.int(testData.field(record, "nestinglevel"))]
def compareProjectTree(rootObject, dataset):
root = waitForObject(rootObject)
tree = __iterateChildren__(root.model(), root)
# __writeProjectTreeFile__(tree, dataset)
for i, current in enumerate(map(__getTestData__, testData.dataset(dataset))):
try:
# Just removing everything up to the found item
# Writing a pass would result in truly massive logs
tree = tree[tree.index(current) + 1:]
except ValueError:
test.fail('Could not find "%s" with nesting level %s' % tuple(current),
'Line %s in dataset' % str(i + 1))
return
test.passes("No errors found in project tree")
...@@ -15,6 +15,10 @@ def main(): ...@@ -15,6 +15,10 @@ def main():
# Wait for parsing to complete # Wait for parsing to complete
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 300000) waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)", 300000)
naviTreeView = "{column='0' container=':Qt Creator_Utils::NavigationTreeView' text='%s' type='QModelIndex'}"
compareProjectTree(naviTreeView % "speedcrunch", "projecttree_speedcrunch.tsv")
compareProjectTree(naviTreeView % "qtcreator", "projecttree_creator.tsv")
# Now check some basic lookups in the search box # Now check some basic lookups in the search box
selectFromLocator(": Qlist::QList", "QList::QList") selectFromLocator(": Qlist::QList", "QList::QList")
test.compare(wordUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList") test.compare(wordUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList")
......
"text" "nestinglevel"
"speedcrunch.pro" "0"
"Headers" "0"
"core" "1"
"constants.h" "2"
"evaluator.h" "2"
"functions.h" "2"
"gui" "1"
"aboutbox.h" "2"
"application.h" "2"
"autohidelabel.h" "2"
"bookdock.h" "2"
"constantsdock.h" "2"
"constantswidget.h" "2"
"deletevardlg.h" "2"
"editor.h" "2"
"functionsdialog.h" "2"
"functionsdock.h" "2"
"functionswidget.h" "2"
"historydock.h" "2"
"historywidget.h" "2"
"insertvardlg.h" "2"
"keypad.h" "2"
"mainwindow.h" "2"
"resultdisplay.h" "2"
"tipwidget.h" "2"
"variablesdock.h" "2"
"variableswidget.h" "2"
"Sources" "0"
"core" "1"
"constants.cpp" "2"
"evaluator.cpp" "2"
"functions.cpp" "2"
"settings.cpp" "2"
"gui" "1"
"aboutbox.cpp" "2"
"application.cpp" "2"
"autohidelabel.cpp" "2"
"bookdock.cpp" "2"
"constantsdock.cpp" "2"
"constantswidget.cpp" "2"
"deletevardlg.cpp" "2"
"editor.cpp" "2"
"functionsdialog.cpp" "2"
"functionsdock.cpp" "2"
"functionswidget.cpp" "2"
"historydock.cpp" "2"
"historywidget.cpp" "2"
"insertvardlg.cpp" "2"
"keypad.cpp" "2"
"mainwindow.cpp" "2"
"resultdisplay.cpp" "2"
"syntaxhighlighter.cpp" "2"
"textedit.cpp" "2"
"tipwidget.cpp" "2"
"variablesdock.cpp" "2"
"variableswidget.cpp" "2"
"main" "1"
"main.cpp" "2"
"math" "1"
"floatcommon.c" "2"
"floatconst.c" "2"
"floatconvert.c" "2"
"floaterf.c" "2"
"floatexp.c" "2"
"floatgamma.c" "2"
"floathmath.c" "2"
"floatio.c" "2"
"floatipower.c" "2"
"floatlog.c" "2"
"floatlogic.c" "2"
"floatlong.c" "2"
"floatnum.c" "2"
"floatpower.c" "2"
"floatseries.c" "2"
"floattrig.c" "2"
"hmath.cpp" "2"
"number.c" "2"
"thirdparty/binreloc" "1"
"binreloc.c" "2"
"Resources" "0"
"resources" "1"
"speedcrunch.qrc" "2"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment