@@ -45,6 +45,7 @@ private:
45 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->m_sectionItem), sectionHeader);
45 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->m_sectionItem), sectionHeader);
46 if (!sectionHeader.isNull()) {
46 if (!sectionHeader.isNull()) {
47 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->m_sectionItem)->culled, sectionHeaderCulled);
47 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->m_sectionItem)->culled, sectionHeaderCulled);
48+ QCOMPARE(sectionDelegateIndex(lvwph->m_visibleItems[visibleIndex]->m_sectionItem), lvwph->m_firstVisibleIndex + visibleIndex);
@@ -116,6 +117,11 @@ private:
116 return item ? QQmlEngine::contextForObject(item)->parentContext()->contextProperty(QLatin1String("section")).toString() : QString();
117 return item ? QQmlEngine::contextForObject(item)->parentContext()->contextProperty(QLatin1String("section")).toString() : QString();
120+ int sectionDelegateIndex(QQuickItem *item)
122+ return item ? QQmlEngine::contextForObject(item)->parentContext()->contextProperty(QLatin1String("delegateIndex")).toInt() : -1;
119private Q_SLOTS:
125private Q_SLOTS:
121 void initTestCase()
127 void initTestCase()
@@ -220,6 +226,7 @@ private Q_SLOTS:
220 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
226 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
221 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
227 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
222 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
228 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
229+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
223 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
230 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -241,6 +248,7 @@ private Q_SLOTS:
241 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
248 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
242 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
249 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
243 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
250 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
251+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
244 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
252 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -262,6 +270,7 @@ private Q_SLOTS:
262 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
270 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
263 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
271 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
264 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
272 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
273+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
265 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
274 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
267 changeContentY(-30);
276 changeContentY(-30);
@@ -280,6 +289,7 @@ private Q_SLOTS:
280 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
289 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
281 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
290 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
282 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
291 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
292+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
283 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
293 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -335,6 +345,7 @@ private Q_SLOTS:
335 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
345 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
336 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
346 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
337 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
347 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
348+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
338 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
349 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
340 lvwph->positionAtBeginning();
351 lvwph->positionAtBeginning();
@@ -360,6 +371,7 @@ private Q_SLOTS:
360 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
371 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
361 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
372 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
362 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
373 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
374+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
363 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
375 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
365 lvwph->positionAtBeginning();
377 lvwph->positionAtBeginning();
@@ -404,6 +416,7 @@ private Q_SLOTS:
404 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
416 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
405 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
417 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
406 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
418 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
419+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
407 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
420 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
409 model->setProperty(0, "size", 400);
422 model->setProperty(0, "size", 400);
@@ -423,6 +436,7 @@ private Q_SLOTS:
423 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
436 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
424 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
437 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
425 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
438 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
439+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
426 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
440 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
428 scrollToTop();
442 scrollToTop();
@@ -476,6 +490,7 @@ private Q_SLOTS:
476 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
490 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
477 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
491 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
478 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
492 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
493+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
479 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
494 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
481 model->setProperty(0, "size", 400);
496 model->setProperty(0, "size", 400);
@@ -495,6 +510,7 @@ private Q_SLOTS:
495 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
510 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
496 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
511 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
497 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
512 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
513+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
498 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
514 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
500 scrollToTop();
516 scrollToTop();
@@ -531,6 +547,7 @@ private Q_SLOTS:
531 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
547 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
532 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
548 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
533 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
549 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
550+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
534 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
551 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
536 changeContentY(-30);
553 changeContentY(-30);
@@ -548,6 +565,7 @@ private Q_SLOTS:
548 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
565 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
549 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
566 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
550 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
567 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
568+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
551 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
569 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
553 changeContentY(30);
571 changeContentY(30);
@@ -565,6 +583,7 @@ private Q_SLOTS:
565 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
583 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
566 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
584 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
567 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
585 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
586+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
568 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
587 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
570 changeContentY(-30);
589 changeContentY(-30);
@@ -582,6 +601,7 @@ private Q_SLOTS:
582 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
601 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
583 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
602 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
584 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
603 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
604+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
585 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
605 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -602,6 +622,7 @@ private Q_SLOTS:
602 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
622 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
603 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
623 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
604 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
624 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
625+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
605 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
626 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
607 lvwph->setDelegate(otherDelegate);
628 lvwph->setDelegate(otherDelegate);
@@ -660,6 +681,7 @@ private Q_SLOTS:
660 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
681 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
661 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
682 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
662 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
683 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
684+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
663 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
685 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
665 scrollToTop();
687 scrollToTop();
@@ -698,6 +720,7 @@ private Q_SLOTS:
698 QTRY_VERIFY(lvwph->isAtYEnd());
720 QTRY_VERIFY(lvwph->isAtYEnd());
699 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
721 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
700 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
722 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
723+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
701 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
724 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
703 scrollToTop();
726 scrollToTop();
@@ -734,6 +757,7 @@ private Q_SLOTS:
734 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
757 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
735 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
758 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
736 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
759 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
760+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
737 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
761 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -818,6 +842,7 @@ private Q_SLOTS:
818 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
842 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
819 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
843 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
820 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
844 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
845+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
821 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
846 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
823 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
848 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -838,6 +863,7 @@ private Q_SLOTS:
838 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
863 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
839 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
864 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
840 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
865 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
866+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
841 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
867 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
843 scrollToTop();
869 scrollToTop();
@@ -878,6 +904,7 @@ private Q_SLOTS:
878 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
904 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
879 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
905 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
880 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
906 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
907+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
881 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
908 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
883 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 3), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
910 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 3), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -898,6 +925,7 @@ private Q_SLOTS:
898 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
925 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
899 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
926 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
900 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
927 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
928+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
901 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
929 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -920,6 +948,7 @@ private Q_SLOTS:
920 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
948 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
921 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
949 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
922 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
950 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
951+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
923 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
952 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
925 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
954 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -940,6 +969,7 @@ private Q_SLOTS:
940 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
969 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
941 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
970 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
942 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
971 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
972+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
943 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
973 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -962,6 +992,7 @@ private Q_SLOTS:
962 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
992 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
963 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
993 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
964 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
994 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
995+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
965 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
996 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
967 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
998 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -982,6 +1013,7 @@ private Q_SLOTS:
982 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1013 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
983 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1014 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
984 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1015 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1016+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
985 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1017 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
987 scrollToTop();
1019 scrollToTop();
@@ -1029,6 +1061,7 @@ private Q_SLOTS:
1029 QVERIFY(!lvwph->isAtYEnd());
1061 QVERIFY(!lvwph->isAtYEnd());
1030 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1062 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1031 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1063 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1064+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
1032 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1065 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1034 scrollToBottom();
1067 scrollToBottom();
@@ -1049,6 +1082,7 @@ private Q_SLOTS:
1049 QVERIFY(lvwph->isAtYEnd());
1082 QVERIFY(lvwph->isAtYEnd());
1050 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1083 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1051 QCOMPARE(section(lvwph->m_topSectionItem), QString("Lazy"));
1084 QCOMPARE(section(lvwph->m_topSectionItem), QString("Lazy"));
1085+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 5);
1052 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1086 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -1102,6 +1136,7 @@ private Q_SLOTS:
1102 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1136 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1103 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1137 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1104 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1138 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1139+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 13);
1105 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1140 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1107 changeContentY(-1700);
1142 changeContentY(-1700);
@@ -1126,6 +1161,7 @@ private Q_SLOTS:
1126 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1161 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1127 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1162 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1128 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1163 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1164+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
1129 QCOMPARE(lvwph->m_topSectionItem->y(), -23.);
1165 QCOMPARE(lvwph->m_topSectionItem->y(), -23.);
@@ -1187,6 +1223,7 @@ private Q_SLOTS:
1187 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1223 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1188 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1224 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1189 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1225 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1226+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1190 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1227 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -1210,6 +1247,7 @@ private Q_SLOTS:
1210 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1247 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1211 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1248 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1212 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1249 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1250+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1213 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1251 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -1232,6 +1270,7 @@ private Q_SLOTS:
1232 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1270 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1233 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1271 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1234 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1272 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1273+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1235 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1274 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1237 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 1), Q_ARG(QVariant, 1));
1276 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 1), Q_ARG(QVariant, 1));
@@ -1251,6 +1290,7 @@ private Q_SLOTS:
1251 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1290 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1252 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1291 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1253 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1292 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1293+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1254 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1294 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -1273,6 +1313,7 @@ private Q_SLOTS:
1273 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1313 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1274 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1314 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1275 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1315 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1316+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1276 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1317 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1278 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 3), Q_ARG(QVariant, 1));
1319 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 3), Q_ARG(QVariant, 1));
@@ -1292,6 +1333,7 @@ private Q_SLOTS:
1292 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1333 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1293 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1334 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1294 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1335 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1336+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1295 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1337 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -1371,6 +1413,7 @@ private Q_SLOTS:
1371 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1413 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1372 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1414 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1373 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1415 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1416+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
1374 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1417 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1376 QMetaObject::invokeMethod(model, "moveItems", Q_ARG(QVariant, 0), Q_ARG(QVariant, 5), Q_ARG(QVariant, 1));
1419 QMetaObject::invokeMethod(model, "moveItems", Q_ARG(QVariant, 0), Q_ARG(QVariant, 5), Q_ARG(QVariant, 1));
@@ -1391,6 +1434,7 @@ private Q_SLOTS:
1391 QVERIFY(!lvwph->isAtYEnd());
1434 QVERIFY(!lvwph->isAtYEnd());
1392 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1435 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1393 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1436 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1437+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1394 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1438 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -1414,6 +1458,7 @@ private Q_SLOTS:
1414 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1458 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1415 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1459 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1416 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1460 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1461+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1417 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1462 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1419 model->setProperty(1, "size", 100);
1464 model->setProperty(1, "size", 100);
@@ -1434,6 +1479,7 @@ private Q_SLOTS:
1434 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1479 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1435 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1480 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1436 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1481 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1482+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1437 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1483 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
@@ -1455,7 +1501,7 @@ private Q_SLOTS:
1455 QCOMPARE(lvwph->m_headerItem->y(), 0.);
1501 QCOMPARE(lvwph->m_headerItem->y(), 0.);
1456 QCOMPARE(lvwph->m_headerItem->height(), 50.);
1502 QCOMPARE(lvwph->m_headerItem->height(), 50.);
1457 QCOMPARE(lvwph->contentY(), 20.);
1503 QCOMPARE(lvwph->contentY(), 20.);
1458− QCOMPARE(lvwph->m_headerItemShownHeight, 0.);;
1504+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1459 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1505 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1461 lvwph->showHeader();
1507 lvwph->showHeader();
@@ -1475,6 +1521,7 @@ private Q_SLOTS:
1475 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1521 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1476 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1522 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1477 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
1523 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
1524+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
1478 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1525 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1480 scrollToTop();
1527 scrollToTop();
@@ -1510,9 +1557,10 @@ private Q_SLOTS:
1510 QCOMPARE(lvwph->m_headerItem->y(), 0.);
1557 QCOMPARE(lvwph->m_headerItem->y(), 0.);
1511 QCOMPARE(lvwph->m_headerItem->height(), 50.);
1558 QCOMPARE(lvwph->m_headerItem->height(), 50.);
1512 QCOMPARE(lvwph->contentY(), 375.);
1559 QCOMPARE(lvwph->contentY(), 375.);
1513− QCOMPARE(lvwph->m_headerItemShownHeight, 0.);;
1560+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1514 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1561 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1515 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1562 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1563+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1516 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1564 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1518 lvwph->showHeader();
1566 lvwph->showHeader();
@@ -1533,6 +1581,7 @@ private Q_SLOTS:
1533 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1581 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
1534 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1582 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1535 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1583 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1584+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1536 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1585 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1538 scrollToTop();
1587 scrollToTop();