Squish: Check for elements in project tree

Change-Id: I11a74d6d9703871b20f9c0a59bf613717e6553ef
Reviewed-by: Christian Stenger <christian.stenger@nokia.com>
This commit is contained in:
Robert Loehning
2012-06-12 17:16:41 +02:00
committed by Christian Stenger
parent 79ca1f3d7c
commit 1776cee64b
4 changed files with 8387 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
import __builtin__
import re
processStarted = False
@@ -467,3 +468,40 @@ def prepareTemplate(sourceExample):
templateDir = os.path.abspath(tempDir() + "/template")
shutil.copytree(sourceExample, 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")

View File

@@ -15,6 +15,10 @@ def main():
# Wait for parsing to complete
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
selectFromLocator(": Qlist::QList", "QList::QList")
test.compare(wordUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList")

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,83 @@
"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"
1 text nestinglevel
2 speedcrunch.pro 0
3 Headers 0
4 core 1
5 constants.h 2
6 evaluator.h 2
7 functions.h 2
8 gui 1
9 aboutbox.h 2
10 application.h 2
11 autohidelabel.h 2
12 bookdock.h 2
13 constantsdock.h 2
14 constantswidget.h 2
15 deletevardlg.h 2
16 editor.h 2
17 functionsdialog.h 2
18 functionsdock.h 2
19 functionswidget.h 2
20 historydock.h 2
21 historywidget.h 2
22 insertvardlg.h 2
23 keypad.h 2
24 mainwindow.h 2
25 resultdisplay.h 2
26 tipwidget.h 2
27 variablesdock.h 2
28 variableswidget.h 2
29 Sources 0
30 core 1
31 constants.cpp 2
32 evaluator.cpp 2
33 functions.cpp 2
34 settings.cpp 2
35 gui 1
36 aboutbox.cpp 2
37 application.cpp 2
38 autohidelabel.cpp 2
39 bookdock.cpp 2
40 constantsdock.cpp 2
41 constantswidget.cpp 2
42 deletevardlg.cpp 2
43 editor.cpp 2
44 functionsdialog.cpp 2
45 functionsdock.cpp 2
46 functionswidget.cpp 2
47 historydock.cpp 2
48 historywidget.cpp 2
49 insertvardlg.cpp 2
50 keypad.cpp 2
51 mainwindow.cpp 2
52 resultdisplay.cpp 2
53 syntaxhighlighter.cpp 2
54 textedit.cpp 2
55 tipwidget.cpp 2
56 variablesdock.cpp 2
57 variableswidget.cpp 2
58 main 1
59 main.cpp 2
60 math 1
61 floatcommon.c 2
62 floatconst.c 2
63 floatconvert.c 2
64 floaterf.c 2
65 floatexp.c 2
66 floatgamma.c 2
67 floathmath.c 2
68 floatio.c 2
69 floatipower.c 2
70 floatlog.c 2
71 floatlogic.c 2
72 floatlong.c 2
73 floatnum.c 2
74 floatpower.c 2
75 floatseries.c 2
76 floattrig.c 2
77 hmath.cpp 2
78 number.c 2
79 thirdparty/binreloc 1
80 binreloc.c 2
81 Resources 0
82 resources 1
83 speedcrunch.qrc 2