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


#include <QtTest/QtTest>

#include <qtreewidget.h>
#include <qtreewidgetitemiterator.h>
#include <qapplication.h>
#include <qeventloop.h>
#include <qdebug.h>

//TESTED_CLASS=
//TESTED_FILES=

class tst_QTreeWidgetItemIterator : public QObject
{
    Q_OBJECT

public:
    tst_QTreeWidgetItemIterator();
    ~tst_QTreeWidgetItemIterator();

public slots:
    void initTestCase();
    void cleanupTestCase();
    void init();
    void cleanup();

private slots:
    void postincrement();
    void preincrement();
    void postdecrement();
    void predecrement();
    void plus_eq_data();
    void plus_eq();
    void minus_eq_data();
    void minus_eq();
    void iteratorflags_data();
    void iteratorflags();
    void updateIfModifiedFromWidget_data();
    void updateIfModifiedFromWidget();
    void constructIteratorWithItem_data();
    void constructIteratorWithItem();
    void updateIteratorAfterDeletedItem_and_ContinueIteration_data();
    void updateIteratorAfterDeletedItem_and_ContinueIteration();
    void initializeIterator();
private:
    QTreeWidget *testWidget;
};

tst_QTreeWidgetItemIterator::tst_QTreeWidgetItemIterator(): testWidget(0)
{
}

tst_QTreeWidgetItemIterator::~tst_QTreeWidgetItemIterator()
{
}

void tst_QTreeWidgetItemIterator::initTestCase()
{
    testWidget = new QTreeWidget();
    testWidget->clear();
    testWidget->setColumnCount(2);
    testWidget->show();


    /**
     * These are default:
     *
     *           Qt::ItemIsSelectable
     *          |Qt::ItemIsUserCheckable
     *          |Qt::ItemIsEnabled
     *          |Qt::ItemIsDragEnabled
     *          |Qt::ItemIsDropEnabled
     *
     */
    for (int i=0; i <= 16; ++i) {
        QTreeWidgetItem *top = new QTreeWidgetItem(testWidget);
        top->setText(0, QString("top%1").arg(i));
        switch (i) {
            case 0:  testWidget->setItemHidden(top, true);break;
            case 1:  testWidget->setItemHidden(top, false);break;

            case 2:  testWidget->setItemSelected(top, true);break;
            case 3:  testWidget->setItemSelected(top, false);break;

            case 4:  top->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);break;
            case 5:  top->setFlags(Qt::ItemIsEnabled);break;

            case 6:  top->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);break;
            case 7:  top->setFlags(Qt::ItemIsEnabled);break;

            case 8:  top->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);break;
            case 9:  top->setFlags(Qt::ItemIsEnabled);break;

            case 10:  top->setFlags(Qt::ItemIsEnabled);break;
            case 11:
                top->setFlags(0);
                break;

            case 12:  top->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable);break;
            case 13:  top->setFlags(Qt::ItemIsEnabled);break;

            case 14: top->setCheckState(0, Qt::Checked);break;
            case 15: top->setCheckState(0, Qt::Unchecked);break;
            case 16: top->setCheckState(0, Qt::PartiallyChecked);break;
        }
        for (int j=0; j <= 16; ++j) {
            QTreeWidgetItem *child = new QTreeWidgetItem(top);
            child->setText(0, QString("top%1,child%2").arg(i).arg(j));
            switch (j) {
                case 0:  testWidget->setItemHidden(child, true);break;
                case 1:  testWidget->setItemHidden(child, false);break;

                case 2:  testWidget->setItemSelected(child, true);break;
                case 3:  testWidget->setItemSelected(child, false);break;

                case 4:  child->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);break;
                case 5:  child->setFlags(Qt::ItemIsEnabled);break;

                case 6:  child->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);break;
                case 7:  child->setFlags(Qt::ItemIsEnabled);break;

                case 8:  child->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);break;
                case 9:  child->setFlags(Qt::ItemIsEnabled);break;

                case 10:  child->setFlags(Qt::ItemIsEnabled);break;
                case 11:  child->setFlags(0);break;

                case 12:  child->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable);break;
                case 13:  child->setFlags(Qt::ItemIsEnabled);break;

                case 14: child->setCheckState(0, Qt::Checked);break;
                case 15: child->setCheckState(0, Qt::Unchecked);break;
                case 16: child->setCheckState(0, Qt::PartiallyChecked);break;
            }

        }
    }
}

void tst_QTreeWidgetItemIterator::cleanupTestCase()
{
    testWidget->hide();
    delete testWidget;
}

void tst_QTreeWidgetItemIterator::init()
{
}

void tst_QTreeWidgetItemIterator::cleanup()
{
}

void tst_QTreeWidgetItemIterator::iteratorflags_data()
{
  /*
  // Should preferably test for all these flags (and combinations).....

        All           = 0x00000000,
        Hidden        = 0x00000001,
        NotHidden     = 0x00000002,
        Selected      = 0x00000004,
        Unselected    = 0x00000008,
        Selectable    = 0x00000010,
        NotSelectable = 0x00000020,
        DragEnabled   = 0x00000040,
        DragDisabled  = 0x00000080,
        DropEnabled   = 0x00000100,
        DropDisabled  = 0x00000200,
        HasChildren   = 0x00000400,
        NoChildren    = 0x00000800,
        Checked       = 0x00001000,
        NotChecked    = 0x00002000,
        Enabled       = 0x00004000,
        Disabled      = 0x00008000,
        Editable      = 0x00010000,
        NotEditable   = 0x00020000
*/
    QTest::addColumn<int>("start");
    QTest::addColumn<int>("iteratorflags");
    QTest::addColumn<QStringList>("matches");

    QTest::newRow("Match all") << 0 << (int)QTreeWidgetItemIterator::All
                               << (QStringList()
                                                                << "top0"   << "top0,child0"  << "top0,child1"  << "top0,child2"  << "top0,child3"
                                                                            << "top0,child4"  << "top0,child5"  << "top0,child6"  << "top0,child7"
                                                                            << "top0,child8"  << "top0,child9"  << "top0,child10" << "top0,child11"
                                                                            << "top0,child12" << "top0,child13" << "top0,child14" << "top0,child15"
                                                                            << "top0,child16"
                                                                << "top1"   << "top1,child0"  << "top1,child1"  << "top1,child2"  << "top1,child3"
                                                                            << "top1,child4"  << "top1,child5"  << "top1,child6"  << "top1,child7"
                                                                            << "top1,child8"  << "top1,child9"  << "top1,child10" << "top1,child11"
                                                                            << "top1,child12" << "top1,child13" << "top1,child14" << "top1,child15"
                                                                            << "top1,child16"
                                                                << "top2"   << "top2,child0"  << "top2,child1"  << "top2,child2"  << "top2,child3"
                                                                            << "top2,child4"  << "top2,child5"  << "top2,child6"  << "top2,child7"
                                                                            << "top2,child8"  << "top2,child9"  << "top2,child10" << "top2,child11"
                                                                            << "top2,child12" << "top2,child13" << "top2,child14" << "top2,child15"
                                                                            << "top2,child16"
                                                                << "top3"   << "top3,child0"  << "top3,child1"  << "top3,child2"  << "top3,child3"
                                                                            << "top3,child4"  << "top3,child5"  << "top3,child6"  << "top3,child7"
                                                                            << "top3,child8"  << "top3,child9"  << "top3,child10" << "top3,child11"
                                                                            << "top3,child12" << "top3,child13" << "top3,child14" << "top3,child15"
                                                                            << "top3,child16"
                                                                << "top4"   << "top4,child0"  << "top4,child1"  << "top4,child2"  << "top4,child3"
                                                                            << "top4,child4"  << "top4,child5"  << "top4,child6"  << "top4,child7"
                                                                            << "top4,child8"  << "top4,child9"  << "top4,child10" << "top4,child11"
                                                                            << "top4,child12" << "top4,child13" << "top4,child14" << "top4,child15"
                                                                            << "top4,child16"
                                                                << "top5"   << "top5,child0"  << "top5,child1"  << "top5,child2"  << "top5,child3"
                                                                            << "top5,child4"  << "top5,child5"  << "top5,child6"  << "top5,child7"
                                                                            << "top5,child8"  << "top5,child9"  << "top5,child10" << "top5,child11"
                                                                            << "top5,child12" << "top5,child13" << "top5,child14" << "top5,child15"
                                                                            << "top5,child16"
                                                                << "top6"   << "top6,child0"  << "top6,child1"  << "top6,child2"  << "top6,child3"
                                                                            << "top6,child4"  << "top6,child5"  << "top6,child6"  << "top6,child7"
                                                                            << "top6,child8"  << "top6,child9"  << "top6,child10" << "top6,child11"
                                                                            << "top6,child12" << "top6,child13" << "top6,child14" << "top6,child15"
                                                                            << "top6,child16"
                                                                << "top7"   << "top7,child0"  << "top7,child1"  << "top7,child2"  << "top7,child3"
                                                                            << "top7,child4"  << "top7,child5"  << "top7,child6"  << "top7,child7"
                                                                            << "top7,child8"  << "top7,child9"  << "top7,child10" << "top7,child11"
                                                                            << "top7,child12" << "top7,child13" << "top7,child14" << "top7,child15"
                                                                            << "top7,child16"
                                                                << "top8"   << "top8,child0"  << "top8,child1"  << "top8,child2"  << "top8,child3"
                                                                            << "top8,child4"  << "top8,child5"  << "top8,child6"  << "top8,child7"
                                                                            << "top8,child8"  << "top8,child9"  << "top8,child10" << "top8,child11"
                                                                            << "top8,child12" << "top8,child13" << "top8,child14" << "top8,child15"
                                                                            << "top8,child16"
                                                                << "top9"   << "top9,child0"  << "top9,child1"  << "top9,child2"  << "top9,child3"
                                                                            << "top9,child4"  << "top9,child5"  << "top9,child6"  << "top9,child7"
                                                                            << "top9,child8"  << "top9,child9"  << "top9,child10" << "top9,child11"
                                                                            << "top9,child12" << "top9,child13" << "top9,child14" << "top9,child15"
                                                                            << "top9,child16"
                                                                << "top10"  << "top10,child0"  << "top10,child1"  << "top10,child2"  << "top10,child3"
                                                                            << "top10,child4"  << "top10,child5"  << "top10,child6"  << "top10,child7"
                                                                            << "top10,child8"  << "top10,child9"  << "top10,child10" << "top10,child11"
                                                                            << "top10,child12" << "top10,child13" << "top10,child14" << "top10,child15"
                                                                            << "top10,child16"
                                                                << "top11"  << "top11,child0"  << "top11,child1"  << "top11,child2"  << "top11,child3"
                                                                            << "top11,child4"  << "top11,child5"  << "top11,child6"  << "top11,child7"
                                                                            << "top11,child8"  << "top11,child9"  << "top11,child10" << "top11,child11"
                                                                            << "top11,child12" << "top11,child13" << "top11,child14" << "top11,child15"
                                                                            << "top11,child16"
                                                                << "top12"  << "top12,child0"  << "top12,child1"  << "top12,child2"  << "top12,child3"
                                                                            << "top12,child4"  << "top12,child5"  << "top12,child6"  << "top12,child7"
                                                                            << "top12,child8"  << "top12,child9"  << "top12,child10" << "top12,child11"
                                                                            << "top12,child12" << "top12,child13" << "top12,child14" << "top12,child15"
                                                                            << "top12,child16"
                                                                << "top13"  << "top13,child0"  << "top13,child1"  << "top13,child2"  << "top13,child3"
                                                                            << "top13,child4"  << "top13,child5"  << "top13,child6"  << "top13,child7"
                                                                            << "top13,child8"  << "top13,child9"  << "top13,child10" << "top13,child11"
                                                                            << "top13,child12" << "top13,child13" << "top13,child14" << "top13,child15"
                                                                            << "top13,child16"
                                                                << "top14"  << "top14,child0"  << "top14,child1"  << "top14,child2"  << "top14,child3"
                                                                            << "top14,child4"  << "top14,child5"  << "top14,child6"  << "top14,child7"
                                                                            << "top14,child8"  << "top14,child9"  << "top14,child10" << "top14,child11"
                                                                            << "top14,child12" << "top14,child13" << "top14,child14" << "top14,child15"
                                                                            << "top14,child16"
                                                                << "top15"  << "top15,child0"  << "top15,child1"  << "top15,child2"  << "top15,child3"
                                                                            << "top15,child4"  << "top15,child5"  << "top15,child6"  << "top15,child7"
                                                                            << "top15,child8"  << "top15,child9"  << "top15,child10" << "top15,child11"
                                                                            << "top15,child12" << "top15,child13" << "top15,child14" << "top15,child15"
                                                                            << "top15,child16"
                                                                << "top16"  << "top16,child0"  << "top16,child1"  << "top16,child2"  << "top16,child3"
                                                                            << "top16,child4"  << "top16,child5"  << "top16,child6"  << "top16,child7"
                                                                            << "top16,child8"  << "top16,child9"  << "top16,child10" << "top16,child11"
                                                                            << "top16,child12" << "top16,child13" << "top16,child14" << "top16,child15"
                                                                            << "top16,child16");

    QTest::newRow("Match hidden") << 0 << (int)QTreeWidgetItemIterator::Hidden
                                  << (QStringList()
                                                                << "top0" << "top0,child0"  // fails due to hidden row
                                                                << "top1,child0"
                                                                << "top2,child0"
                                                                << "top3,child0"
                                                                << "top4,child0"
                                                                << "top5,child0"
                                                                << "top6,child0"
                                                                << "top7,child0"
                                                                << "top8,child0"
                                                                << "top9,child0"
                                                                << "top10,child0"
                                                                << "top11,child0"
                                                                << "top12,child0"
                                                                << "top13,child0"
                                                                << "top14,child0"
                                                                << "top15,child0"
                                      << "top16,child0");

    QTest::newRow("Match not hidden") << 0 << (int)QTreeWidgetItemIterator::NotHidden
                                      << (QStringList()
                                                                            << "top0,child1"  << "top0,child2"  << "top0,child3"
                                                                            << "top0,child4"  << "top0,child5"  << "top0,child6"  << "top0,child7"
                                                                            << "top0,child8"  << "top0,child9"  << "top0,child10" << "top0,child11"
                                                                            << "top0,child12" << "top0,child13" << "top0,child14" << "top0,child15"
                                                                            << "top0,child16"
                                                                << "top1"   << "top1,child1"  << "top1,child2"  << "top1,child3"
                                                                            << "top1,child4"  << "top1,child5"  << "top1,child6"  << "top1,child7"
                                                                            << "top1,child8"  << "top1,child9"  << "top1,child10" << "top1,child11"
                                                                            << "top1,child12" << "top1,child13" << "top1,child14" << "top1,child15"
                                                                            << "top1,child16"
                                                                << "top2"   << "top2,child1"  << "top2,child2"  << "top2,child3"
                                                                            << "top2,child4"  << "top2,child5"  << "top2,child6"  << "top2,child7"
                                                                            << "top2,child8"  << "top2,child9"  << "top2,child10" << "top2,child11"
                                                                            << "top2,child12" << "top2,child13" << "top2,child14" << "top2,child15"
                                                                            << "top2,child16"
                                                                << "top3"   << "top3,child1"  << "top3,child2"  << "top3,child3"
                                                                            << "top3,child4"  << "top3,child5"  << "top3,child6"  << "top3,child7"
                                                                            << "top3,child8"  << "top3,child9"  << "top3,child10" << "top3,child11"
                                                                            << "top3,child12" << "top3,child13" << "top3,child14" << "top3,child15"
                                                                            << "top3,child16"
                                                                << "top4"   << "top4,child1"  << "top4,child2"  << "top4,child3"
                                                                            << "top4,child4"  << "top4,child5"  << "top4,child6"  << "top4,child7"
                                                                            << "top4,child8"  << "top4,child9"  << "top4,child10" << "top4,child11"
                                                                            << "top4,child12" << "top4,child13" << "top4,child14" << "top4,child15"
                                                                            << "top4,child16"
                                                                << "top5"   << "top5,child1"  << "top5,child2"  << "top5,child3"
                                                                            << "top5,child4"  << "top5,child5"  << "top5,child6"  << "top5,child7"
                                                                            << "top5,child8"  << "top5,child9"  << "top5,child10" << "top5,child11"
                                                                            << "top5,child12" << "top5,child13" << "top5,child14" << "top5,child15"
                                                                            << "top5,child16"
                                                                << "top6"   << "top6,child1"  << "top6,child2"  << "top6,child3"
                                                                            << "top6,child4"  << "top6,child5"  << "top6,child6"  << "top6,child7"
                                                                            << "top6,child8"  << "top6,child9"  << "top6,child10" << "top6,child11"
                                                                            << "top6,child12" << "top6,child13" << "top6,child14" << "top6,child15"
                                                                            << "top6,child16"
                                                                << "top7"   << "top7,child1"  << "top7,child2"  << "top7,child3"
                                                                            << "top7,child4"  << "top7,child5"  << "top7,child6"  << "top7,child7"
                                                                            << "top7,child8"  << "top7,child9"  << "top7,child10" << "top7,child11"
                                                                            << "top7,child12" << "top7,child13" << "top7,child14" << "top7,child15"
                                                                            << "top7,child16"
                                                                << "top8"   << "top8,child1"  << "top8,child2"  << "top8,child3"
                                                                            << "top8,child4"  << "top8,child5"  << "top8,child6"  << "top8,child7"
                                                                            << "top8,child8"  << "top8,child9"  << "top8,child10" << "top8,child11"
                                                                            << "top8,child12" << "top8,child13" << "top8,child14" << "top8,child15"
                                                                            << "top8,child16"
                                                                << "top9"   << "top9,child1"  << "top9,child2"  << "top9,child3"
                                                                            << "top9,child4"  << "top9,child5"  << "top9,child6"  << "top9,child7"
                                                                            << "top9,child8"  << "top9,child9"  << "top9,child10" << "top9,child11"
                                                                            << "top9,child12" << "top9,child13" << "top9,child14" << "top9,child15"
                                                                            << "top9,child16"
                                                                << "top10"  << "top10,child1"  << "top10,child2"  << "top10,child3"
                                                                            << "top10,child4"  << "top10,child5"  << "top10,child6"  << "top10,child7"
                                                                            << "top10,child8"  << "top10,child9"  << "top10,child10" << "top10,child11"
                                                                            << "top10,child12" << "top10,child13" << "top10,child14" << "top10,child15"
                                                                            << "top10,child16"
                                                                << "top11"  << "top11,child1"  << "top11,child2"  << "top11,child3"
                                                                            << "top11,child4"  << "top11,child5"  << "top11,child6"  << "top11,child7"
                                                                            << "top11,child8"  << "top11,child9"  << "top11,child10" << "top11,child11"
                                                                            << "top11,child12" << "top11,child13" << "top11,child14" << "top11,child15"
                                                                            << "top11,child16"
                                                                << "top12"  << "top12,child1"  << "top12,child2"  << "top12,child3"
                                                                            << "top12,child4"  << "top12,child5"  << "top12,child6"  << "top12,child7"
                                                                            << "top12,child8"  << "top12,child9"  << "top12,child10" << "top12,child11"
                                                                            << "top12,child12" << "top12,child13" << "top12,child14" << "top12,child15"
                                                                            << "top12,child16"
                                                                << "top13"  << "top13,child1"  << "top13,child2"  << "top13,child3"
                                                                            << "top13,child4"  << "top13,child5"  << "top13,child6"  << "top13,child7"
                                                                            << "top13,child8"  << "top13,child9"  << "top13,child10" << "top13,child11"
                                                                            << "top13,child12" << "top13,child13" << "top13,child14" << "top13,child15"
                                                                            << "top13,child16"
                                                                << "top14"  << "top14,child1"  << "top14,child2"  << "top14,child3"
                                                                            << "top14,child4"  << "top14,child5"  << "top14,child6"  << "top14,child7"
                                                                            << "top14,child8"  << "top14,child9"  << "top14,child10" << "top14,child11"
                                                                            << "top14,child12" << "top14,child13" << "top14,child14" << "top14,child15"
                                                                            << "top14,child16"
                                                                << "top15"  << "top15,child1"  << "top15,child2"  << "top15,child3"
                                                                            << "top15,child4"  << "top15,child5"  << "top15,child6"  << "top15,child7"
                                                                            << "top15,child8"  << "top15,child9"  << "top15,child10" << "top15,child11"
                                                                            << "top15,child12" << "top15,child13" << "top15,child14" << "top15,child15"
                                                                            << "top15,child16"
                                                                << "top16"  << "top16,child1"  << "top16,child2"  << "top16,child3"
                                                                            << "top16,child4"  << "top16,child5"  << "top16,child6"  << "top16,child7"
                                                                            << "top16,child8"  << "top16,child9"  << "top16,child10" << "top16,child11"
                                                                            << "top16,child12" << "top16,child13" << "top16,child14" << "top16,child15"
                                                                            << "top16,child16");

    QTest::newRow("Match selected") << 0 << (int)QTreeWidgetItemIterator::Selected
                                    << (QStringList()
                                                                << "top0,child2"
                                                                << "top1,child2"
                                                                << "top2" << "top2,child2"
                                                                << "top3,child2"
                                                                << "top4,child2"
                                                                << "top5,child2"
                                                                << "top6,child2"
                                                                << "top7,child2"
                                                                << "top8,child2"
                                                                << "top9,child2"
                                                                << "top10,child2"
                                                                << "top11,child2"
                                                                << "top12,child2"
                                                                << "top13,child2"
                                                                << "top14,child2"
                                                                << "top15,child2"
                                        << "top16,child2");

    QTest::newRow("Match selectable") << 0 << (int)QTreeWidgetItemIterator::Selectable
                                      << (QStringList()
                                                                << "top0"   << "top0,child0"  << "top0,child1"    << "top0,child2"  << "top0,child3"
                                                                            << "top0,child4"
                                                                                                                  << "top0,child14" << "top0,child15"
                                                                            << "top0,child16"
                                                                << "top1"   << "top1,child0"  << "top1,child1"    << "top1,child2"  << "top1,child3"
                                                                            << "top1,child4"
                                                                                                                  << "top1,child14" << "top1,child15"
                                                                            << "top1,child16"
                                                                << "top2"   << "top2,child0"  << "top2,child1"    << "top2,child2"  << "top2,child3"
                                                                            << "top2,child4"
                                                                                                                  << "top2,child14" << "top2,child15"
                                                                            << "top2,child16"
                                                                << "top3"   << "top3,child0"  << "top3,child1"    << "top3,child2"  << "top3,child3"
                                                                            << "top3,child4"
                                                                                                                  << "top3,child14" << "top3,child15"
                                                                            << "top3,child16"
                                                                << "top4"   << "top4,child0"  << "top4,child1"    << "top4,child2"  << "top4,child3"
                                                                            << "top4,child4"
                                                                                                                  << "top4,child14" << "top4,child15"
                                                                            << "top4,child16"
                                                                /* "top5"*/ << "top5,child0"  << "top5,child1"    << "top5,child2"  << "top5,child3"
                                                                            << "top5,child4"
                                                                                                                  << "top5,child14" << "top5,child15"
                                                                            << "top5,child16"
                                                                /* "top6"*/ << "top6,child0"  << "top6,child1"    << "top6,child2"  << "top6,child3"
                                                                            << "top6,child4"
                                                                                                                  << "top6,child14" << "top6,child15"
                                                                            << "top6,child16"
                                                                /* "top7"*/ << "top7,child0"  << "top7,child1"    << "top7,child2"  << "top7,child3"
                                                                            << "top7,child4"
                                                                                                                  << "top7,child14" << "top7,child15"
                                                                            << "top7,child16"
                                                                /* "top8"*/ << "top8,child0"  << "top8,child1"    << "top8,child2"  << "top8,child3"
                                                                            << "top8,child4"
                                                                                                                  << "top8,child14" << "top8,child15"
                                                                            << "top8,child16"
                                                                /* "top9"*/ << "top9,child0"  << "top9,child1"    << "top9,child2"  << "top9,child3"
                                                                            << "top9,child4"
                                                                                                                  << "top9,child14" << "top9,child15"
                                                                            << "top9,child16"
                                                                /* "top10*/ << "top10,child0"  << "top10,child1"    << "top10,child2"  << "top10,child3"
                                                                            << "top10,child4"
                                                                                                                  << "top10,child14" << "top10,child15"
                                                                            << "top10,child16"
                                                                /* "top11*/ << "top11,child0"  << "top11,child1"    << "top11,child2"  << "top11,child3"
                                                                            << "top11,child4"
                                                                                                                  << "top11,child14" << "top11,child15"
                                                                            << "top11,child16"
                                                                /* "top12*/ << "top12,child0"  << "top12,child1"    << "top12,child2"  << "top12,child3"
                                                                            << "top12,child4"
                                                                                                                  << "top12,child14" << "top12,child15"
                                                                            << "top12,child16"
                                                                /* "top13*/ << "top13,child0"  << "top13,child1"    << "top13,child2"  << "top13,child3"
                                                                            << "top13,child4"
                                                                                                                  << "top13,child14" << "top13,child15"
                                                                            << "top13,child16"
                                                                << "top14"  << "top14,child0"  << "top14,child1"    << "top14,child2"  << "top14,child3"
                                                                            << "top14,child4"
                                                                                                                  << "top14,child14" << "top14,child15"
                                                                            << "top14,child16"
                                                                << "top15"  << "top15,child0"  << "top15,child1"    << "top15,child2"  << "top15,child3"
                                                                            << "top15,child4"
                                                                                                                  << "top15,child14" << "top15,child15"
                                                                            << "top15,child16"
                                                                << "top16"  << "top16,child0"  << "top16,child1"    << "top16,child2"  << "top16,child3"
                                                                            << "top16,child4"
                                                                                                                  << "top16,child14" << "top16,child15"
                                          << "top16,child16");


    QTest::newRow("Match DragEnabled") << 0 << (int)QTreeWidgetItemIterator::DragEnabled
                                       << (QStringList()
                                                                << "top0"   << "top0,child0"  << "top0,child1"    << "top0,child2"  << "top0,child3"
                                                                            << "top0,child6"
                                                                                                                  << "top0,child14" << "top0,child15"
                                                                            << "top0,child16"
                                                                << "top1"   << "top1,child0"  << "top1,child1"    << "top1,child2"  << "top1,child3"
                                                                            << "top1,child6"
                                                                                                                  << "top1,child14" << "top1,child15"
                                                                            << "top1,child16"
                                                                << "top2"   << "top2,child0"  << "top2,child1"    << "top2,child2"  << "top2,child3"
                                                                            << "top2,child6"
                                                                                                                  << "top2,child14" << "top2,child15"
                                                                            << "top2,child16"
                                                                << "top3"   << "top3,child0"  << "top3,child1"    << "top3,child2"  << "top3,child3"
                                                                            << "top3,child6"
                                                                                                                  << "top3,child14" << "top3,child15"
                                                                            << "top3,child16"
                                                                /* "top4"*/ << "top4,child0"  << "top4,child1"    << "top4,child2"  << "top4,child3"
                                                                            << "top4,child6"
                                                                                                                  << "top4,child14" << "top4,child15"
                                                                            << "top4,child16"
                                                                /* "top5"*/ << "top5,child0"  << "top5,child1"    << "top5,child2"  << "top5,child3"
                                                                            << "top5,child6"
                                                                                                                  << "top5,child14" << "top5,child15"
                                                                            << "top5,child16"
                                                                << "top6"   << "top6,child0"  << "top6,child1"    << "top6,child2"  << "top6,child3"
                                                                            << "top6,child6"
                                                                                                                  << "top6,child14" << "top6,child15"
                                                                            << "top6,child16"
                                                                /* "top7"*/ << "top7,child0"  << "top7,child1"    << "top7,child2"  << "top7,child3"
                                                                            << "top7,child6"
                                                                                                                  << "top7,child14" << "top7,child15"
                                                                            << "top7,child16"
                                                                /* "top8"*/ << "top8,child0"  << "top8,child1"    << "top8,child2"  << "top8,child3"
                                                                            << "top8,child6"
                                                                                                                  << "top8,child14" << "top8,child15"
                                                                            << "top8,child16"
                                                                /* "top9"*/ << "top9,child0"  << "top9,child1"    << "top9,child2"  << "top9,child3"
                                                                            << "top9,child6"
                                                                                                                  << "top9,child14" << "top9,child15"
                                                                            << "top9,child16"
                                                                /* "top10*/ << "top10,child0"  << "top10,child1"    << "top10,child2"  << "top10,child3"
                                                                            << "top10,child6"
                                                                                                                  << "top10,child14" << "top10,child15"
                                                                            << "top10,child16"
                                                                /* "top11*/ << "top11,child0"  << "top11,child1"    << "top11,child2"  << "top11,child3"
                                                                            << "top11,child6"
                                                                                                                  << "top11,child14" << "top11,child15"
                                                                            << "top11,child16"
                                                                /* "top12*/ << "top12,child0"  << "top12,child1"    << "top12,child2"  << "top12,child3"
                                                                            << "top12,child6"
                                                                                                                  << "top12,child14" << "top12,child15"
                                                                            << "top12,child16"
                                                                /* "top13*/ << "top13,child0"  << "top13,child1"    << "top13,child2"  << "top13,child3"
                                                                            << "top13,child6"
                                                                                                                  << "top13,child14" << "top13,child15"
                                                                            << "top13,child16"
                                                                << "top14"  << "top14,child0"  << "top14,child1"    << "top14,child2"  << "top14,child3"
                                                                            << "top14,child6"
                                                                                                                  << "top14,child14" << "top14,child15"
                                                                            << "top14,child16"
                                                                << "top15"  << "top15,child0"  << "top15,child1"    << "top15,child2"  << "top15,child3"
                                                                            << "top15,child6"
                                                                                                                  << "top15,child14" << "top15,child15"
                                                                            << "top15,child16"
                                                                << "top16"  << "top16,child0"  << "top16,child1"    << "top16,child2"  << "top16,child3"
                                                                            << "top16,child6"
                                                                                                                  << "top16,child14" << "top16,child15"
                                           << "top16,child16");

    QTest::newRow("Match DragDisabled") << 0 << (int)QTreeWidgetItemIterator::DragDisabled
                                        << (QStringList()

                                                                /* top0  */
                                                                            << "top0,child4" << "top0,child5"   << "top0,child7"    << "top0,child8"
                                                                            << "top0,child9" << "top0,child10"  << "top0,child11"   << "top0,child12"
                                                                            << "top0,child13"
                                                                /* top1  */
                                                                            << "top1,child4" << "top1,child5"   << "top1,child7"    << "top1,child8"
                                                                            << "top1,child9" << "top1,child10"  << "top1,child11"   << "top1,child12"
                                                                            << "top1,child13"
                                                                /* top2  */
                                                                            << "top2,child4" << "top2,child5"   << "top2,child7"    << "top2,child8"
                                                                            << "top2,child9" << "top2,child10"  << "top2,child11"   << "top2,child12"
                                                                            << "top2,child13"
                                                                /* top3  */
                                                                            << "top3,child4" << "top3,child5"   << "top3,child7"    << "top3,child8"
                                                                            << "top3,child9" << "top3,child10"  << "top3,child11"   << "top3,child12"
                                                                            << "top3,child13"
                                                                << "top4"
                                                                            << "top4,child4" << "top4,child5"   << "top4,child7"    << "top4,child8"
                                                                            << "top4,child9" << "top4,child10"  << "top4,child11"   << "top4,child12"
                                                                            << "top4,child13"
                                                                << "top5"
                                                                            << "top5,child4" << "top5,child5"   << "top5,child7"    << "top5,child8"
                                                                            << "top5,child9" << "top5,child10"  << "top5,child11"   << "top5,child12"
                                                                            << "top5,child13"
                                                                /* "top6"*/
                                                                            << "top6,child4" << "top6,child5"   << "top6,child7"    << "top6,child8"
                                                                            << "top6,child9" << "top6,child10"  << "top6,child11"   << "top6,child12"
                                                                            << "top6,child13"
                                                                << "top7"
                                                                            << "top7,child4" << "top7,child5"   << "top7,child7"    << "top7,child8"
                                                                            << "top7,child9" << "top7,child10"  << "top7,child11"   << "top7,child12"
                                                                            << "top7,child13"
                                                                << "top8"
                                                                            << "top8,child4" << "top8,child5"   << "top8,child7"    << "top8,child8"
                                                                            << "top8,child9" << "top8,child10"  << "top8,child11"   << "top8,child12"
                                                                            << "top8,child13"
                                                                << "top9"
                                                                            << "top9,child4" << "top9,child5"   << "top9,child7"    << "top9,child8"
                                                                            << "top9,child9" << "top9,child10"  << "top9,child11"   << "top9,child12"
                                                                            << "top9,child13"
                                                                << "top10"
                                                                            << "top10,child4" << "top10,child5"   << "top10,child7"    << "top10,child8"
                                                                            << "top10,child9" << "top10,child10"  << "top10,child11"   << "top10,child12"
                                                                            << "top10,child13"
                                                                << "top11"
                                                                            << "top11,child4" << "top11,child5"   << "top11,child7"    << "top11,child8"
                                                                            << "top11,child9" << "top11,child10"  << "top11,child11"   << "top11,child12"
                                                                            << "top11,child13"
                                                                << "top12"
                                                                            << "top12,child4" << "top12,child5"   << "top12,child7"    << "top12,child8"
                                                                            << "top12,child9" << "top12,child10"  << "top12,child11"   << "top12,child12"
                                                                            << "top12,child13"
                                                                << "top13"
                                                                            << "top13,child4" << "top13,child5"   << "top13,child7"    << "top13,child8"
                                                                            << "top13,child9" << "top13,child10"  << "top13,child11"   << "top13,child12"
                                                                            << "top13,child13"
                                                                /* top14 */
                                                                            << "top14,child4" << "top14,child5"   << "top14,child7"    << "top14,child8"
                                                                            << "top14,child9" << "top14,child10"  << "top14,child11"   << "top14,child12"
                                                                            << "top14,child13"
                                                                /* top15  */
                                                                            << "top15,child4" << "top15,child5"   << "top15,child7"    << "top15,child8"
                                                                            << "top15,child9" << "top15,child10"  << "top15,child11"   << "top15,child12"
                                                                            << "top15,child13"
                                                                /* top16  */
                                                                            << "top16,child4" << "top16,child5"   << "top16,child7"    << "top16,child8"
                                                                            << "top16,child9" << "top16,child10"  << "top16,child11"   << "top16,child12"
                                                                            << "top16,child13" );


    QTest::newRow("Match DropEnabled") << 0 << (int)QTreeWidgetItemIterator::DropEnabled
                                       << (QStringList()
                                                                << "top0"   << "top0,child0"  << "top0,child1"    << "top0,child2"  << "top0,child3"
                                                                            << "top0,child8"
                                                                                                                  << "top0,child14" << "top0,child15"
                                                                            << "top0,child16"
                                                                << "top1"   << "top1,child0"  << "top1,child1"    << "top1,child2"  << "top1,child3"
                                                                            << "top1,child8"
                                                                                                                  << "top1,child14" << "top1,child15"
                                                                            << "top1,child16"
                                                                << "top2"   << "top2,child0"  << "top2,child1"    << "top2,child2"  << "top2,child3"
                                                                            << "top2,child8"
                                                                                                                  << "top2,child14" << "top2,child15"
                                                                            << "top2,child16"
                                                                << "top3"   << "top3,child0"  << "top3,child1"    << "top3,child2"  << "top3,child3"
                                                                            << "top3,child8"
                                                                                                                  << "top3,child14" << "top3,child15"
                                                                            << "top3,child16"
                                                                /* "top4"*/ << "top4,child0"  << "top4,child1"    << "top4,child2"  << "top4,child3"
                                                                            << "top4,child8"
                                                                                                                  << "top4,child14" << "top4,child15"
                                                                            << "top4,child16"
                                                                /* "top5"*/ << "top5,child0"  << "top5,child1"    << "top5,child2"  << "top5,child3"
                                                                            << "top5,child8"
                                                                                                                  << "top5,child14" << "top5,child15"
                                                                            << "top5,child16"
                                                                /* "top6"*/ << "top6,child0"  << "top6,child1"    << "top6,child2"  << "top6,child3"
                                                                            << "top6,child8"
                                                                                                                  << "top6,child14" << "top6,child15"
                                                                            << "top6,child16"
                                                                /* "top7"*/ << "top7,child0"  << "top7,child1"    << "top7,child2"  << "top7,child3"
                                                                            << "top7,child8"
                                                                                                                  << "top7,child14" << "top7,child15"
                                                                            << "top7,child16"
                                                                << "top8"   << "top8,child0"  << "top8,child1"    << "top8,child2"  << "top8,child3"
                                                                            << "top8,child8"
                                                                                                                  << "top8,child14" << "top8,child15"
                                                                            << "top8,child16"
                                                                /* "top9"*/ << "top9,child0"  << "top9,child1"    << "top9,child2"  << "top9,child3"
                                                                            << "top9,child8"
                                                                                                                  << "top9,child14" << "top9,child15"
                                                                            << "top9,child16"
                                                                /* "top10*/ << "top10,child0"  << "top10,child1"    << "top10,child2"  << "top10,child3"
                                                                            << "top10,child8"
                                                                                                                  << "top10,child14" << "top10,child15"
                                                                            << "top10,child16"
                                                                /* "top11*/ << "top11,child0"  << "top11,child1"    << "top11,child2"  << "top11,child3"
                                                                            << "top11,child8"
                                                                                                                  << "top11,child14" << "top11,child15"
                                                                            << "top11,child16"
                                                                /* "top12*/ << "top12,child0"  << "top12,child1"    << "top12,child2"  << "top12,child3"
                                                                            << "top12,child8"
                                                                                                                  << "top12,child14" << "top12,child15"
                                                                            << "top12,child16"
                                                                /* "top13*/ << "top13,child0"  << "top13,child1"    << "top13,child2"  << "top13,child3"
                                                                            << "top13,child8"
                                                                                                                  << "top13,child14" << "top13,child15"
                                                                            << "top13,child16"
                                                                << "top14"  << "top14,child0"  << "top14,child1"    << "top14,child2"  << "top14,child3"
                                                                            << "top14,child8"
                                                                                                                  << "top14,child14" << "top14,child15"
                                                                            << "top14,child16"
                                                                << "top15"  << "top15,child0"  << "top15,child1"    << "top15,child2"  << "top15,child3"
                                                                            << "top15,child8"
                                                                                                                  << "top15,child14" << "top15,child15"
                                                                            << "top15,child16"
                                                                << "top16"  << "top16,child0"  << "top16,child1"    << "top16,child2"  << "top16,child3"
                                                                            << "top16,child8"
                                                                                                                  << "top16,child14" << "top16,child15"
                                           << "top16,child16");

    QTest::newRow("Match HasChildren") << 0 << (int)QTreeWidgetItemIterator::HasChildren
                                       << (QStringList() << "top0" << "top1" << "top2" << "top3" << "top4" << "top5"
                                           << "top6" << "top7" << "top8" << "top9" << "top10" << "top11" << "top12"
                                           << "top13" << "top14" << "top15" << "top16");

    QTest::newRow("Match Checked") << 0 << (int)QTreeWidgetItemIterator::Checked
                                   << (QStringList()
                                                                            << "top0,child14"  << "top0,child16"
                                                                            << "top1,child14"  << "top1,child16"
                                                                            << "top2,child14"  << "top2,child16"
                                                                            << "top3,child14"  << "top3,child16"
                                                                            << "top4,child14"  << "top4,child16"
                                                                            << "top5,child14"  << "top5,child16"
                                                                            << "top6,child14"  << "top6,child16"
                                                                            << "top7,child14"  << "top7,child16"
                                                                            << "top8,child14"  << "top8,child16"
                                                                            << "top9,child14"  << "top9,child16"
                                                                            << "top10,child14" << "top10,child16"
                                                                            << "top11,child14" << "top11,child16"
                                                                            << "top12,child14" << "top12,child16"
                                                                            << "top13,child14" << "top13,child16"
                                                                << "top14"
                                                                            << "top14,child14" << "top14,child16"
                                                                            << "top15,child14" << "top15,child16"
                                                                << "top16"
                                       << "top16,child14" << "top16,child16");

    QTest::newRow("Match NotChecked") << 0 << (int)QTreeWidgetItemIterator::NotChecked
                                      << (QStringList()
                                                                << "top0"   << "top0,child0"  << "top0,child1"  << "top0,child2"  << "top0,child3"
                                                                            << "top0,child4"  << "top0,child5"  << "top0,child6"  << "top0,child7"
                                                                            << "top0,child8"  << "top0,child9"  << "top0,child10" << "top0,child11"
                                                                            << "top0,child12" << "top0,child13" <<                   "top0,child15"

                                                                << "top1"   << "top1,child0" << "top1,child1"  << "top1,child2"  << "top1,child3"
                                                                            << "top1,child4"  << "top1,child5"  << "top1,child6"  << "top1,child7"
                                                                            << "top1,child8"  << "top1,child9"  << "top1,child10" << "top1,child11"
                                                                            << "top1,child12" << "top1,child13"                   << "top1,child15"

                                                                << "top2"   << "top2,child0" << "top2,child1"  << "top2,child2"  << "top2,child3"
                                                                            << "top2,child4"  << "top2,child5"  << "top2,child6"  << "top2,child7"
                                                                            << "top2,child8"  << "top2,child9"  << "top2,child10" << "top2,child11"
                                                                            << "top2,child12" << "top2,child13"                   << "top2,child15"

                                                                << "top3"   << "top3,child0" << "top3,child1"  << "top3,child2"  << "top3,child3"
                                                                            << "top3,child4"  << "top3,child5"  << "top3,child6"  << "top3,child7"
                                                                            << "top3,child8"  << "top3,child9"  << "top3,child10" << "top3,child11"
                                                                            << "top3,child12" << "top3,child13"                   << "top3,child15"

                                                                << "top4"   << "top4,child0" << "top4,child1"  << "top4,child2"  << "top4,child3"
                                                                            << "top4,child4"  << "top4,child5"  << "top4,child6"  << "top4,child7"
                                                                            << "top4,child8"  << "top4,child9"  << "top4,child10" << "top4,child11"
                                                                            << "top4,child12" << "top4,child13"                   << "top4,child15"

                                                                << "top5"   << "top5,child0" << "top5,child1"  << "top5,child2"  << "top5,child3"
                                                                            << "top5,child4"  << "top5,child5"  << "top5,child6"  << "top5,child7"
                                                                            << "top5,child8"  << "top5,child9"  << "top5,child10" << "top5,child11"
                                                                            << "top5,child12" << "top5,child13"                   << "top5,child15"

                                                                << "top6"   << "top6,child0" << "top6,child1"  << "top6,child2"  << "top6,child3"
                                                                            << "top6,child4"  << "top6,child5"  << "top6,child6"  << "top6,child7"
                                                                            << "top6,child8"  << "top6,child9"  << "top6,child10" << "top6,child11"
                                                                            << "top6,child12" << "top6,child13"                   << "top6,child15"

                                                                << "top7"   << "top7,child0" << "top7,child1"  << "top7,child2"  << "top7,child3"
                                                                            << "top7,child4"  << "top7,child5"  << "top7,child6"  << "top7,child7"
                                                                            << "top7,child8"  << "top7,child9"  << "top7,child10" << "top7,child11"
                                                                            << "top7,child12" << "top7,child13"                   << "top7,child15"

                                                                << "top8"   << "top8,child0" << "top8,child1"  << "top8,child2"  << "top8,child3"
                                                                            << "top8,child4"  << "top8,child5"  << "top8,child6"  << "top8,child7"
                                                                            << "top8,child8"  << "top8,child9"  << "top8,child10" << "top8,child11"
                                                                            << "top8,child12" << "top8,child13"                   << "top8,child15"

                                                                << "top9"   << "top9,child0" << "top9,child1"  << "top9,child2"  << "top9,child3"
                                                                            << "top9,child4"  << "top9,child5"  << "top9,child6"  << "top9,child7"
                                                                            << "top9,child8"  << "top9,child9"  << "top9,child10" << "top9,child11"
                                                                            << "top9,child12" << "top9,child13"                   << "top9,child15"

                                                                << "top10"  << "top10,child0" << "top10,child1"  << "top10,child2"  << "top10,child3"
                                                                            << "top10,child4"  << "top10,child5"  << "top10,child6"  << "top10,child7"
                                                                            << "top10,child8"  << "top10,child9"  << "top10,child10" << "top10,child11"
                                                                            << "top10,child12" << "top10,child13"                   << "top10,child15"

                                                                << "top11"  << "top11,child0" << "top11,child1"  << "top11,child2"  << "top11,child3"
                                                                            << "top11,child4"  << "top11,child5"  << "top11,child6"  << "top11,child7"
                                                                            << "top11,child8"  << "top11,child9"  << "top11,child10" << "top11,child11"
                                                                            << "top11,child12" << "top11,child13"                   << "top11,child15"

                                                                << "top12"  << "top12,child0" << "top12,child1"  << "top12,child2"  << "top12,child3"
                                                                            << "top12,child4"  << "top12,child5"  << "top12,child6"  << "top12,child7"
                                                                            << "top12,child8"  << "top12,child9"  << "top12,child10" << "top12,child11"
                                                                            << "top12,child12" << "top12,child13"                   << "top12,child15"

                                                                << "top13"  << "top13,child0" << "top13,child1"  << "top13,child2"  << "top13,child3"
                                                                            << "top13,child4"  << "top13,child5"  << "top13,child6"  << "top13,child7"
                                                                            << "top13,child8"  << "top13,child9"  << "top13,child10" << "top13,child11"
                                                                            << "top13,child12" << "top13,child13"                   << "top13,child15"

                                                                /* "top14"*/<< "top14,child0" << "top14,child1"  << "top14,child2"  << "top14,child3"
                                                                            << "top14,child4"  << "top14,child5"  << "top14,child6"  << "top14,child7"
                                                                            << "top14,child8"  << "top14,child9"  << "top14,child10" << "top14,child11"
                                                                            << "top14,child12" << "top14,child13"                   << "top14,child15"

                                                                << "top15"  << "top15,child0" << "top15,child1"  << "top15,child2"  << "top15,child3"
                                                                            << "top15,child4"  << "top15,child5"  << "top15,child6"  << "top15,child7"
                                                                            << "top15,child8"  << "top15,child9"  << "top15,child10" << "top15,child11"
                                                                            << "top15,child12" << "top15,child13"                   << "top15,child15"

                                                                /* "top16"*/<< "top16,child0" << "top16,child1"  << "top16,child2"  << "top16,child3"
                                                                            << "top16,child4"  << "top16,child5"  << "top16,child6"  << "top16,child7"
                                                                            << "top16,child8"  << "top16,child9"  << "top16,child10" << "top16,child11"
                                          << "top16,child12" << "top16,child13" << "top16,child15");



    QTest::newRow("Match Disabled") << 0 << (int)QTreeWidgetItemIterator::Disabled
                                    << (QStringList()
                                                                            << "top0,child11"
                                                                            << "top1,child11"
                                                                            << "top2,child11"
                                                                            << "top3,child11"
                                                                            << "top4,child11"
                                                                            << "top5,child11"
                                                                            << "top6,child11"
                                                                            << "top7,child11"
                                                                            << "top8,child11"
                                                                            << "top9,child11"
                                                                            << "top10,child11"
                                                                << "top11"
                                                                            << "top11,child0"
                                                                            << "top11,child1"
                                                                            << "top11,child2"
                                                                            << "top11,child3"
                                                                            << "top11,child4"
                                                                            << "top11,child5"
                                                                            << "top11,child6"
                                                                            << "top11,child7"
                                                                            << "top11,child8"
                                                                            << "top11,child9"
                                                                            << "top11,child10"
                                                                            << "top11,child11"
                                                                            << "top11,child12"
                                                                            << "top11,child13"
                                                                            << "top11,child14"
                                                                            << "top11,child15"
                                                                            << "top11,child16"

                                                                            << "top12,child11"
                                                                            << "top13,child11"
                                                                            << "top14,child11"
                                                                            << "top15,child11"
                                        << "top16,child11");

    QTest::newRow("Match Editable") << 0 << (int)QTreeWidgetItemIterator::Editable
                                    << (QStringList()
                                                                            << "top0,child12"
                                                                            << "top1,child12"
                                                                            << "top2,child12"
                                                                            << "top3,child12"
                                                                            << "top4,child12"
                                                                            << "top5,child12"
                                                                            << "top6,child12"
                                                                            << "top7,child12"
                                                                            << "top8,child12"
                                                                            << "top9,child12"
                                                                            << "top10,child12"
                                                                            << "top11,child12"
                                                                << "top12"
                                                                            << "top12,child12"
                                                                            << "top13,child12"
                                                                            << "top14,child12"
                                                                            << "top15,child12"
                                        << "top16,child12");

    QTest::newRow("Match mutually exclusive Hidden|NotHidden") << 0 << (int)(QTreeWidgetItemIterator::Hidden|QTreeWidgetItemIterator::NotHidden)
                                                               << QStringList();
    QTest::newRow("Match mutually exclusive Selected|Unselected") << 0 << (int)(QTreeWidgetItemIterator::Selected|QTreeWidgetItemIterator::Unselected)
                                                                  << QStringList();
    QTest::newRow("Match mutually exclusive Selectable|NotSelectable") << 0 << (int)(QTreeWidgetItemIterator::Selectable|QTreeWidgetItemIterator::NotSelectable)
                                                                       << QStringList();
    QTest::newRow("Match mutually exclusive DragEnabled|DragDisabled") << 0 << (int)(QTreeWidgetItemIterator::DragEnabled|QTreeWidgetItemIterator::DragDisabled)
                                                                       << QStringList();
    QTest::newRow("Match mutually exclusive DropEnabled|DropDisabled") << 0 << (int)(QTreeWidgetItemIterator::DropEnabled|QTreeWidgetItemIterator::DropDisabled)
                                                                       << QStringList();
    QTest::newRow("Match mutually exclusive HasChildren|NoChildren") << 0 << (int)(QTreeWidgetItemIterator::HasChildren|QTreeWidgetItemIterator::NoChildren)
                                                                     << QStringList();
    QTest::newRow("Match mutually exclusive Checked|NotChecked") << 0 << (int)(QTreeWidgetItemIterator::Checked|QTreeWidgetItemIterator::NotChecked)
                                                                 << QStringList();
    QTest::newRow("Match mutually exclusive Disabled|Enabled") << 0 << (int)(QTreeWidgetItemIterator::Disabled|QTreeWidgetItemIterator::Enabled)
                                                               << QStringList();
    QTest::newRow("Match mutually exclusive Editable|NotEditable") << 0 << (int)(QTreeWidgetItemIterator::Editable|QTreeWidgetItemIterator::NotEditable)
                                                                   << QStringList();
}

void tst_QTreeWidgetItemIterator::iteratorflags()
{
    QFETCH(int, start);
    QFETCH(int, iteratorflags);
    QFETCH(QStringList, matches);

    QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::IteratorFlags(iteratorflags));
    it+=start;
    int iMatch = 0;
    while (*it && iMatch < matches.count()) {
        QTreeWidgetItem *item = *it;
        QCOMPARE(item->text(0), matches[iMatch]);
        ++it;
        ++iMatch;
    }
    // Make sure the expected result does not contain *more* items than the actual result.
    QCOMPARE(iMatch, matches.size());
}

void tst_QTreeWidgetItemIterator::preincrement()
{
    QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::All);
    QTreeWidgetItem *item = *(++it);
    // should be the second one
    QCOMPARE(item->text(0), QString("top0,child0"));
}

void tst_QTreeWidgetItemIterator::postincrement()
{
    QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::All);
    QTreeWidgetItem *item = *(it++);
    // should be the first one
    QCOMPARE(item->text(0), QString("top0"));
}

void tst_QTreeWidgetItemIterator::predecrement()
{
    QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::All);
    QTreeWidgetItem *item = *(++it);
    // should be the second one
    QCOMPARE(item->text(0), QString("top0,child0"));

    item = *(--it);
    QCOMPARE(item->text(0), QString("top0"));

}

void tst_QTreeWidgetItemIterator::postdecrement()
{
    QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::All);
    QTreeWidgetItem *item = *(it++);
    // should be the first one
    QCOMPARE(item->text(0), QString("top0"));

    //Iterator points to second one
    item = *(it--);
    QCOMPARE(item->text(0), QString("top0,child0"));

}

void tst_QTreeWidgetItemIterator::plus_eq_data()
{
    QTest::addColumn<int>("start");
    QTest::addColumn<int>("addition");
    QTest::addColumn<int>("iteratorflags");
    QTest::addColumn<QString>("expecteditem");

    QTest::newRow("+=0") << 0 << 0 << (int)QTreeWidgetItemIterator::All << QString("top0");
    QTest::newRow("+=1") << 0 << 1 << (int)QTreeWidgetItemIterator::All << QString("top0,child0");
    QTest::newRow("+=2") << 0 << 2 << (int)QTreeWidgetItemIterator::All << QString("top0,child1");
    QTest::newRow("+=(-1)") << 1 << -1 << (int)QTreeWidgetItemIterator::All << QString("top0");
    QTest::newRow("+=(-2)") << 3 << -2 << (int)QTreeWidgetItemIterator::All << QString("top0,child0");
}

void tst_QTreeWidgetItemIterator::plus_eq()
{
    QFETCH(int, start);
    QFETCH(int, addition);
    QFETCH(int, iteratorflags);
    QFETCH(QString, expecteditem);

    QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::IteratorFlags(iteratorflags));
    it+=start;
    it+=addition;
    QTreeWidgetItem *item = *it;

    QVERIFY(item);
    QCOMPARE(item->text(0), expecteditem);

}

void tst_QTreeWidgetItemIterator::minus_eq_data()
{
    QTest::addColumn<int>("start");
    QTest::addColumn<int>("subtraction");
    QTest::addColumn<int>("iteratorflags");
    QTest::addColumn<QString>("expecteditem");

    QTest::newRow("-=0") << 0 << 0 << (int)QTreeWidgetItemIterator::All << QString("top0");
    QTest::newRow("-=1") << 2 << 1 << (int)QTreeWidgetItemIterator::All << QString("top0,child0");
    QTest::newRow("-=2") << 4 << 2 << (int)QTreeWidgetItemIterator::All << QString("top0,child1");
    QTest::newRow("-=(-1)") << 0 << -1 << (int)QTreeWidgetItemIterator::All << QString("top0,child0");
    QTest::newRow("-=(-2)") << 0 << -2 << (int)QTreeWidgetItemIterator::All << QString("top0,child1");
    QTest::newRow("-=1)") << 18 << 1 << (int)QTreeWidgetItemIterator::All << QString("top0,child16");
    QTest::newRow("-=1)") << 1 << 1 << (int)QTreeWidgetItemIterator::All << QString("top0");
}

void tst_QTreeWidgetItemIterator::minus_eq()
{
    QFETCH(int, start);
    QFETCH(int, subtraction);
    QFETCH(int, iteratorflags);
    QFETCH(QString, expecteditem);

    QTreeWidgetItemIterator it(testWidget, QTreeWidgetItemIterator::IteratorFlags(iteratorflags));
    it+=start;
    it-=subtraction;
    QTreeWidgetItem *item = *it;
    // should be the first one
    QVERIFY(item);
    QCOMPARE(item->text(0), expecteditem);
}

void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget_data()
{
    QTest::addColumn<int>("topLevelItems");
    QTest::addColumn<int>("childItems");
    QTest::addColumn<int>("grandChildItems");
    QTest::addColumn<int>("iteratorflags");
    QTest::addColumn<int>("removeindex");
    QTest::addColumn<int>("expecteditemindex");
    QTest::addColumn<QString>("expecteditemvalue");
    QTest::addColumn<QString>("expectedUpdatedCurrent");
    QTest::addColumn<int>("expecteditemIsNull");

    QTest::newRow("Remove 3, check 1") << 3 << 3 << 0 << (int)QTreeWidgetItemIterator::All
                << 3 << 1 << QString("top0,child0") << QString("top1") << 0;
    QTest::newRow("Remove 1, check 0") << 3 << 3 << 0 << (int)QTreeWidgetItemIterator::All
                << 1 << 0 << QString("top0") << QString("top0,child1") << 0;
    QTest::newRow("Remove 2, check 2") << 3 << 3 << 0 << (int)QTreeWidgetItemIterator::All
                << 2 << 2 << QString("top0,child2") << QString("top0,child2") << 0;
    QTest::newRow("Remove 0, check 0") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All
                << 0 << 0 << QString("top1") << QString("top1") << 0;
    QTest::newRow("Remove top1, check top1") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All
                << 13 << 13 << QString("top2") << QString("top2") << 0;
    QTest::newRow("Remove top0, check top1") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All
                << 0 << 13 << QString("top1") << QString("top1") << 0;
    QTest::newRow("Remove (top0,child1), check (top0,child1)") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All
                << 5 << 5 << QString("top0,child2") << QString("top0,child2") << 0;
    QTest::newRow("Remove (t0,c0) check (t0,c0)") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All
                << 1 << 1 << QString("top0,child1") << QString("top0,child1") << 0;
    QTest::newRow("Remove (t0,c1) check (t0,c1)") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All
                << 5 << 5 << QString("top0,child2") << QString("top0,child2") << 0;
    QTest::newRow("Remove (t0) check (t0,c1)") << 3 << 3 << 0 << (int)QTreeWidgetItemIterator::All
                << 0 << 4 << QString("top1") << QString("top1") << 0;
    QTest::newRow("Remove (t0) check (t0,c0,g1)") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All
                << 0 << 3 << QString("top1") << QString("top1") << 0;
    QTest::newRow("Remove (top2), check if top2 is null") << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All
                << 2*13 << 2*13 << QString() << QString() << 1;
    QTest::newRow("Remove last item, check if iterator::current returns 0")
                << 3 << 0 << 0 << (int)QTreeWidgetItemIterator::All << 2 << 2 << QString() << QString() << 1;
    QTest::newRow("remove 1, iterator points to 3, should move to 1")
                << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All << 1 << 3 << QString("top0,child1") << QString("top0,child1") << 0;
}

void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget()
{
    QFETCH(int, topLevelItems);
    QFETCH(int, childItems);
    QFETCH(int, grandChildItems);
    QFETCH(int, iteratorflags);
    QFETCH(int, removeindex);
    QFETCH(int, expecteditemindex);
    QFETCH(QString, expecteditemvalue);
    QFETCH(QString, expectedUpdatedCurrent);
    QFETCH(int, expecteditemIsNull);

    QTreeWidget tw;
    tw.clear();
    tw.setColumnCount(2);
    for (int i1=0; i1 < topLevelItems; ++i1) {
        QTreeWidgetItem *top = new QTreeWidgetItem(&tw);
        top->setText(0, QString("top%1").arg(i1));
        for (int i2=0; i2 < childItems; ++i2) {
            QTreeWidgetItem *child = new QTreeWidgetItem(top);
            child->setText(0, QString("top%1,child%2").arg(i1).arg(i2));
            for (int i3=0; i3 < grandChildItems; ++i3) {
                QTreeWidgetItem *grandChild = new QTreeWidgetItem(child);
                grandChild->setText(0, QString("top%1,child%2,grandchild%3").arg(i1).arg(i2).arg(i3));
            }
        }
    }

    QTreeWidgetItemIterator it(&tw, QTreeWidgetItemIterator::IteratorFlags(iteratorflags));
    it+=expecteditemindex;
    QTreeWidgetItem *item = 0;
    QTreeWidgetItemIterator itRemove(&tw, QTreeWidgetItemIterator::IteratorFlags(iteratorflags));
    itRemove+=removeindex;
    item = *itRemove;
    QVERIFY(item);
    delete item;
    item = *it;
    if (expecteditemIsNull) {
        QVERIFY(item == 0);
    } else {
        QVERIFY(item);
        QCOMPARE(item->text(0), expecteditemvalue);
        item = *itRemove;
        if (expectedUpdatedCurrent.isNull()) {
            QVERIFY(item == 0);
        } else {
            QCOMPARE(item->text(0), expectedUpdatedCurrent);
        }
    }
}

void tst_QTreeWidgetItemIterator::updateIteratorAfterDeletedItem_and_ContinueIteration_data()
{
    QTest::addColumn<int>("topLevelItems");
    QTest::addColumn<int>("childItems");
    QTest::addColumn<int>("grandChildItems");       // Populate the tree data
    // we have one iterator pointing to an item in the tree.
    // This iterator will be updated if we delete the item it is pointing to.
    //
    QTest::addColumn<int>("removeindex");                   // The index of the node we want to remove
    QTest::addColumn<int>("iterator_initial_index");        // The new expected index of
    QTest::addColumn<int>("iterator_advance_after_removal");
    QTest::addColumn<QString>("iterator_new_value");        // The new current item value of the iterator
    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");
    QTest::newRow("Remove 0, it points to 12, it+=1. We should get top1,child0") << 3 << 3 << 3 << 0 << 12 << 1 << QString("top1,child0");
    QTest::newRow("Remove 0, it points to 12, it-=1. We should get 0")   << 3 << 3 << 3 << 0 << 12 << -1 << QString();
    QTest::newRow("Remove 0, it points to 1, it+=1. We should get top2") << 4 << 0 << 0 << 0 << 1 << 1 << QString("top2");
    QTest::newRow("Remove 2, it points to 1, it+=0. We should get top1") << 4 << 0 << 0 << 2 << 1 << 0 << QString("top1");
    QTest::newRow("Remove 2, it points to 1, it+=1. We should get top3") << 4 << 0 << 0 << 2 << 1 << 1 << QString("top3");
    QTest::newRow("Remove 1, it points to 2, it+=1. We should get top0,child2") << 3 << 3 << 0 << 1 << 2 << 1 << QString("top0,child2");
    QTest::newRow("Remove 1, it points to 2, it+=0. We should get top0,child1") << 3 << 3 << 0 << 1 << 2 << 0 << QString("top0,child1");
    QTest::newRow("Remove 1, it points to 2, it-=1. We should get top0") << 3 << 3 << 0 << 1 << 2 << -1 << QString("top0");
}

void tst_QTreeWidgetItemIterator::updateIteratorAfterDeletedItem_and_ContinueIteration()
{
    QFETCH(int, topLevelItems);
    QFETCH(int, childItems);
    QFETCH(int, grandChildItems);
    QFETCH(int, removeindex);
    QFETCH(int, iterator_initial_index);
    QFETCH(int, iterator_advance_after_removal);
    QFETCH(QString, iterator_new_value);

    QTreeWidget tw;
    tw.clear();
    tw.setColumnCount(2);
    for (int i1=0; i1 < topLevelItems; ++i1) {
        QTreeWidgetItem *top = new QTreeWidgetItem(&tw);
        top->setText(0, QString("top%1").arg(i1));
        for (int i2=0; i2 < childItems; ++i2) {
            QTreeWidgetItem *child = new QTreeWidgetItem(top);
            child->setText(0, QString("top%1,child%2").arg(i1).arg(i2));
            for (int i3=0; i3 < grandChildItems; ++i3) {
                QTreeWidgetItem *grandChild = new QTreeWidgetItem(child);
                grandChild->setText(0, QString("top%1,child%2,grandchild%3").arg(i1).arg(i2).arg(i3));
            }
        }
    }

    QTreeWidgetItemIterator it(&tw, QTreeWidgetItemIterator::All);
    it += iterator_initial_index;
    QTreeWidgetItem *item = 0;
    QTreeWidgetItemIterator itRemove(&tw, QTreeWidgetItemIterator::All);
    itRemove+=removeindex;
    item = *itRemove;
    QVERIFY(item);
    delete item;
    it+=iterator_advance_after_removal;
    if (iterator_new_value.isNull()) {
        QCOMPARE((*it), (QTreeWidgetItem*)0);
    } else {
        QCOMPARE((*it)->text(0), iterator_new_value);
    }
}

void tst_QTreeWidgetItemIterator::constructIteratorWithItem_data()
{
    QTest::addColumn<int>("indextoitem");
    QTest::addColumn<int>("iteratorflags");
    QTest::addColumn<QString>("expecteditem");

    QTest::newRow("index 0")            << 0 << 0 << QString("top0");
    QTest::newRow("index 1")            << 1 << 0 << QString("top0,child0");
    QTest::newRow("index 2")            << 2 << 0 << QString("top0,child1");
    QTest::newRow("index 30")           << 30 << 0 << QString("top1,child11");
    QTest::newRow("305 (last item)")    << 305 << 0 << QString("top16,child16");
    QTest::newRow("index 0, advance to next matching node") << 0 << (int)QTreeWidgetItemIterator::NotHidden << QString("top0,child1");
}

void tst_QTreeWidgetItemIterator::constructIteratorWithItem()
{
    QFETCH(int, indextoitem);
    QFETCH(int, iteratorflags);
    QFETCH(QString, expecteditem);

    QTreeWidgetItemIterator it(testWidget);
    it+=indextoitem;
    QTreeWidgetItem *item = *it;
    QTreeWidgetItemIterator it2(item, QTreeWidgetItemIterator::IteratorFlags(iteratorflags));
    QTreeWidgetItem *item2 = *it2;

    QVERIFY(item2);
    QCOMPARE(item2->text(0), expecteditem);

}

void tst_QTreeWidgetItemIterator::initializeIterator()
{
    QTreeWidget tw;
    QTreeWidgetItemIterator it(&tw);

    QCOMPARE((*it), static_cast<QTreeWidgetItem*>(0));
}

QTEST_MAIN(tst_QTreeWidgetItemIterator)
#include "tst_qtreewidgetitemiterator.moc"