author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Thu, 22 Apr 2010 16:15:11 +0300 | |
branch | RCL_3 |
changeset 14 | 8c4229025c0b |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the test suite of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
||
43 |
#include <QtTest/QtTest> |
|
44 |
||
45 |
#include <qtreewidget.h> |
|
46 |
#include <qtreewidgetitemiterator.h> |
|
47 |
#include <qapplication.h> |
|
48 |
#include <qeventloop.h> |
|
49 |
#include <qdebug.h> |
|
50 |
||
51 |
//TESTED_CLASS= |
|
52 |
//TESTED_FILES= |
|
53 |
||
54 |
class tst_QTreeWidgetItemIterator : public QObject |
|
55 |
{ |
|
56 |
Q_OBJECT |
|
57 |
||
58 |
public: |
|
59 |
tst_QTreeWidgetItemIterator(); |
|
60 |
~tst_QTreeWidgetItemIterator(); |
|
61 |
||
62 |
public slots: |
|
63 |
void initTestCase(); |
|
64 |
void cleanupTestCase(); |
|
65 |
void init(); |
|
66 |
void cleanup(); |
|
67 |
||
68 |
private slots: |
|
69 |
void postincrement(); |
|
70 |
void preincrement(); |
|
71 |
void postdecrement(); |
|
72 |
void predecrement(); |
|
73 |
void plus_eq_data(); |
|
74 |
void plus_eq(); |
|
75 |
void minus_eq_data(); |
|
76 |
void minus_eq(); |
|
77 |
void iteratorflags_data(); |
|
78 |
void iteratorflags(); |
|
79 |
void updateIfModifiedFromWidget_data(); |
|
80 |
void updateIfModifiedFromWidget(); |
|
81 |
void constructIteratorWithItem_data(); |
|
82 |
void constructIteratorWithItem(); |
|
83 |
void updateIteratorAfterDeletedItem_and_ContinueIteration_data(); |
|
84 |
void updateIteratorAfterDeletedItem_and_ContinueIteration(); |
|
85 |
void initializeIterator(); |
|
86 |
private: |
|
87 |
QTreeWidget *testWidget; |
|
88 |
}; |
|
89 |
||
90 |
tst_QTreeWidgetItemIterator::tst_QTreeWidgetItemIterator(): testWidget(0) |
|
91 |
{ |
|
92 |
} |
|
93 |
||
94 |
tst_QTreeWidgetItemIterator::~tst_QTreeWidgetItemIterator() |
|
95 |
{ |
|
96 |
} |
|
97 |
||
98 |
void tst_QTreeWidgetItemIterator::initTestCase() |
|
99 |
{ |
|
100 |
testWidget = new QTreeWidget(); |
|
101 |
testWidget->clear(); |
|
102 |
testWidget->setColumnCount(2); |
|
103 |
testWidget->show(); |
|
104 |
||
105 |
||
106 |
/** |
|
107 |
* These are default: |
|
108 |
* |
|
109 |
* Qt::ItemIsSelectable |
|
110 |
* |Qt::ItemIsUserCheckable |
|
111 |
* |Qt::ItemIsEnabled |
|
112 |
* |Qt::ItemIsDragEnabled |
|
113 |
* |Qt::ItemIsDropEnabled |
|
114 |
* |
|
115 |
*/ |
|
116 |
for (int i=0; i <= 16; ++i) { |
|
117 |
QTreeWidgetItem *top = new QTreeWidgetItem(testWidget); |
|
118 |
top->setText(0, QString("top%1").arg(i)); |
|
119 |
switch (i) { |
|
120 |
case 0: testWidget->setItemHidden(top, true);break; |
|
121 |
case 1: testWidget->setItemHidden(top, false);break; |
|
122 |
||
123 |
case 2: testWidget->setItemSelected(top, true);break; |
|
124 |
case 3: testWidget->setItemSelected(top, false);break; |
|
125 |
||
126 |
case 4: top->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);break; |
|
127 |
case 5: top->setFlags(Qt::ItemIsEnabled);break; |
|
128 |
||
129 |
case 6: top->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);break; |
|
130 |
case 7: top->setFlags(Qt::ItemIsEnabled);break; |
|
131 |
||
132 |
case 8: top->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);break; |
|
133 |
case 9: top->setFlags(Qt::ItemIsEnabled);break; |
|
134 |
||
135 |
case 10: top->setFlags(Qt::ItemIsEnabled);break; |
|
136 |
case 11: |
|
137 |
top->setFlags(0); |
|
138 |
break; |
|
139 |
||
140 |
case 12: top->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable);break; |
|
141 |
case 13: top->setFlags(Qt::ItemIsEnabled);break; |
|
142 |
||
143 |
case 14: top->setCheckState(0, Qt::Checked);break; |
|
144 |
case 15: top->setCheckState(0, Qt::Unchecked);break; |
|
145 |
case 16: top->setCheckState(0, Qt::PartiallyChecked);break; |
|
146 |
} |
|
147 |
for (int j=0; j <= 16; ++j) { |
|
148 |
QTreeWidgetItem *child = new QTreeWidgetItem(top); |
|
149 |
child->setText(0, QString("top%1,child%2").arg(i).arg(j)); |
|
150 |
switch (j) { |
|
151 |
case 0: testWidget->setItemHidden(child, true);break; |
|
152 |
case 1: testWidget->setItemHidden(child, false);break; |
|
153 |
||
154 |
case 2: testWidget->setItemSelected(child, true);break; |
|
155 |
case 3: testWidget->setItemSelected(child, false);break; |
|
156 |
||
157 |
case 4: child->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);break; |
|
158 |
case 5: child->setFlags(Qt::ItemIsEnabled);break; |
|
159 |
||
160 |
case 6: child->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);break; |
|
161 |
case 7: child->setFlags(Qt::ItemIsEnabled);break; |
|
162 |
||
163 |
case 8: child->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);break; |
|
164 |
case 9: child->setFlags(Qt::ItemIsEnabled);break; |
|
165 |
||
166 |
case 10: child->setFlags(Qt::ItemIsEnabled);break; |
|
167 |
case 11: child->setFlags(0);break; |
|
168 |
||
169 |
case 12: child->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable);break; |
|
170 |
case 13: child->setFlags(Qt::ItemIsEnabled);break; |
|
171 |
||
172 |
case 14: child->setCheckState(0, Qt::Checked);break; |
|
173 |
case 15: child->setCheckState(0, Qt::Unchecked);break; |
|
174 |
case 16: child->setCheckState(0, Qt::PartiallyChecked);break; |
|
175 |
} |
|
176 |
||
177 |
} |
|
178 |
} |
|
179 |
} |
|
180 |
||
181 |
void tst_QTreeWidgetItemIterator::cleanupTestCase() |
|
182 |
{ |
|
183 |
testWidget->hide(); |
|
184 |
delete testWidget; |
|
185 |
} |
|
186 |
||
187 |
void tst_QTreeWidgetItemIterator::init() |
|
188 |
{ |
|
189 |
} |
|
190 |
||
191 |
void tst_QTreeWidgetItemIterator::cleanup() |
|
192 |
{ |
|
193 |
} |
|
194 |
||
195 |
void tst_QTreeWidgetItemIterator::iteratorflags_data() |
|
196 |
{ |
|
197 |
/* |
|
198 |
// Should preferably test for all these flags (and combinations)..... |
|
199 |
||
200 |
All = 0x00000000, |
|
201 |
Hidden = 0x00000001, |
|
202 |
NotHidden = 0x00000002, |
|
203 |
Selected = 0x00000004, |
|
204 |
Unselected = 0x00000008, |
|
205 |
Selectable = 0x00000010, |
|
206 |
NotSelectable = 0x00000020, |
|
207 |
DragEnabled = 0x00000040, |
|
208 |
DragDisabled = 0x00000080, |
|
209 |
DropEnabled = 0x00000100, |
|
210 |
DropDisabled = 0x00000200, |
|
211 |
HasChildren = 0x00000400, |
|
212 |
NoChildren = 0x00000800, |
|
213 |
Checked = 0x00001000, |
|
214 |
NotChecked = 0x00002000, |
|
215 |
Enabled = 0x00004000, |
|
216 |
Disabled = 0x00008000, |
|
217 |
Editable = 0x00010000, |
|
218 |
NotEditable = 0x00020000 |
|
219 |
*/ |
|
220 |
QTest::addColumn<int>("start"); |
|
221 |
QTest::addColumn<int>("iteratorflags"); |
|
222 |
QTest::addColumn<QStringList>("matches"); |
|
223 |
||
224 |
QTest::newRow("Match all") << 0 << (int)QTreeWidgetItemIterator::All |
|
225 |
<< (QStringList() |
|
226 |
<< "top0" << "top0,child0" << "top0,child1" << "top0,child2" << "top0,child3" |
|
227 |
<< "top0,child4" << "top0,child5" << "top0,child6" << "top0,child7" |
|
228 |
<< "top0,child8" << "top0,child9" << "top0,child10" << "top0,child11" |
|
229 |
<< "top0,child12" << "top0,child13" << "top0,child14" << "top0,child15" |
|
230 |
<< "top0,child16" |
|
231 |
<< "top1" << "top1,child0" << "top1,child1" << "top1,child2" << "top1,child3" |
|
232 |
<< "top1,child4" << "top1,child5" << "top1,child6" << "top1,child7" |
|
233 |
<< "top1,child8" << "top1,child9" << "top1,child10" << "top1,child11" |
|
234 |
<< "top1,child12" << "top1,child13" << "top1,child14" << "top1,child15" |
|
235 |
<< "top1,child16" |
|
236 |
<< "top2" << "top2,child0" << "top2,child1" << "top2,child2" << "top2,child3" |
|
237 |
<< "top2,child4" << "top2,child5" << "top2,child6" << "top2,child7" |
|
238 |
<< "top2,child8" << "top2,child9" << "top2,child10" << "top2,child11" |
|
239 |
<< "top2,child12" << "top2,child13" << "top2,child14" << "top2,child15" |
|
240 |
<< "top2,child16" |
|
241 |
<< "top3" << "top3,child0" << "top3,child1" << "top3,child2" << "top3,child3" |
|
242 |
<< "top3,child4" << "top3,child5" << "top3,child6" << "top3,child7" |
|
243 |
<< "top3,child8" << "top3,child9" << "top3,child10" << "top3,child11" |
|
244 |
<< "top3,child12" << "top3,child13" << "top3,child14" << "top3,child15" |
|
245 |
<< "top3,child16" |
|
246 |
<< "top4" << "top4,child0" << "top4,child1" << "top4,child2" << "top4,child3" |
|
247 |
<< "top4,child4" << "top4,child5" << "top4,child6" << "top4,child7" |
|
248 |
<< "top4,child8" << "top4,child9" << "top4,child10" << "top4,child11" |
|
249 |
<< "top4,child12" << "top4,child13" << "top4,child14" << "top4,child15" |
|
250 |
<< "top4,child16" |
|
251 |
<< "top5" << "top5,child0" << "top5,child1" << "top5,child2" << "top5,child3" |
|
252 |
<< "top5,child4" << "top5,child5" << "top5,child6" << "top5,child7" |
|
253 |
<< "top5,child8" << "top5,child9" << "top5,child10" << "top5,child11" |
|
254 |
<< "top5,child12" << "top5,child13" << "top5,child14" << "top5,child15" |
|
255 |
<< "top5,child16" |
|
256 |
<< "top6" << "top6,child0" << "top6,child1" << "top6,child2" << "top6,child3" |
|
257 |
<< "top6,child4" << "top6,child5" << "top6,child6" << "top6,child7" |
|
258 |
<< "top6,child8" << "top6,child9" << "top6,child10" << "top6,child11" |
|
259 |
<< "top6,child12" << "top6,child13" << "top6,child14" << "top6,child15" |
|
260 |
<< "top6,child16" |
|
261 |
<< "top7" << "top7,child0" << "top7,child1" << "top7,child2" << "top7,child3" |
|
262 |
<< "top7,child4" << "top7,child5" << "top7,child6" << "top7,child7" |
|
263 |
<< "top7,child8" << "top7,child9" << "top7,child10" << "top7,child11" |
|
264 |
<< "top7,child12" << "top7,child13" << "top7,child14" << "top7,child15" |
|
265 |
<< "top7,child16" |
|
266 |
<< "top8" << "top8,child0" << "top8,child1" << "top8,child2" << "top8,child3" |
|
267 |
<< "top8,child4" << "top8,child5" << "top8,child6" << "top8,child7" |
|
268 |
<< "top8,child8" << "top8,child9" << "top8,child10" << "top8,child11" |
|
269 |
<< "top8,child12" << "top8,child13" << "top8,child14" << "top8,child15" |
|
270 |
<< "top8,child16" |
|
271 |
<< "top9" << "top9,child0" << "top9,child1" << "top9,child2" << "top9,child3" |
|
272 |
<< "top9,child4" << "top9,child5" << "top9,child6" << "top9,child7" |
|
273 |
<< "top9,child8" << "top9,child9" << "top9,child10" << "top9,child11" |
|
274 |
<< "top9,child12" << "top9,child13" << "top9,child14" << "top9,child15" |
|
275 |
<< "top9,child16" |
|
276 |
<< "top10" << "top10,child0" << "top10,child1" << "top10,child2" << "top10,child3" |
|
277 |
<< "top10,child4" << "top10,child5" << "top10,child6" << "top10,child7" |
|
278 |
<< "top10,child8" << "top10,child9" << "top10,child10" << "top10,child11" |
|
279 |
<< "top10,child12" << "top10,child13" << "top10,child14" << "top10,child15" |
|
280 |
<< "top10,child16" |
|
281 |
<< "top11" << "top11,child0" << "top11,child1" << "top11,child2" << "top11,child3" |
|
282 |
<< "top11,child4" << "top11,child5" << "top11,child6" << "top11,child7" |
|
283 |
<< "top11,child8" << "top11,child9" << "top11,child10" << "top11,child11" |
|
284 |
<< "top11,child12" << "top11,child13" << "top11,child14" << "top11,child15" |
|
285 |
<< "top11,child16" |
|
286 |
<< "top12" << "top12,child0" << "top12,child1" << "top12,child2" << "top12,child3" |
|
287 |
<< "top12,child4" << "top12,child5" << "top12,child6" << "top12,child7" |
|
288 |
<< "top12,child8" << "top12,child9" << "top12,child10" << "top12,child11" |
|
289 |
<< "top12,child12" << "top12,child13" << "top12,child14" << "top12,child15" |
|
290 |
<< "top12,child16" |
|
291 |
<< "top13" << "top13,child0" << "top13,child1" << "top13,child2" << "top13,child3" |
|
292 |
<< "top13,child4" << "top13,child5" << "top13,child6" << "top13,child7" |
|
293 |
<< "top13,child8" << "top13,child9" << "top13,child10" << "top13,child11" |
|
294 |
<< "top13,child12" << "top13,child13" << "top13,child14" << "top13,child15" |
|
295 |
<< "top13,child16" |
|
296 |
<< "top14" << "top14,child0" << "top14,child1" << "top14,child2" << "top14,child3" |
|
297 |
<< "top14,child4" << "top14,child5" << "top14,child6" << "top14,child7" |
|
298 |
<< "top14,child8" << "top14,child9" << "top14,child10" << "top14,child11" |
|
299 |
<< "top14,child12" << "top14,child13" << "top14,child14" << "top14,child15" |
|
300 |
<< "top14,child16" |
|
301 |
<< "top15" << "top15,child0" << "top15,child1" << "top15,child2" << "top15,child3" |
|
302 |
<< "top15,child4" << "top15,child5" << "top15,child6" << "top15,child7" |
|
303 |
<< "top15,child8" << "top15,child9" << "top15,child10" << "top15,child11" |
|
304 |
<< "top15,child12" << "top15,child13" << "top15,child14" << "top15,child15" |
|
305 |
<< "top15,child16" |
|
306 |
<< "top16" << "top16,child0" << "top16,child1" << "top16,child2" << "top16,child3" |
|
307 |
<< "top16,child4" << "top16,child5" << "top16,child6" << "top16,child7" |
|
308 |
<< "top16,child8" << "top16,child9" << "top16,child10" << "top16,child11" |
|
309 |
<< "top16,child12" << "top16,child13" << "top16,child14" << "top16,child15" |
|
310 |
<< "top16,child16"); |
|
311 |
||
312 |
QTest::newRow("Match hidden") << 0 << (int)QTreeWidgetItemIterator::Hidden |
|
313 |
<< (QStringList() |
|
314 |
<< "top0" << "top0,child0" // fails due to hidden row |
|
315 |
<< "top1,child0" |
|
316 |
<< "top2,child0" |
|
317 |
<< "top3,child0" |
|
318 |
<< "top4,child0" |
|
319 |
<< "top5,child0" |
|
320 |
<< "top6,child0" |
|
321 |
<< "top7,child0" |
|
322 |
<< "top8,child0" |
|
323 |
<< "top9,child0" |
|
324 |
<< "top10,child0" |
|
325 |
<< "top11,child0" |
|
326 |
<< "top12,child0" |
|
327 |
<< "top13,child0" |
|
328 |
<< "top14,child0" |
|
329 |
<< "top15,child0" |
|
330 |
<< "top16,child0"); |
|
331 |
||
332 |
QTest::newRow("Match not hidden") << 0 << (int)QTreeWidgetItemIterator::NotHidden |
|
333 |
<< (QStringList() |
|
334 |
<< "top0,child1" << "top0,child2" << "top0,child3" |
|
335 |
<< "top0,child4" << "top0,child5" << "top0,child6" << "top0,child7" |
|
336 |
<< "top0,child8" << "top0,child9" << "top0,child10" << "top0,child11" |
|
337 |
<< "top0,child12" << "top0,child13" << "top0,child14" << "top0,child15" |
|
338 |
<< "top0,child16" |
|
339 |
<< "top1" << "top1,child1" << "top1,child2" << "top1,child3" |
|
340 |
<< "top1,child4" << "top1,child5" << "top1,child6" << "top1,child7" |
|
341 |
<< "top1,child8" << "top1,child9" << "top1,child10" << "top1,child11" |
|
342 |
<< "top1,child12" << "top1,child13" << "top1,child14" << "top1,child15" |
|
343 |
<< "top1,child16" |
|
344 |
<< "top2" << "top2,child1" << "top2,child2" << "top2,child3" |
|
345 |
<< "top2,child4" << "top2,child5" << "top2,child6" << "top2,child7" |
|
346 |
<< "top2,child8" << "top2,child9" << "top2,child10" << "top2,child11" |
|
347 |
<< "top2,child12" << "top2,child13" << "top2,child14" << "top2,child15" |
|
348 |
<< "top2,child16" |
|
349 |
<< "top3" << "top3,child1" << "top3,child2" << "top3,child3" |
|
350 |
<< "top3,child4" << "top3,child5" << "top3,child6" << "top3,child7" |
|
351 |
<< "top3,child8" << "top3,child9" << "top3,child10" << "top3,child11" |
|
352 |
<< "top3,child12" << "top3,child13" << "top3,child14" << "top3,child15" |
|
353 |
<< "top3,child16" |
|
354 |
<< "top4" << "top4,child1" << "top4,child2" << "top4,child3" |
|
355 |
<< "top4,child4" << "top4,child5" << "top4,child6" << "top4,child7" |
|
356 |
<< "top4,child8" << "top4,child9" << "top4,child10" << "top4,child11" |
|
357 |
<< "top4,child12" << "top4,child13" << "top4,child14" << "top4,child15" |
|
358 |
<< "top4,child16" |
|
359 |
<< "top5" << "top5,child1" << "top5,child2" << "top5,child3" |
|
360 |
<< "top5,child4" << "top5,child5" << "top5,child6" << "top5,child7" |
|
361 |
<< "top5,child8" << "top5,child9" << "top5,child10" << "top5,child11" |
|
362 |
<< "top5,child12" << "top5,child13" << "top5,child14" << "top5,child15" |
|
363 |
<< "top5,child16" |
|
364 |
<< "top6" << "top6,child1" << "top6,child2" << "top6,child3" |
|
365 |
<< "top6,child4" << "top6,child5" << "top6,child6" << "top6,child7" |
|
366 |
<< "top6,child8" << "top6,child9" << "top6,child10" << "top6,child11" |
|
367 |
<< "top6,child12" << "top6,child13" << "top6,child14" << "top6,child15" |
|
368 |
<< "top6,child16" |
|
369 |
<< "top7" << "top7,child1" << "top7,child2" << "top7,child3" |
|
370 |
<< "top7,child4" << "top7,child5" << "top7,child6" << "top7,child7" |
|
371 |
<< "top7,child8" << "top7,child9" << "top7,child10" << "top7,child11" |
|
372 |
<< "top7,child12" << "top7,child13" << "top7,child14" << "top7,child15" |
|
373 |
<< "top7,child16" |
|
374 |
<< "top8" << "top8,child1" << "top8,child2" << "top8,child3" |
|
375 |
<< "top8,child4" << "top8,child5" << "top8,child6" << "top8,child7" |
|
376 |
<< "top8,child8" << "top8,child9" << "top8,child10" << "top8,child11" |
|
377 |
<< "top8,child12" << "top8,child13" << "top8,child14" << "top8,child15" |
|
378 |
<< "top8,child16" |
|
379 |
<< "top9" << "top9,child1" << "top9,child2" << "top9,child3" |
|
380 |
<< "top9,child4" << "top9,child5" << "top9,child6" << "top9,child7" |
|
381 |
<< "top9,child8" << "top9,child9" << "top9,child10" << "top9,child11" |
|
382 |
<< "top9,child12" << "top9,child13" << "top9,child14" << "top9,child15" |
|
383 |
<< "top9,child16" |
|
384 |
<< "top10" << "top10,child1" << "top10,child2" << "top10,child3" |
|
385 |
<< "top10,child4" << "top10,child5" << "top10,child6" << "top10,child7" |
|
386 |
<< "top10,child8" << "top10,child9" << "top10,child10" << "top10,child11" |
|
387 |
<< "top10,child12" << "top10,child13" << "top10,child14" << "top10,child15" |
|
388 |
<< "top10,child16" |
|
389 |
<< "top11" << "top11,child1" << "top11,child2" << "top11,child3" |
|
390 |
<< "top11,child4" << "top11,child5" << "top11,child6" << "top11,child7" |
|
391 |
<< "top11,child8" << "top11,child9" << "top11,child10" << "top11,child11" |
|
392 |
<< "top11,child12" << "top11,child13" << "top11,child14" << "top11,child15" |
|
393 |
<< "top11,child16" |
|
394 |
<< "top12" << "top12,child1" << "top12,child2" << "top12,child3" |
|
395 |
<< "top12,child4" << "top12,child5" << "top12,child6" << "top12,child7" |
|
396 |
<< "top12,child8" << "top12,child9" << "top12,child10" << "top12,child11" |
|
397 |
<< "top12,child12" << "top12,child13" << "top12,child14" << "top12,child15" |
|
398 |
<< "top12,child16" |
|
399 |
<< "top13" << "top13,child1" << "top13,child2" << "top13,child3" |
|
400 |
<< "top13,child4" << "top13,child5" << "top13,child6" << "top13,child7" |
|
401 |
<< "top13,child8" << "top13,child9" << "top13,child10" << "top13,child11" |
|
402 |
<< "top13,child12" << "top13,child13" << "top13,child14" << "top13,child15" |
|
403 |
<< "top13,child16" |
|
404 |
<< "top14" << "top14,child1" << "top14,child2" << "top14,child3" |
|
405 |
<< "top14,child4" << "top14,child5" << "top14,child6" << "top14,child7" |
|
406 |
<< "top14,child8" << "top14,child9" << "top14,child10" << "top14,child11" |
|
407 |
<< "top14,child12" << "top14,child13" << "top14,child14" << "top14,child15" |
|
408 |
<< "top14,child16" |
|
409 |
<< "top15" << "top15,child1" << "top15,child2" << "top15,child3" |
|
410 |
<< "top15,child4" << "top15,child5" << "top15,child6" << "top15,child7" |
|
411 |
<< "top15,child8" << "top15,child9" << "top15,child10" << "top15,child11" |
|
412 |
<< "top15,child12" << "top15,child13" << "top15,child14" << "top15,child15" |
|
413 |
<< "top15,child16" |
|
414 |
<< "top16" << "top16,child1" << "top16,child2" << "top16,child3" |
|
415 |
<< "top16,child4" << "top16,child5" << "top16,child6" << "top16,child7" |
|
416 |
<< "top16,child8" << "top16,child9" << "top16,child10" << "top16,child11" |
|
417 |
<< "top16,child12" << "top16,child13" << "top16,child14" << "top16,child15" |
|
418 |
<< "top16,child16"); |
|
419 |
||
420 |
QTest::newRow("Match selected") << 0 << (int)QTreeWidgetItemIterator::Selected |
|
421 |
<< (QStringList() |
|
422 |
<< "top0,child2" |
|
423 |
<< "top1,child2" |
|
424 |
<< "top2" << "top2,child2" |
|
425 |
<< "top3,child2" |
|
426 |
<< "top4,child2" |
|
427 |
<< "top5,child2" |
|
428 |
<< "top6,child2" |
|
429 |
<< "top7,child2" |
|
430 |
<< "top8,child2" |
|
431 |
<< "top9,child2" |
|
432 |
<< "top10,child2" |
|
433 |
<< "top11,child2" |
|
434 |
<< "top12,child2" |
|
435 |
<< "top13,child2" |
|
436 |
<< "top14,child2" |
|
437 |
<< "top15,child2" |
|
438 |
<< "top16,child2"); |
|
439 |
||
440 |
QTest::newRow("Match selectable") << 0 << (int)QTreeWidgetItemIterator::Selectable |
|
441 |
<< (QStringList() |
|
442 |
<< "top0" << "top0,child0" << "top0,child1" << "top0,child2" << "top0,child3" |
|
443 |
<< "top0,child4" |
|
444 |
<< "top0,child14" << "top0,child15" |
|
445 |
<< "top0,child16" |
|
446 |
<< "top1" << "top1,child0" << "top1,child1" << "top1,child2" << "top1,child3" |
|
447 |
<< "top1,child4" |
|
448 |
<< "top1,child14" << "top1,child15" |
|
449 |
<< "top1,child16" |
|
450 |
<< "top2" << "top2,child0" << "top2,child1" << "top2,child2" << "top2,child3" |
|
451 |
<< "top2,child4" |
|
452 |
<< "top2,child14" << "top2,child15" |
|
453 |
<< "top2,child16" |
|
454 |
<< "top3" << "top3,child0" << "top3,child1" << "top3,child2" << "top3,child3" |
|
455 |
<< "top3,child4" |
|
456 |
<< "top3,child14" << "top3,child15" |
|
457 |
<< "top3,child16" |
|
458 |
<< "top4" << "top4,child0" << "top4,child1" << "top4,child2" << "top4,child3" |
|
459 |
<< "top4,child4" |
|
460 |
<< "top4,child14" << "top4,child15" |
|
461 |
<< "top4,child16" |
|
462 |
/* "top5"*/ << "top5,child0" << "top5,child1" << "top5,child2" << "top5,child3" |
|
463 |
<< "top5,child4" |
|
464 |
<< "top5,child14" << "top5,child15" |
|
465 |
<< "top5,child16" |
|
466 |
/* "top6"*/ << "top6,child0" << "top6,child1" << "top6,child2" << "top6,child3" |
|
467 |
<< "top6,child4" |
|
468 |
<< "top6,child14" << "top6,child15" |
|
469 |
<< "top6,child16" |
|
470 |
/* "top7"*/ << "top7,child0" << "top7,child1" << "top7,child2" << "top7,child3" |
|
471 |
<< "top7,child4" |
|
472 |
<< "top7,child14" << "top7,child15" |
|
473 |
<< "top7,child16" |
|
474 |
/* "top8"*/ << "top8,child0" << "top8,child1" << "top8,child2" << "top8,child3" |
|
475 |
<< "top8,child4" |
|
476 |
<< "top8,child14" << "top8,child15" |
|
477 |
<< "top8,child16" |
|
478 |
/* "top9"*/ << "top9,child0" << "top9,child1" << "top9,child2" << "top9,child3" |
|
479 |
<< "top9,child4" |
|
480 |
<< "top9,child14" << "top9,child15" |
|
481 |
<< "top9,child16" |
|
482 |
/* "top10*/ << "top10,child0" << "top10,child1" << "top10,child2" << "top10,child3" |
|
483 |
<< "top10,child4" |
|
484 |
<< "top10,child14" << "top10,child15" |
|
485 |
<< "top10,child16" |
|
486 |
/* "top11*/ << "top11,child0" << "top11,child1" << "top11,child2" << "top11,child3" |
|
487 |
<< "top11,child4" |
|
488 |
<< "top11,child14" << "top11,child15" |
|
489 |
<< "top11,child16" |
|
490 |
/* "top12*/ << "top12,child0" << "top12,child1" << "top12,child2" << "top12,child3" |
|
491 |
<< "top12,child4" |
|
492 |
<< "top12,child14" << "top12,child15" |
|
493 |
<< "top12,child16" |
|
494 |
/* "top13*/ << "top13,child0" << "top13,child1" << "top13,child2" << "top13,child3" |
|
495 |
<< "top13,child4" |
|
496 |
<< "top13,child14" << "top13,child15" |
|
497 |
<< "top13,child16" |
|
498 |
<< "top14" << "top14,child0" << "top14,child1" << "top14,child2" << "top14,child3" |
|
499 |
<< "top14,child4" |
|
500 |
<< "top14,child14" << "top14,child15" |
|
501 |
<< "top14,child16" |
|
502 |
<< "top15" << "top15,child0" << "top15,child1" << "top15,child2" << "top15,child3" |
|
503 |
<< "top15,child4" |
|
504 |
<< "top15,child14" << "top15,child15" |
|
505 |
<< "top15,child16" |
|
506 |
<< "top16" << "top16,child0" << "top16,child1" << "top16,child2" << "top16,child3" |
|
507 |
<< "top16,child4" |
|
508 |
<< "top16,child14" << "top16,child15" |
|
509 |
<< "top16,child16"); |
|
510 |
||
511 |
||
512 |
QTest::newRow("Match DragEnabled") << 0 << (int)QTreeWidgetItemIterator::DragEnabled |
|
513 |
<< (QStringList() |
|
514 |
<< "top0" << "top0,child0" << "top0,child1" << "top0,child2" << "top0,child3" |
|
515 |
<< "top0,child6" |
|
516 |
<< "top0,child14" << "top0,child15" |
|
517 |
<< "top0,child16" |
|
518 |
<< "top1" << "top1,child0" << "top1,child1" << "top1,child2" << "top1,child3" |
|
519 |
<< "top1,child6" |
|
520 |
<< "top1,child14" << "top1,child15" |
|
521 |
<< "top1,child16" |
|
522 |
<< "top2" << "top2,child0" << "top2,child1" << "top2,child2" << "top2,child3" |
|
523 |
<< "top2,child6" |
|
524 |
<< "top2,child14" << "top2,child15" |
|
525 |
<< "top2,child16" |
|
526 |
<< "top3" << "top3,child0" << "top3,child1" << "top3,child2" << "top3,child3" |
|
527 |
<< "top3,child6" |
|
528 |
<< "top3,child14" << "top3,child15" |
|
529 |
<< "top3,child16" |
|
530 |
/* "top4"*/ << "top4,child0" << "top4,child1" << "top4,child2" << "top4,child3" |
|
531 |
<< "top4,child6" |
|
532 |
<< "top4,child14" << "top4,child15" |
|
533 |
<< "top4,child16" |
|
534 |
/* "top5"*/ << "top5,child0" << "top5,child1" << "top5,child2" << "top5,child3" |
|
535 |
<< "top5,child6" |
|
536 |
<< "top5,child14" << "top5,child15" |
|
537 |
<< "top5,child16" |
|
538 |
<< "top6" << "top6,child0" << "top6,child1" << "top6,child2" << "top6,child3" |
|
539 |
<< "top6,child6" |
|
540 |
<< "top6,child14" << "top6,child15" |
|
541 |
<< "top6,child16" |
|
542 |
/* "top7"*/ << "top7,child0" << "top7,child1" << "top7,child2" << "top7,child3" |
|
543 |
<< "top7,child6" |
|
544 |
<< "top7,child14" << "top7,child15" |
|
545 |
<< "top7,child16" |
|
546 |
/* "top8"*/ << "top8,child0" << "top8,child1" << "top8,child2" << "top8,child3" |
|
547 |
<< "top8,child6" |
|
548 |
<< "top8,child14" << "top8,child15" |
|
549 |
<< "top8,child16" |
|
550 |
/* "top9"*/ << "top9,child0" << "top9,child1" << "top9,child2" << "top9,child3" |
|
551 |
<< "top9,child6" |
|
552 |
<< "top9,child14" << "top9,child15" |
|
553 |
<< "top9,child16" |
|
554 |
/* "top10*/ << "top10,child0" << "top10,child1" << "top10,child2" << "top10,child3" |
|
555 |
<< "top10,child6" |
|
556 |
<< "top10,child14" << "top10,child15" |
|
557 |
<< "top10,child16" |
|
558 |
/* "top11*/ << "top11,child0" << "top11,child1" << "top11,child2" << "top11,child3" |
|
559 |
<< "top11,child6" |
|
560 |
<< "top11,child14" << "top11,child15" |
|
561 |
<< "top11,child16" |
|
562 |
/* "top12*/ << "top12,child0" << "top12,child1" << "top12,child2" << "top12,child3" |
|
563 |
<< "top12,child6" |
|
564 |
<< "top12,child14" << "top12,child15" |
|
565 |
<< "top12,child16" |
|
566 |
/* "top13*/ << "top13,child0" << "top13,child1" << "top13,child2" << "top13,child3" |
|
567 |
<< "top13,child6" |
|
568 |
<< "top13,child14" << "top13,child15" |
|
569 |
<< "top13,child16" |
|
570 |
<< "top14" << "top14,child0" << "top14,child1" << "top14,child2" << "top14,child3" |
|
571 |
<< "top14,child6" |
|
572 |
<< "top14,child14" << "top14,child15" |
|
573 |
<< "top14,child16" |
|
574 |
<< "top15" << "top15,child0" << "top15,child1" << "top15,child2" << "top15,child3" |
|
575 |
<< "top15,child6" |
|
576 |
<< "top15,child14" << "top15,child15" |
|
577 |
<< "top15,child16" |
|
578 |
<< "top16" << "top16,child0" << "top16,child1" << "top16,child2" << "top16,child3" |
|
579 |
<< "top16,child6" |
|
580 |
<< "top16,child14" << "top16,child15" |
|
581 |
<< "top16,child16"); |
|
582 |
||
583 |
QTest::newRow("Match DragDisabled") << 0 << (int)QTreeWidgetItemIterator::DragDisabled |
|
584 |
<< (QStringList() |
|
585 |
||
586 |
/* top0 */ |
|
587 |
<< "top0,child4" << "top0,child5" << "top0,child7" << "top0,child8" |
|
588 |
<< "top0,child9" << "top0,child10" << "top0,child11" << "top0,child12" |
|
589 |
<< "top0,child13" |
|
590 |
/* top1 */ |
|
591 |
<< "top1,child4" << "top1,child5" << "top1,child7" << "top1,child8" |
|
592 |
<< "top1,child9" << "top1,child10" << "top1,child11" << "top1,child12" |
|
593 |
<< "top1,child13" |
|
594 |
/* top2 */ |
|
595 |
<< "top2,child4" << "top2,child5" << "top2,child7" << "top2,child8" |
|
596 |
<< "top2,child9" << "top2,child10" << "top2,child11" << "top2,child12" |
|
597 |
<< "top2,child13" |
|
598 |
/* top3 */ |
|
599 |
<< "top3,child4" << "top3,child5" << "top3,child7" << "top3,child8" |
|
600 |
<< "top3,child9" << "top3,child10" << "top3,child11" << "top3,child12" |
|
601 |
<< "top3,child13" |
|
602 |
<< "top4" |
|
603 |
<< "top4,child4" << "top4,child5" << "top4,child7" << "top4,child8" |
|
604 |
<< "top4,child9" << "top4,child10" << "top4,child11" << "top4,child12" |
|
605 |
<< "top4,child13" |
|
606 |
<< "top5" |
|
607 |
<< "top5,child4" << "top5,child5" << "top5,child7" << "top5,child8" |
|
608 |
<< "top5,child9" << "top5,child10" << "top5,child11" << "top5,child12" |
|
609 |
<< "top5,child13" |
|
610 |
/* "top6"*/ |
|
611 |
<< "top6,child4" << "top6,child5" << "top6,child7" << "top6,child8" |
|
612 |
<< "top6,child9" << "top6,child10" << "top6,child11" << "top6,child12" |
|
613 |
<< "top6,child13" |
|
614 |
<< "top7" |
|
615 |
<< "top7,child4" << "top7,child5" << "top7,child7" << "top7,child8" |
|
616 |
<< "top7,child9" << "top7,child10" << "top7,child11" << "top7,child12" |
|
617 |
<< "top7,child13" |
|
618 |
<< "top8" |
|
619 |
<< "top8,child4" << "top8,child5" << "top8,child7" << "top8,child8" |
|
620 |
<< "top8,child9" << "top8,child10" << "top8,child11" << "top8,child12" |
|
621 |
<< "top8,child13" |
|
622 |
<< "top9" |
|
623 |
<< "top9,child4" << "top9,child5" << "top9,child7" << "top9,child8" |
|
624 |
<< "top9,child9" << "top9,child10" << "top9,child11" << "top9,child12" |
|
625 |
<< "top9,child13" |
|
626 |
<< "top10" |
|
627 |
<< "top10,child4" << "top10,child5" << "top10,child7" << "top10,child8" |
|
628 |
<< "top10,child9" << "top10,child10" << "top10,child11" << "top10,child12" |
|
629 |
<< "top10,child13" |
|
630 |
<< "top11" |
|
631 |
<< "top11,child4" << "top11,child5" << "top11,child7" << "top11,child8" |
|
632 |
<< "top11,child9" << "top11,child10" << "top11,child11" << "top11,child12" |
|
633 |
<< "top11,child13" |
|
634 |
<< "top12" |
|
635 |
<< "top12,child4" << "top12,child5" << "top12,child7" << "top12,child8" |
|
636 |
<< "top12,child9" << "top12,child10" << "top12,child11" << "top12,child12" |
|
637 |
<< "top12,child13" |
|
638 |
<< "top13" |
|
639 |
<< "top13,child4" << "top13,child5" << "top13,child7" << "top13,child8" |
|
640 |
<< "top13,child9" << "top13,child10" << "top13,child11" << "top13,child12" |
|
641 |
<< "top13,child13" |
|
642 |
/* top14 */ |
|
643 |
<< "top14,child4" << "top14,child5" << "top14,child7" << "top14,child8" |
|
644 |
<< "top14,child9" << "top14,child10" << "top14,child11" << "top14,child12" |
|
645 |
<< "top14,child13" |
|
646 |
/* top15 */ |
|
647 |
<< "top15,child4" << "top15,child5" << "top15,child7" << "top15,child8" |
|
648 |
<< "top15,child9" << "top15,child10" << "top15,child11" << "top15,child12" |
|
649 |
<< "top15,child13" |
|
650 |
/* top16 */ |
|
651 |
<< "top16,child4" << "top16,child5" << "top16,child7" << "top16,child8" |
|
652 |
<< "top16,child9" << "top16,child10" << "top16,child11" << "top16,child12" |
|
653 |
<< "top16,child13" ); |
|
654 |
||
655 |
||
656 |
QTest::newRow("Match DropEnabled") << 0 << (int)QTreeWidgetItemIterator::DropEnabled |
|
657 |
<< (QStringList() |
|
658 |
<< "top0" << "top0,child0" << "top0,child1" << "top0,child2" << "top0,child3" |
|
659 |
<< "top0,child8" |
|
660 |
<< "top0,child14" << "top0,child15" |
|
661 |
<< "top0,child16" |
|
662 |
<< "top1" << "top1,child0" << "top1,child1" << "top1,child2" << "top1,child3" |
|
663 |
<< "top1,child8" |
|
664 |
<< "top1,child14" << "top1,child15" |
|
665 |
<< "top1,child16" |
|
666 |
<< "top2" << "top2,child0" << "top2,child1" << "top2,child2" << "top2,child3" |
|
667 |
<< "top2,child8" |
|
668 |
<< "top2,child14" << "top2,child15" |
|
669 |
<< "top2,child16" |
|
670 |
<< "top3" << "top3,child0" << "top3,child1" << "top3,child2" << "top3,child3" |
|
671 |
<< "top3,child8" |
|
672 |
<< "top3,child14" << "top3,child15" |
|
673 |
<< "top3,child16" |
|
674 |
/* "top4"*/ << "top4,child0" << "top4,child1" << "top4,child2" << "top4,child3" |
|
675 |
<< "top4,child8" |
|
676 |
<< "top4,child14" << "top4,child15" |
|
677 |
<< "top4,child16" |
|
678 |
/* "top5"*/ << "top5,child0" << "top5,child1" << "top5,child2" << "top5,child3" |
|
679 |
<< "top5,child8" |
|
680 |
<< "top5,child14" << "top5,child15" |
|
681 |
<< "top5,child16" |
|
682 |
/* "top6"*/ << "top6,child0" << "top6,child1" << "top6,child2" << "top6,child3" |
|
683 |
<< "top6,child8" |
|
684 |
<< "top6,child14" << "top6,child15" |
|
685 |
<< "top6,child16" |
|
686 |
/* "top7"*/ << "top7,child0" << "top7,child1" << "top7,child2" << "top7,child3" |
|
687 |
<< "top7,child8" |
|
688 |
<< "top7,child14" << "top7,child15" |
|
689 |
<< "top7,child16" |
|
690 |
<< "top8" << "top8,child0" << "top8,child1" << "top8,child2" << "top8,child3" |
|
691 |
<< "top8,child8" |
|
692 |
<< "top8,child14" << "top8,child15" |
|
693 |
<< "top8,child16" |
|
694 |
/* "top9"*/ << "top9,child0" << "top9,child1" << "top9,child2" << "top9,child3" |
|
695 |
<< "top9,child8" |
|
696 |
<< "top9,child14" << "top9,child15" |
|
697 |
<< "top9,child16" |
|
698 |
/* "top10*/ << "top10,child0" << "top10,child1" << "top10,child2" << "top10,child3" |
|
699 |
<< "top10,child8" |
|
700 |
<< "top10,child14" << "top10,child15" |
|
701 |
<< "top10,child16" |
|
702 |
/* "top11*/ << "top11,child0" << "top11,child1" << "top11,child2" << "top11,child3" |
|
703 |
<< "top11,child8" |
|
704 |
<< "top11,child14" << "top11,child15" |
|
705 |
<< "top11,child16" |
|
706 |
/* "top12*/ << "top12,child0" << "top12,child1" << "top12,child2" << "top12,child3" |
|
707 |
<< "top12,child8" |
|
708 |
<< "top12,child14" << "top12,child15" |
|
709 |
<< "top12,child16" |
|
710 |
/* "top13*/ << "top13,child0" << "top13,child1" << "top13,child2" << "top13,child3" |
|
711 |
<< "top13,child8" |
|
712 |
<< "top13,child14" << "top13,child15" |
|
713 |
<< "top13,child16" |
|
714 |
<< "top14" << "top14,child0" << "top14,child1" << "top14,child2" << "top14,child3" |
|
715 |
<< "top14,child8" |
|
716 |
<< "top14,child14" << "top14,child15" |
|
717 |
<< "top14,child16" |
|
718 |
<< "top15" << "top15,child0" << "top15,child1" << "top15,child2" << "top15,child3" |
|
719 |
<< "top15,child8" |
|
720 |
<< "top15,child14" << "top15,child15" |
|
721 |
<< "top15,child16" |
|
722 |
<< "top16" << "top16,child0" << "top16,child1" << "top16,child2" << "top16,child3" |
|
723 |
<< "top16,child8" |
|
724 |
<< "top16,child14" << "top16,child15" |
|
725 |
<< "top16,child16"); |
|
726 |
||
727 |
QTest::newRow("Match HasChildren") << 0 << (int)QTreeWidgetItemIterator::HasChildren |
|
728 |
<< (QStringList() << "top0" << "top1" << "top2" << "top3" << "top4" << "top5" |
|
729 |
<< "top6" << "top7" << "top8" << "top9" << "top10" << "top11" << "top12" |
|
730 |
<< "top13" << "top14" << "top15" << "top16"); |
|
731 |
||
732 |
QTest::newRow("Match Checked") << 0 << (int)QTreeWidgetItemIterator::Checked |
|
733 |
<< (QStringList() |
|
734 |
<< "top0,child14" << "top0,child16" |
|
735 |
<< "top1,child14" << "top1,child16" |
|
736 |
<< "top2,child14" << "top2,child16" |
|
737 |
<< "top3,child14" << "top3,child16" |
|
738 |
<< "top4,child14" << "top4,child16" |
|
739 |
<< "top5,child14" << "top5,child16" |
|
740 |
<< "top6,child14" << "top6,child16" |
|
741 |
<< "top7,child14" << "top7,child16" |
|
742 |
<< "top8,child14" << "top8,child16" |
|
743 |
<< "top9,child14" << "top9,child16" |
|
744 |
<< "top10,child14" << "top10,child16" |
|
745 |
<< "top11,child14" << "top11,child16" |
|
746 |
<< "top12,child14" << "top12,child16" |
|
747 |
<< "top13,child14" << "top13,child16" |
|
748 |
<< "top14" |
|
749 |
<< "top14,child14" << "top14,child16" |
|
750 |
<< "top15,child14" << "top15,child16" |
|
751 |
<< "top16" |
|
752 |
<< "top16,child14" << "top16,child16"); |
|
753 |
||
754 |
QTest::newRow("Match NotChecked") << 0 << (int)QTreeWidgetItemIterator::NotChecked |
|
755 |
<< (QStringList() |
|
756 |
<< "top0" << "top0,child0" << "top0,child1" << "top0,child2" << "top0,child3" |
|
757 |
<< "top0,child4" << "top0,child5" << "top0,child6" << "top0,child7" |
|
758 |
<< "top0,child8" << "top0,child9" << "top0,child10" << "top0,child11" |
|
759 |
<< "top0,child12" << "top0,child13" << "top0,child15" |
|
760 |
||
761 |
<< "top1" << "top1,child0" << "top1,child1" << "top1,child2" << "top1,child3" |
|
762 |
<< "top1,child4" << "top1,child5" << "top1,child6" << "top1,child7" |
|
763 |
<< "top1,child8" << "top1,child9" << "top1,child10" << "top1,child11" |
|
764 |
<< "top1,child12" << "top1,child13" << "top1,child15" |
|
765 |
||
766 |
<< "top2" << "top2,child0" << "top2,child1" << "top2,child2" << "top2,child3" |
|
767 |
<< "top2,child4" << "top2,child5" << "top2,child6" << "top2,child7" |
|
768 |
<< "top2,child8" << "top2,child9" << "top2,child10" << "top2,child11" |
|
769 |
<< "top2,child12" << "top2,child13" << "top2,child15" |
|
770 |
||
771 |
<< "top3" << "top3,child0" << "top3,child1" << "top3,child2" << "top3,child3" |
|
772 |
<< "top3,child4" << "top3,child5" << "top3,child6" << "top3,child7" |
|
773 |
<< "top3,child8" << "top3,child9" << "top3,child10" << "top3,child11" |
|
774 |
<< "top3,child12" << "top3,child13" << "top3,child15" |
|
775 |
||
776 |
<< "top4" << "top4,child0" << "top4,child1" << "top4,child2" << "top4,child3" |
|
777 |
<< "top4,child4" << "top4,child5" << "top4,child6" << "top4,child7" |
|
778 |
<< "top4,child8" << "top4,child9" << "top4,child10" << "top4,child11" |
|
779 |
<< "top4,child12" << "top4,child13" << "top4,child15" |
|
780 |
||
781 |
<< "top5" << "top5,child0" << "top5,child1" << "top5,child2" << "top5,child3" |
|
782 |
<< "top5,child4" << "top5,child5" << "top5,child6" << "top5,child7" |
|
783 |
<< "top5,child8" << "top5,child9" << "top5,child10" << "top5,child11" |
|
784 |
<< "top5,child12" << "top5,child13" << "top5,child15" |
|
785 |
||
786 |
<< "top6" << "top6,child0" << "top6,child1" << "top6,child2" << "top6,child3" |
|
787 |
<< "top6,child4" << "top6,child5" << "top6,child6" << "top6,child7" |
|
788 |
<< "top6,child8" << "top6,child9" << "top6,child10" << "top6,child11" |
|
789 |
<< "top6,child12" << "top6,child13" << "top6,child15" |
|
790 |
||
791 |
<< "top7" << "top7,child0" << "top7,child1" << "top7,child2" << "top7,child3" |
|
792 |
<< "top7,child4" << "top7,child5" << "top7,child6" << "top7,child7" |
|
793 |
<< "top7,child8" << "top7,child9" << "top7,child10" << "top7,child11" |
|
794 |
<< "top7,child12" << "top7,child13" << "top7,child15" |
|
795 |
||
796 |
<< "top8" << "top8,child0" << "top8,child1" << "top8,child2" << "top8,child3" |
|
797 |
<< "top8,child4" << "top8,child5" << "top8,child6" << "top8,child7" |
|
798 |
<< "top8,child8" << "top8,child9" << "top8,child10" << "top8,child11" |
|
799 |
<< "top8,child12" << "top8,child13" << "top8,child15" |
|
800 |
||
801 |
<< "top9" << "top9,child0" << "top9,child1" << "top9,child2" << "top9,child3" |
|
802 |
<< "top9,child4" << "top9,child5" << "top9,child6" << "top9,child7" |
|
803 |
<< "top9,child8" << "top9,child9" << "top9,child10" << "top9,child11" |
|
804 |
<< "top9,child12" << "top9,child13" << "top9,child15" |
|
805 |
||
806 |
<< "top10" << "top10,child0" << "top10,child1" << "top10,child2" << "top10,child3" |
|
807 |
<< "top10,child4" << "top10,child5" << "top10,child6" << "top10,child7" |
|
808 |
<< "top10,child8" << "top10,child9" << "top10,child10" << "top10,child11" |
|
809 |
<< "top10,child12" << "top10,child13" << "top10,child15" |
|
810 |
||
811 |
<< "top11" << "top11,child0" << "top11,child1" << "top11,child2" << "top11,child3" |
|
812 |
<< "top11,child4" << "top11,child5" << "top11,child6" << "top11,child7" |
|
813 |
<< "top11,child8" << "top11,child9" << "top11,child10" << "top11,child11" |
|
814 |
<< "top11,child12" << "top11,child13" << "top11,child15" |
|
815 |
||
816 |
<< "top12" << "top12,child0" << "top12,child1" << "top12,child2" << "top12,child3" |
|
817 |
<< "top12,child4" << "top12,child5" << "top12,child6" << "top12,child7" |
|
818 |
<< "top12,child8" << "top12,child9" << "top12,child10" << "top12,child11" |
|
819 |
<< "top12,child12" << "top12,child13" << "top12,child15" |
|
820 |
||
821 |
<< "top13" << "top13,child0" << "top13,child1" << "top13,child2" << "top13,child3" |
|
822 |
<< "top13,child4" << "top13,child5" << "top13,child6" << "top13,child7" |
|
823 |
<< "top13,child8" << "top13,child9" << "top13,child10" << "top13,child11" |
|
824 |
<< "top13,child12" << "top13,child13" << "top13,child15" |
|
825 |
||
826 |
/* "top14"*/<< "top14,child0" << "top14,child1" << "top14,child2" << "top14,child3" |
|
827 |
<< "top14,child4" << "top14,child5" << "top14,child6" << "top14,child7" |
|
828 |
<< "top14,child8" << "top14,child9" << "top14,child10" << "top14,child11" |
|
829 |
<< "top14,child12" << "top14,child13" << "top14,child15" |
|
830 |
||
831 |
<< "top15" << "top15,child0" << "top15,child1" << "top15,child2" << "top15,child3" |
|
832 |
<< "top15,child4" << "top15,child5" << "top15,child6" << "top15,child7" |
|
833 |
<< "top15,child8" << "top15,child9" << "top15,child10" << "top15,child11" |
|
834 |
<< "top15,child12" << "top15,child13" << "top15,child15" |
|
835 |
||
836 |
/* "top16"*/<< "top16,child0" << "top16,child1" << "top16,child2" << "top16,child3" |
|
837 |
<< "top16,child4" << "top16,child5" << "top16,child6" << "top16,child7" |
|
838 |
<< "top16,child8" << "top16,child9" << "top16,child10" << "top16,child11" |
|
839 |
<< "top16,child12" << "top16,child13" << "top16,child15"); |
|
840 |
||
841 |
||
842 |
||
843 |
QTest::newRow("Match Disabled") << 0 << (int)QTreeWidgetItemIterator::Disabled |
|
844 |
<< (QStringList() |
|
845 |
<< "top0,child11" |
|
846 |
<< "top1,child11" |
|
847 |
<< "top2,child11" |
|
848 |
<< "top3,child11" |
|
849 |
<< "top4,child11" |
|
850 |
<< "top5,child11" |
|
851 |
<< "top6,child11" |
|
852 |
<< "top7,child11" |
|
853 |
<< "top8,child11" |
|
854 |
<< "top9,child11" |
|
855 |
<< "top10,child11" |
|
856 |
<< "top11" |
|
857 |
<< "top11,child0" |
|
858 |
<< "top11,child1" |
|
859 |
<< "top11,child2" |
|
860 |
<< "top11,child3" |
|
861 |
<< "top11,child4" |
|
862 |
<< "top11,child5" |
|
863 |
<< "top11,child6" |
|
864 |
<< "top11,child7" |
|
865 |
<< "top11,child8" |
|
866 |
<< "top11,child9" |
|
867 |
<< "top11,child10" |
|
868 |
<< "top11,child11" |
|
869 |
<< "top11,child12" |
|
870 |
<< "top11,child13" |
|
871 |
<< "top11,child14" |
|
872 |
<< "top11,child15" |
|
873 |
<< "top11,child16" |
|
874 |
||
875 |
<< "top12,child11" |
|
876 |
<< "top13,child11" |
|
877 |
<< "top14,child11" |
|
878 |
<< "top15,child11" |
|
879 |
<< "top16,child11"); |
|
880 |
||
881 |
QTest::newRow("Match Editable") << 0 << (int)QTreeWidgetItemIterator::Editable |
|
882 |
<< (QStringList() |
|
883 |
<< "top0,child12" |
|
884 |
<< "top1,child12" |
|
885 |
<< "top2,child12" |
|
886 |
<< "top3,child12" |
|
887 |
<< "top4,child12" |
|
888 |
<< "top5,child12" |
|
889 |
<< "top6,child12" |
|
890 |
<< "top7,child12" |
|
891 |
<< "top8,child12" |
|
892 |
<< "top9,child12" |
|
893 |
<< "top10,child12" |
|
894 |
<< "top11,child12" |
|
895 |
<< "top12" |
|
896 |
<< "top12,child12" |
|
897 |
<< "top13,child12" |
|
898 |
<< "top14,child12" |
|
899 |
<< "top15,child12" |
|
900 |
<< "top16,child12"); |
|
901 |
||
902 |
QTest::newRow("Match mutually exclusive Hidden|NotHidden") << 0 << (int)(QTreeWidgetItemIterator::Hidden|QTreeWidgetItemIterator::NotHidden) |
|
903 |
<< QStringList(); |
|
904 |
QTest::newRow("Match mutually exclusive Selected|Unselected") << 0 << (int)(QTreeWidgetItemIterator::Selected|QTreeWidgetItemIterator::Unselected) |
|
905 |
<< QStringList(); |
|
906 |
QTest::newRow("Match mutually exclusive Selectable|NotSelectable") << 0 << (int)(QTreeWidgetItemIterator::Selectable|QTreeWidgetItemIterator::NotSelectable) |
|
907 |
<< QStringList(); |
|
908 |
QTest::newRow("Match mutually exclusive DragEnabled|DragDisabled") << 0 << (int)(QTreeWidgetItemIterator::DragEnabled|QTreeWidgetItemIterator::DragDisabled) |
|
909 |
<< QStringList(); |
|
910 |
QTest::newRow("Match mutually exclusive DropEnabled|DropDisabled") << 0 << (int)(QTreeWidgetItemIterator::DropEnabled|QTreeWidgetItemIterator::DropDisabled) |
|
911 |
<< QStringList(); |
|
912 |
QTest::newRow("Match mutually exclusive HasChildren|NoChildren") << 0 << (int)(QTreeWidgetItemIterator::HasChildren|QTreeWidgetItemIterator::NoChildren) |
|
913 |
<< QStringList(); |
|
914 |
QTest::newRow("Match mutually exclusive Checked|NotChecked") << 0 << (int)(QTreeWidgetItemIterator::Checked|QTreeWidgetItemIterator::NotChecked) |
|
915 |
<< QStringList(); |
|
916 |
QTest::newRow("Match mutually exclusive Disabled|Enabled") << 0 << (int)(QTreeWidgetItemIterator::Disabled|QTreeWidgetItemIterator::Enabled) |
|
917 |
<< QStringList(); |
|
918 |
QTest::newRow("Match mutually exclusive Editable|NotEditable") << 0 << (int)(QTreeWidgetItemIterator::Editable|QTreeWidgetItemIterator::NotEditable) |
|
919 |
<< QStringList(); |
|
920 |
} |
|
921 |
||
922 |
void tst_QTreeWidgetItemIterator::iteratorflags() |
|
923 |
{ |
|
924 |
QFETCH(int, start); |
|
925 |
QFETCH(int, iteratorflags); |
|
926 |
QFETCH(QStringList, matches); |
|
927 |
||
928 |
QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::IteratorFlags(iteratorflags)); |
|
929 |
it+=start; |
|
930 |
int iMatch = 0; |
|
931 |
while (*it && iMatch < matches.count()) { |
|
932 |
QTreeWidgetItem *item = *it; |
|
933 |
QCOMPARE(item->text(0), matches[iMatch]); |
|
934 |
++it; |
|
935 |
++iMatch; |
|
936 |
} |
|
937 |
// Make sure the expected result does not contain *more* items than the actual result. |
|
938 |
QCOMPARE(iMatch, matches.size()); |
|
939 |
} |
|
940 |
||
941 |
void tst_QTreeWidgetItemIterator::preincrement() |
|
942 |
{ |
|
943 |
QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::All); |
|
944 |
QTreeWidgetItem *item = *(++it); |
|
945 |
// should be the second one |
|
946 |
QCOMPARE(item->text(0), QString("top0,child0")); |
|
947 |
} |
|
948 |
||
949 |
void tst_QTreeWidgetItemIterator::postincrement() |
|
950 |
{ |
|
951 |
QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::All); |
|
952 |
QTreeWidgetItem *item = *(it++); |
|
953 |
// should be the first one |
|
954 |
QCOMPARE(item->text(0), QString("top0")); |
|
955 |
} |
|
956 |
||
957 |
void tst_QTreeWidgetItemIterator::predecrement() |
|
958 |
{ |
|
959 |
QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::All); |
|
960 |
QTreeWidgetItem *item = *(++it); |
|
961 |
// should be the second one |
|
962 |
QCOMPARE(item->text(0), QString("top0,child0")); |
|
963 |
||
964 |
item = *(--it); |
|
965 |
QCOMPARE(item->text(0), QString("top0")); |
|
966 |
||
967 |
} |
|
968 |
||
969 |
void tst_QTreeWidgetItemIterator::postdecrement() |
|
970 |
{ |
|
971 |
QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::All); |
|
972 |
QTreeWidgetItem *item = *(it++); |
|
973 |
// should be the first one |
|
974 |
QCOMPARE(item->text(0), QString("top0")); |
|
975 |
||
976 |
//Iterator points to second one |
|
977 |
item = *(it--); |
|
978 |
QCOMPARE(item->text(0), QString("top0,child0")); |
|
979 |
||
980 |
} |
|
981 |
||
982 |
void tst_QTreeWidgetItemIterator::plus_eq_data() |
|
983 |
{ |
|
984 |
QTest::addColumn<int>("start"); |
|
985 |
QTest::addColumn<int>("addition"); |
|
986 |
QTest::addColumn<int>("iteratorflags"); |
|
987 |
QTest::addColumn<QString>("expecteditem"); |
|
988 |
||
989 |
QTest::newRow("+=0") << 0 << 0 << (int)QTreeWidgetItemIterator::All << QString("top0"); |
|
990 |
QTest::newRow("+=1") << 0 << 1 << (int)QTreeWidgetItemIterator::All << QString("top0,child0"); |
|
991 |
QTest::newRow("+=2") << 0 << 2 << (int)QTreeWidgetItemIterator::All << QString("top0,child1"); |
|
992 |
QTest::newRow("+=(-1)") << 1 << -1 << (int)QTreeWidgetItemIterator::All << QString("top0"); |
|
993 |
QTest::newRow("+=(-2)") << 3 << -2 << (int)QTreeWidgetItemIterator::All << QString("top0,child0"); |
|
994 |
} |
|
995 |
||
996 |
void tst_QTreeWidgetItemIterator::plus_eq() |
|
997 |
{ |
|
998 |
QFETCH(int, start); |
|
999 |
QFETCH(int, addition); |
|
1000 |
QFETCH(int, iteratorflags); |
|
1001 |
QFETCH(QString, expecteditem); |
|
1002 |
||
1003 |
QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::IteratorFlags(iteratorflags)); |
|
1004 |
it+=start; |
|
1005 |
it+=addition; |
|
1006 |
QTreeWidgetItem *item = *it; |
|
1007 |
||
1008 |
QVERIFY(item); |
|
1009 |
QCOMPARE(item->text(0), expecteditem); |
|
1010 |
||
1011 |
} |
|
1012 |
||
1013 |
void tst_QTreeWidgetItemIterator::minus_eq_data() |
|
1014 |
{ |
|
1015 |
QTest::addColumn<int>("start"); |
|
1016 |
QTest::addColumn<int>("subtraction"); |
|
1017 |
QTest::addColumn<int>("iteratorflags"); |
|
1018 |
QTest::addColumn<QString>("expecteditem"); |
|
1019 |
||
1020 |
QTest::newRow("-=0") << 0 << 0 << (int)QTreeWidgetItemIterator::All << QString("top0"); |
|
1021 |
QTest::newRow("-=1") << 2 << 1 << (int)QTreeWidgetItemIterator::All << QString("top0,child0"); |
|
1022 |
QTest::newRow("-=2") << 4 << 2 << (int)QTreeWidgetItemIterator::All << QString("top0,child1"); |
|
1023 |
QTest::newRow("-=(-1)") << 0 << -1 << (int)QTreeWidgetItemIterator::All << QString("top0,child0"); |
|
1024 |
QTest::newRow("-=(-2)") << 0 << -2 << (int)QTreeWidgetItemIterator::All << QString("top0,child1"); |
|
1025 |
QTest::newRow("-=1)") << 18 << 1 << (int)QTreeWidgetItemIterator::All << QString("top0,child16"); |
|
1026 |
QTest::newRow("-=1)") << 1 << 1 << (int)QTreeWidgetItemIterator::All << QString("top0"); |
|
1027 |
} |
|
1028 |
||
1029 |
void tst_QTreeWidgetItemIterator::minus_eq() |
|
1030 |
{ |
|
1031 |
QFETCH(int, start); |
|
1032 |
QFETCH(int, subtraction); |
|
1033 |
QFETCH(int, iteratorflags); |
|
1034 |
QFETCH(QString, expecteditem); |
|
1035 |
||
1036 |
QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::IteratorFlags(iteratorflags)); |
|
1037 |
it+=start; |
|
1038 |
it-=subtraction; |
|
1039 |
QTreeWidgetItem *item = *it; |
|
1040 |
// should be the first one |
|
1041 |
QVERIFY(item); |
|
1042 |
QCOMPARE(item->text(0), expecteditem); |
|
1043 |
} |
|
1044 |
||
1045 |
void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget_data() |
|
1046 |
{ |
|
1047 |
QTest::addColumn<int>("topLevelItems"); |
|
1048 |
QTest::addColumn<int>("childItems"); |
|
1049 |
QTest::addColumn<int>("grandChildItems"); |
|
1050 |
QTest::addColumn<int>("iteratorflags"); |
|
1051 |
QTest::addColumn<int>("removeindex"); |
|
1052 |
QTest::addColumn<int>("expecteditemindex"); |
|
1053 |
QTest::addColumn<QString>("expecteditemvalue"); |
|
1054 |
QTest::addColumn<QString>("expectedUpdatedCurrent"); |
|
1055 |
QTest::addColumn<int>("expecteditemIsNull"); |
|
1056 |
||
1057 |
QTest::newRow("Remove 3, check 1") << 3 << 3 << 0 << (int)QTreeWidgetItemIterator::All |
|
1058 |
<< 3 << 1 << QString("top0,child0") << QString("top1") << 0; |
|
1059 |
QTest::newRow("Remove 1, check 0") << 3 << 3 << 0 << (int)QTreeWidgetItemIterator::All |
|
1060 |
<< 1 << 0 << QString("top0") << QString("top0,child1") << 0; |
|
1061 |
QTest::newRow("Remove 2, check 2") << 3 << 3 << 0 << (int)QTreeWidgetItemIterator::All |
|
1062 |
<< 2 << 2 << QString("top0,child2") << QString("top0,child2") << 0; |
|
1063 |
QTest::newRow("Remove 0, check 0") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All |
|
1064 |
<< 0 << 0 << QString("top1") << QString("top1") << 0; |
|
1065 |
QTest::newRow("Remove top1, check top1") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All |
|
1066 |
<< 13 << 13 << QString("top2") << QString("top2") << 0; |
|
1067 |
QTest::newRow("Remove top0, check top1") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All |
|
1068 |
<< 0 << 13 << QString("top1") << QString("top1") << 0; |
|
1069 |
QTest::newRow("Remove (top0,child1), check (top0,child1)") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All |
|
1070 |
<< 5 << 5 << QString("top0,child2") << QString("top0,child2") << 0; |
|
1071 |
QTest::newRow("Remove (t0,c0) check (t0,c0)") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All |
|
1072 |
<< 1 << 1 << QString("top0,child1") << QString("top0,child1") << 0; |
|
1073 |
QTest::newRow("Remove (t0,c1) check (t0,c1)") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All |
|
1074 |
<< 5 << 5 << QString("top0,child2") << QString("top0,child2") << 0; |
|
1075 |
QTest::newRow("Remove (t0) check (t0,c1)") << 3 << 3 << 0 << (int)QTreeWidgetItemIterator::All |
|
1076 |
<< 0 << 4 << QString("top1") << QString("top1") << 0; |
|
1077 |
QTest::newRow("Remove (t0) check (t0,c0,g1)") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All |
|
1078 |
<< 0 << 3 << QString("top1") << QString("top1") << 0; |
|
1079 |
QTest::newRow("Remove (top2), check if top2 is null") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All |
|
1080 |
<< 2*13 << 2*13 << QString() << QString() << 1; |
|
1081 |
QTest::newRow("Remove last item, check if iterator::current returns 0") |
|
1082 |
<< 3 << 0 << 0 << (int)QTreeWidgetItemIterator::All << 2 << 2 << QString() << QString() << 1; |
|
1083 |
QTest::newRow("remove 1, iterator points to 3, should move to 1") |
|
1084 |
<< 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All << 1 << 3 << QString("top0,child1") << QString("top0,child1") << 0; |
|
1085 |
} |
|
1086 |
||
1087 |
void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget() |
|
1088 |
{ |
|
1089 |
QFETCH(int, topLevelItems); |
|
1090 |
QFETCH(int, childItems); |
|
1091 |
QFETCH(int, grandChildItems); |
|
1092 |
QFETCH(int, iteratorflags); |
|
1093 |
QFETCH(int, removeindex); |
|
1094 |
QFETCH(int, expecteditemindex); |
|
1095 |
QFETCH(QString, expecteditemvalue); |
|
1096 |
QFETCH(QString, expectedUpdatedCurrent); |
|
1097 |
QFETCH(int, expecteditemIsNull); |
|
1098 |
||
1099 |
QTreeWidget tw; |
|
1100 |
tw.clear(); |
|
1101 |
tw.setColumnCount(2); |
|
1102 |
for (int i1=0; i1 < topLevelItems; ++i1) { |
|
1103 |
QTreeWidgetItem *top = new QTreeWidgetItem(&tw); |
|
1104 |
top->setText(0, QString("top%1").arg(i1)); |
|
1105 |
for (int i2=0; i2 < childItems; ++i2) { |
|
1106 |
QTreeWidgetItem *child = new QTreeWidgetItem(top); |
|
1107 |
child->setText(0, QString("top%1,child%2").arg(i1).arg(i2)); |
|
1108 |
for (int i3=0; i3 < grandChildItems; ++i3) { |
|
1109 |
QTreeWidgetItem *grandChild = new QTreeWidgetItem(child); |
|
1110 |
grandChild->setText(0, QString("top%1,child%2,grandchild%3").arg(i1).arg(i2).arg(i3)); |
|
1111 |
} |
|
1112 |
} |
|
1113 |
} |
|
1114 |
||
1115 |
QTreeWidgetItemIterator it(&tw, QTreeWidgetItemIterator::IteratorFlags(iteratorflags)); |
|
1116 |
it+=expecteditemindex; |
|
1117 |
QTreeWidgetItem *item = 0; |
|
1118 |
QTreeWidgetItemIterator itRemove(&tw, QTreeWidgetItemIterator::IteratorFlags(iteratorflags)); |
|
1119 |
itRemove+=removeindex; |
|
1120 |
item = *itRemove; |
|
1121 |
QVERIFY(item); |
|
1122 |
delete item; |
|
1123 |
item = *it; |
|
1124 |
if (expecteditemIsNull) { |
|
1125 |
QVERIFY(item == 0); |
|
1126 |
} else { |
|
1127 |
QVERIFY(item); |
|
1128 |
QCOMPARE(item->text(0), expecteditemvalue); |
|
1129 |
item = *itRemove; |
|
1130 |
if (expectedUpdatedCurrent.isNull()) { |
|
1131 |
QVERIFY(item == 0); |
|
1132 |
} else { |
|
1133 |
QCOMPARE(item->text(0), expectedUpdatedCurrent); |
|
1134 |
} |
|
1135 |
} |
|
1136 |
} |
|
1137 |
||
1138 |
void tst_QTreeWidgetItemIterator::updateIteratorAfterDeletedItem_and_ContinueIteration_data() |
|
1139 |
{ |
|
1140 |
QTest::addColumn<int>("topLevelItems"); |
|
1141 |
QTest::addColumn<int>("childItems"); |
|
1142 |
QTest::addColumn<int>("grandChildItems"); // Populate the tree data |
|
1143 |
// we have one iterator pointing to an item in the tree. |
|
1144 |
// This iterator will be updated if we delete the item it is pointing to. |
|
1145 |
// |
|
1146 |
QTest::addColumn<int>("removeindex"); // The index of the node we want to remove |
|
1147 |
QTest::addColumn<int>("iterator_initial_index"); // The new expected index of |
|
1148 |
QTest::addColumn<int>("iterator_advance_after_removal"); |
|
1149 |
QTest::addColumn<QString>("iterator_new_value"); // The new current item value of the iterator |
|
1150 |
QTest::newRow("Remove 13, it points to 25, it-=1. We should get top0,child2,grandchild2") << 3 << 3 << 3 << 13 << 25 << -1 << QString("top0,child2,grandchild2"); |
|
1151 |
QTest::newRow("Remove 0, it points to 12, it+=1. We should get top1,child0") << 3 << 3 << 3 << 0 << 12 << 1 << QString("top1,child0"); |
|
1152 |
QTest::newRow("Remove 0, it points to 12, it-=1. We should get 0") << 3 << 3 << 3 << 0 << 12 << -1 << QString(); |
|
1153 |
QTest::newRow("Remove 0, it points to 1, it+=1. We should get top2") << 4 << 0 << 0 << 0 << 1 << 1 << QString("top2"); |
|
1154 |
QTest::newRow("Remove 2, it points to 1, it+=0. We should get top1") << 4 << 0 << 0 << 2 << 1 << 0 << QString("top1"); |
|
1155 |
QTest::newRow("Remove 2, it points to 1, it+=1. We should get top3") << 4 << 0 << 0 << 2 << 1 << 1 << QString("top3"); |
|
1156 |
QTest::newRow("Remove 1, it points to 2, it+=1. We should get top0,child2") << 3 << 3 << 0 << 1 << 2 << 1 << QString("top0,child2"); |
|
1157 |
QTest::newRow("Remove 1, it points to 2, it+=0. We should get top0,child1") << 3 << 3 << 0 << 1 << 2 << 0 << QString("top0,child1"); |
|
1158 |
QTest::newRow("Remove 1, it points to 2, it-=1. We should get top0") << 3 << 3 << 0 << 1 << 2 << -1 << QString("top0"); |
|
1159 |
} |
|
1160 |
||
1161 |
void tst_QTreeWidgetItemIterator::updateIteratorAfterDeletedItem_and_ContinueIteration() |
|
1162 |
{ |
|
1163 |
QFETCH(int, topLevelItems); |
|
1164 |
QFETCH(int, childItems); |
|
1165 |
QFETCH(int, grandChildItems); |
|
1166 |
QFETCH(int, removeindex); |
|
1167 |
QFETCH(int, iterator_initial_index); |
|
1168 |
QFETCH(int, iterator_advance_after_removal); |
|
1169 |
QFETCH(QString, iterator_new_value); |
|
1170 |
||
1171 |
QTreeWidget tw; |
|
1172 |
tw.clear(); |
|
1173 |
tw.setColumnCount(2); |
|
1174 |
for (int i1=0; i1 < topLevelItems; ++i1) { |
|
1175 |
QTreeWidgetItem *top = new QTreeWidgetItem(&tw); |
|
1176 |
top->setText(0, QString("top%1").arg(i1)); |
|
1177 |
for (int i2=0; i2 < childItems; ++i2) { |
|
1178 |
QTreeWidgetItem *child = new QTreeWidgetItem(top); |
|
1179 |
child->setText(0, QString("top%1,child%2").arg(i1).arg(i2)); |
|
1180 |
for (int i3=0; i3 < grandChildItems; ++i3) { |
|
1181 |
QTreeWidgetItem *grandChild = new QTreeWidgetItem(child); |
|
1182 |
grandChild->setText(0, QString("top%1,child%2,grandchild%3").arg(i1).arg(i2).arg(i3)); |
|
1183 |
} |
|
1184 |
} |
|
1185 |
} |
|
1186 |
||
1187 |
QTreeWidgetItemIterator it(&tw, QTreeWidgetItemIterator::All); |
|
1188 |
it += iterator_initial_index; |
|
1189 |
QTreeWidgetItem *item = 0; |
|
1190 |
QTreeWidgetItemIterator itRemove(&tw, QTreeWidgetItemIterator::All); |
|
1191 |
itRemove+=removeindex; |
|
1192 |
item = *itRemove; |
|
1193 |
QVERIFY(item); |
|
1194 |
delete item; |
|
1195 |
it+=iterator_advance_after_removal; |
|
1196 |
if (iterator_new_value.isNull()) { |
|
1197 |
QCOMPARE((*it), (QTreeWidgetItem*)0); |
|
1198 |
} else { |
|
1199 |
QCOMPARE((*it)->text(0), iterator_new_value); |
|
1200 |
} |
|
1201 |
} |
|
1202 |
||
1203 |
void tst_QTreeWidgetItemIterator::constructIteratorWithItem_data() |
|
1204 |
{ |
|
1205 |
QTest::addColumn<int>("indextoitem"); |
|
1206 |
QTest::addColumn<int>("iteratorflags"); |
|
1207 |
QTest::addColumn<QString>("expecteditem"); |
|
1208 |
||
1209 |
QTest::newRow("index 0") << 0 << 0 << QString("top0"); |
|
1210 |
QTest::newRow("index 1") << 1 << 0 << QString("top0,child0"); |
|
1211 |
QTest::newRow("index 2") << 2 << 0 << QString("top0,child1"); |
|
1212 |
QTest::newRow("index 30") << 30 << 0 << QString("top1,child11"); |
|
1213 |
QTest::newRow("305 (last item)") << 305 << 0 << QString("top16,child16"); |
|
1214 |
QTest::newRow("index 0, advance to next matching node") << 0 << (int)QTreeWidgetItemIterator::NotHidden << QString("top0,child1"); |
|
1215 |
} |
|
1216 |
||
1217 |
void tst_QTreeWidgetItemIterator::constructIteratorWithItem() |
|
1218 |
{ |
|
1219 |
QFETCH(int, indextoitem); |
|
1220 |
QFETCH(int, iteratorflags); |
|
1221 |
QFETCH(QString, expecteditem); |
|
1222 |
||
1223 |
QTreeWidgetItemIterator it(testWidget); |
|
1224 |
it+=indextoitem; |
|
1225 |
QTreeWidgetItem *item = *it; |
|
1226 |
QTreeWidgetItemIterator it2(item, QTreeWidgetItemIterator::IteratorFlags(iteratorflags)); |
|
1227 |
QTreeWidgetItem *item2 = *it2; |
|
1228 |
||
1229 |
QVERIFY(item2); |
|
1230 |
QCOMPARE(item2->text(0), expecteditem); |
|
1231 |
||
1232 |
} |
|
1233 |
||
1234 |
void tst_QTreeWidgetItemIterator::initializeIterator() |
|
1235 |
{ |
|
1236 |
QTreeWidget tw; |
|
1237 |
QTreeWidgetItemIterator it(&tw); |
|
1238 |
||
1239 |
QCOMPARE((*it), static_cast<QTreeWidgetItem*>(0)); |
|
1240 |
} |
|
1241 |
||
1242 |
QTEST_MAIN(tst_QTreeWidgetItemIterator) |
|
1243 |
#include "tst_qtreewidgetitemiterator.moc" |