@@ -22,7 +22,11 @@
2222#include <QtTestGui>
2323#pragma GCC diagnostic push
2424#pragma GCC diagnostic ignored "-pedantic"
25+#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
2526#include <private/qquicklistmodel_p.h>
27+#else
28+#include <private/qqmllistmodel_p.h>
29+#endif
2630#include <private/qquickanimation_p.h>
2731#include <private/qquickitem_p.h>
2832#pragma GCC diagnostic pop
@@ -41,6 +45,7 @@ private:
4145 QCOMPARE(section(lvwph->m_visibleItems[visibleIndex]->m_sectionItem), sectionHeader);
4246 if (!sectionHeader.isNull()) {
4347 QCOMPARE(QQuickItemPrivate::get(lvwph->m_visibleItems[visibleIndex]->m_sectionItem)->culled, sectionHeaderCulled);
48+ QCOMPARE(sectionDelegateIndex(lvwph->m_visibleItems[visibleIndex]->m_sectionItem), lvwph->m_firstVisibleIndex + visibleIndex);
4449 }
4550 }
4651
@@ -112,6 +117,11 @@ private:
112117 return item ? QQmlEngine::contextForObject(item)->parentContext()->contextProperty(QLatin1String("section")).toString() : QString();
113118 }
114119
120+ int sectionDelegateIndex(QQuickItem *item)
121+ {
122+ return item ? QQmlEngine::contextForObject(item)->parentContext()->contextProperty(QLatin1String("delegateIndex")).toInt() : -1;
123+ }
124+
115125private Q_SLOTS:
116126
117127 void initTestCase()
@@ -124,7 +134,11 @@ private Q_SLOTS:
124134 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
125135 view->setSource(QUrl::fromLocalFile(LISTVIEWWITHPAGEHEADER_FOLDER "/test_section.qml"));
126136 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
137+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
127138 model = view->rootObject()->findChild<QQuickListModel*>();
139+#else
140+ model = view->rootObject()->findChild<QQmlListModel*>();
141+#endif
128142 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
129143 QVERIFY(lvwph);
130144 QVERIFY(model);
@@ -212,6 +226,7 @@ private Q_SLOTS:
212226 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
213227 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
214228 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
229+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
215230 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
216231 }
217232
@@ -233,6 +248,7 @@ private Q_SLOTS:
233248 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
234249 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
235250 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
251+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
236252 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
237253 }
238254
@@ -254,6 +270,7 @@ private Q_SLOTS:
254270 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
255271 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
256272 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
273+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
257274 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
258275
259276 changeContentY(-30);
@@ -272,6 +289,7 @@ private Q_SLOTS:
272289 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
273290 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
274291 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
292+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
275293 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
276294 }
277295
@@ -327,6 +345,7 @@ private Q_SLOTS:
327345 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
328346 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
329347 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
348+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
330349 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
331350
332351 lvwph->positionAtBeginning();
@@ -352,6 +371,7 @@ private Q_SLOTS:
352371 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
353372 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
354373 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
374+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
355375 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
356376
357377 lvwph->positionAtBeginning();
@@ -396,6 +416,7 @@ private Q_SLOTS:
396416 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
397417 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
398418 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
419+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
399420 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
400421
401422 model->setProperty(0, "size", 400);
@@ -415,6 +436,7 @@ private Q_SLOTS:
415436 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
416437 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
417438 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
439+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
418440 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
419441
420442 scrollToTop();
@@ -468,6 +490,7 @@ private Q_SLOTS:
468490 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
469491 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
470492 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
493+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
471494 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
472495
473496 model->setProperty(0, "size", 400);
@@ -487,6 +510,7 @@ private Q_SLOTS:
487510 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
488511 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
489512 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
513+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
490514 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
491515
492516 scrollToTop();
@@ -523,6 +547,7 @@ private Q_SLOTS:
523547 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
524548 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
525549 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
550+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
526551 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
527552
528553 changeContentY(-30);
@@ -540,6 +565,7 @@ private Q_SLOTS:
540565 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
541566 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
542567 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
568+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
543569 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
544570
545571 changeContentY(30);
@@ -557,6 +583,7 @@ private Q_SLOTS:
557583 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
558584 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
559585 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
586+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
560587 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
561588
562589 changeContentY(-30);
@@ -574,6 +601,7 @@ private Q_SLOTS:
574601 QCOMPARE(lvwph->m_headerItemShownHeight, 30.);
575602 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
576603 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
604+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
577605 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
578606 }
579607
@@ -594,6 +622,7 @@ private Q_SLOTS:
594622 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
595623 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
596624 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
625+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
597626 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
598627
599628 lvwph->setDelegate(otherDelegate);
@@ -652,6 +681,7 @@ private Q_SLOTS:
652681 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
653682 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
654683 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
684+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
655685 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
656686
657687 scrollToTop();
@@ -690,6 +720,7 @@ private Q_SLOTS:
690720 QTRY_VERIFY(lvwph->isAtYEnd());
691721 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
692722 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
723+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
693724 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
694725
695726 scrollToTop();
@@ -726,6 +757,7 @@ private Q_SLOTS:
726757 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
727758 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
728759 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
760+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
729761 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
730762 }
731763
@@ -810,6 +842,7 @@ private Q_SLOTS:
810842 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
811843 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
812844 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
845+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
813846 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
814847
815848 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -830,6 +863,7 @@ private Q_SLOTS:
830863 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
831864 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
832865 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
866+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
833867 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
834868
835869 scrollToTop();
@@ -870,6 +904,7 @@ private Q_SLOTS:
870904 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
871905 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
872906 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
907+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
873908 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
874909
875910 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 3), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -890,6 +925,7 @@ private Q_SLOTS:
890925 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
891926 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
892927 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
928+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
893929 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
894930 }
895931
@@ -912,6 +948,7 @@ private Q_SLOTS:
912948 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
913949 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
914950 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
951+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
915952 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
916953
917954 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -932,6 +969,7 @@ private Q_SLOTS:
932969 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
933970 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
934971 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
972+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
935973 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
936974 }
937975
@@ -954,6 +992,7 @@ private Q_SLOTS:
954992 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
955993 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
956994 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
995+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
957996 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
958997
959998 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 1), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
@@ -974,6 +1013,7 @@ private Q_SLOTS:
9741013 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
9751014 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
9761015 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1016+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
9771017 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
9781018
9791019 scrollToTop();
@@ -1021,6 +1061,7 @@ private Q_SLOTS:
10211061 QVERIFY(!lvwph->isAtYEnd());
10221062 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
10231063 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1064+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
10241065 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
10251066
10261067 scrollToBottom();
@@ -1041,6 +1082,7 @@ private Q_SLOTS:
10411082 QVERIFY(lvwph->isAtYEnd());
10421083 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
10431084 QCOMPARE(section(lvwph->m_topSectionItem), QString("Lazy"));
1085+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 5);
10441086 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
10451087 }
10461088
@@ -1094,6 +1136,7 @@ private Q_SLOTS:
10941136 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
10951137 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
10961138 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1139+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 13);
10971140 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
10981141
10991142 changeContentY(-1700);
@@ -1118,6 +1161,7 @@ private Q_SLOTS:
11181161 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
11191162 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
11201163 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1164+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 4);
11211165 QCOMPARE(lvwph->m_topSectionItem->y(), -23.);
11221166 }
11231167
@@ -1179,6 +1223,7 @@ private Q_SLOTS:
11791223 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
11801224 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
11811225 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1226+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
11821227 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
11831228 }
11841229
@@ -1202,6 +1247,7 @@ private Q_SLOTS:
12021247 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
12031248 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
12041249 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1250+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
12051251 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
12061252 }
12071253
@@ -1224,6 +1270,7 @@ private Q_SLOTS:
12241270 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
12251271 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
12261272 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1273+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
12271274 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
12281275
12291276 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 1), Q_ARG(QVariant, 1));
@@ -1243,6 +1290,7 @@ private Q_SLOTS:
12431290 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
12441291 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
12451292 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1293+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
12461294 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
12471295 }
12481296
@@ -1265,6 +1313,7 @@ private Q_SLOTS:
12651313 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
12661314 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
12671315 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1316+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
12681317 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
12691318
12701319 QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 3), Q_ARG(QVariant, 1));
@@ -1284,6 +1333,7 @@ private Q_SLOTS:
12841333 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
12851334 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
12861335 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1336+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
12871337 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
12881338 }
12891339
@@ -1363,6 +1413,7 @@ private Q_SLOTS:
13631413 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
13641414 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
13651415 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1416+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 3);
13661417 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
13671418
13681419 QMetaObject::invokeMethod(model, "moveItems", Q_ARG(QVariant, 0), Q_ARG(QVariant, 5), Q_ARG(QVariant, 1));
@@ -1383,6 +1434,7 @@ private Q_SLOTS:
13831434 QVERIFY(!lvwph->isAtYEnd());
13841435 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
13851436 QCOMPARE(section(lvwph->m_topSectionItem), QString("Bold"));
1437+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
13861438 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
13871439 }
13881440
@@ -1406,6 +1458,7 @@ private Q_SLOTS:
14061458 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
14071459 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
14081460 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1461+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
14091462 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
14101463
14111464 model->setProperty(1, "size", 100);
@@ -1426,6 +1479,7 @@ private Q_SLOTS:
14261479 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
14271480 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
14281481 QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1482+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
14291483 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
14301484 }
14311485
@@ -1447,12 +1501,12 @@ private Q_SLOTS:
14471501 QCOMPARE(lvwph->m_headerItem->y(), 0.);
14481502 QCOMPARE(lvwph->m_headerItem->height(), 50.);
14491503 QCOMPARE(lvwph->contentY(), 20.);
1450− QCOMPARE(lvwph->m_headerItemShownHeight, 0.);;
1504+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
14511505 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
14521506
14531507 lvwph->showHeader();
14541508
1455− QTRY_VERIFY(!lvwph->m_headerShowAnimation->isRunning());
1509+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
14561510 QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
14571511 QCOMPARE(lvwph->m_firstVisibleIndex, 0);
14581512 verifyItem(0, -20., 190., false, "Agressive", true);
@@ -1467,6 +1521,7 @@ private Q_SLOTS:
14671521 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
14681522 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
14691523 QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
1524+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
14701525 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
14711526
14721527 scrollToTop();
@@ -1502,14 +1557,15 @@ private Q_SLOTS:
15021557 QCOMPARE(lvwph->m_headerItem->y(), 0.);
15031558 QCOMPARE(lvwph->m_headerItem->height(), 50.);
15041559 QCOMPARE(lvwph->contentY(), 375.);
1505− QCOMPARE(lvwph->m_headerItemShownHeight, 0.);;
1560+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
15061561 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
15071562 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1563+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
15081564 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
15091565
15101566 lvwph->showHeader();
15111567
1512− QTRY_VERIFY(!lvwph->m_headerShowAnimation->isRunning());
1568+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
15131569 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
15141570 QCOMPARE(lvwph->m_firstVisibleIndex, 0);
15151571 verifyItem(0, -375., 190., true, "Agressive", true);
@@ -1525,6 +1581,7 @@ private Q_SLOTS:
15251581 QCOMPARE(lvwph->m_headerItemShownHeight, 50.);
15261582 QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
15271583 QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1584+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
15281585 QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
15291586
15301587 scrollToTop();
@@ -1550,7 +1607,7 @@ private Q_SLOTS:
15501607
15511608 lvwph->showHeader();
15521609
1553− QTRY_VERIFY(!lvwph->m_headerShowAnimation->isRunning());
1610+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
15541611 QTRY_VERIFY (lvwph->isAtYEnd());
15551612 }
15561613
@@ -1634,10 +1691,356 @@ private Q_SLOTS:
16341691 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
16351692 }
16361693
1694+ void testCullOnBottomEdge()
1695+ {
1696+ changeContentY(240);
1697+
1698+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1699+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1700+ verifyItem(0, -190., 190., true, "Agressive", true);
1701+ verifyItem(1, 0., 240., false, "Regular", false);
1702+ verifyItem(2, 240., 390., false, "Mild", false);
1703+ verifyItem(3, 630., 390., true, "Bold", true);
1704+ QCOMPARE(lvwph->m_minYExtent, 0.);
1705+ QCOMPARE(lvwph->m_clipItem->y(), 240.);
1706+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1707+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1708+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1709+ QCOMPARE(lvwph->contentY(), 240.);
1710+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1711+ QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1712+ }
1713+
1714+ void testSectionItemCullOnFirstSectionItemTopEdge()
1715+ {
1716+ changeContentY(50);
1717+
1718+ verifyItem(0, 0., 190., false, "Agressive", false);
1719+ verifyItem(1, 190., 240., false, "Regular", false);
1720+ verifyItem(2, 430., 390., false, "Mild", false);
1721+ QCOMPARE(lvwph->m_minYExtent, 0.);
1722+ QCOMPARE(lvwph->m_clipItem->y(), 50.);
1723+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1724+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1725+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1726+ QCOMPARE(lvwph->contentY(), 50.);
1727+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1728+ QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1729+ }
1730+
1731+ void testSectionItemCullOnSecondSectionItemTopEdge()
1732+ {
1733+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 50), Q_ARG(QVariant, "Agressive"));
1734+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 50), Q_ARG(QVariant, "Agressive"));
1735+
1736+ changeContentY(140);
1737+
1738+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 5);
1739+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1740+ verifyItem(0, -90., 90., true, "Agressive", true);
1741+ verifyItem(1, 0., 50., false, QString(), false);
1742+ verifyItem(2, 50., 150., false, QString(), false);
1743+ verifyItem(3, 200., 240., false, "Regular", false);
1744+ verifyItem(4, 440., 390., false, "Mild", false);
1745+ QCOMPARE(lvwph->m_minYExtent, 0.);
1746+ QCOMPARE(lvwph->m_clipItem->y(), 140.);
1747+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1748+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1749+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1750+ QCOMPARE(lvwph->contentY(), 140.);
1751+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1752+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1753+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
1754+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
1755+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1756+ }
1757+
1758+ void testMaximizeVisibleArea()
1759+ {
1760+ bool res = lvwph->maximizeVisibleArea(2);
1761+ QVERIFY(res);
1762+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1763+
1764+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1765+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1766+ verifyItem(0, -278., 190., true, "Agressive", true);
1767+ verifyItem(1, -88., 240., false, "Regular", true);
1768+ verifyItem(2, 152, 390., false, "Mild", false);
1769+ verifyItem(3, 542, 390., true, "Bold", true);
1770+ QCOMPARE(lvwph->m_minYExtent, 0.);
1771+ QCOMPARE(lvwph->m_clipItem->y(), 328.);
1772+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1773+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1774+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1775+ QCOMPARE(lvwph->contentY(), 328.);
1776+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1777+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1778+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1779+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1780+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1781+ }
1782+
1783+ void testMaximizeVisibleAreaVisibleItems()
1784+ {
1785+ bool res = lvwph->maximizeVisibleArea(0);
1786+ QVERIFY(res);
1787+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1788+
1789+ verifyInitialTopPosition();
1790+
1791+ res = lvwph->maximizeVisibleArea(1);
1792+ QVERIFY(res);
1793+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1794+
1795+ verifyInitialTopPosition();
1796+ }
1797+
1798+ void testMaximizeVisibleAreaInvalidIndexes()
1799+ {
1800+ bool res = lvwph->maximizeVisibleArea(-1);
1801+ QVERIFY(!res);
1802+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1803+
1804+ verifyInitialTopPosition();
1805+
1806+ res = lvwph->maximizeVisibleArea(1000);
1807+ QVERIFY(!res);
1808+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1809+
1810+ verifyInitialTopPosition();
1811+
1812+ res = lvwph->maximizeVisibleArea(3);
1813+ QVERIFY(!res);
1814+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1815+
1816+ verifyInitialTopPosition();
1817+ }
1818+
1819+ void testMaximizeVisibleAreaBigElement()
1820+ {
1821+ model->setProperty(2, "size", 4000);
1822+ verifyItem(2, 480, 4040., false, "Mild", false);
1823+
1824+ bool res = lvwph->maximizeVisibleArea(2);
1825+ QVERIFY(res);
1826+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1827+
1828+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
1829+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1830+ verifyItem(0, -430., 190., true, "Agressive", true);
1831+ verifyItem(1, -240., 240., true, "Regular", true);
1832+ verifyItem(2, 0, 4040., false, "Mild", false);
1833+ QCOMPARE(lvwph->m_minYExtent, 0.);
1834+ QCOMPARE(lvwph->m_clipItem->y(), 480.);
1835+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1836+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1837+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1838+ QCOMPARE(lvwph->contentY(), 480.);
1839+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1840+ QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1841+ }
1842+
1843+ void testMaximizeVisibleAreaScrollDown()
1844+ {
1845+ changeContentY(350);
1846+ bool res = lvwph->maximizeVisibleArea(1);
1847+ QVERIFY(res);
1848+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1849+
1850+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1851+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1852+ verifyItem(0, -190., 190., true, "Agressive", true);
1853+ verifyItem(1, 0., 240., false, "Regular", false);
1854+ verifyItem(2, 240, 390., false, "Mild", false);
1855+ verifyItem(3, 630, 390., true, "Bold", true);
1856+ QCOMPARE(lvwph->m_minYExtent, 0.);
1857+ QCOMPARE(lvwph->m_clipItem->y(), 240.);
1858+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1859+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1860+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1861+ QCOMPARE(lvwph->contentY(), 240.);
1862+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1863+ QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1864+ }
1865+
1866+ void testMaximizeVisibleAreaScrollDownBigElement()
1867+ {
1868+ model->setProperty(1, "size", 1000);
1869+ changeContentY(1150);
1870+ bool res = lvwph->maximizeVisibleArea(1);
1871+ QVERIFY(res);
1872+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1873+
1874+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
1875+ QCOMPARE(lvwph->m_firstVisibleIndex, 1);
1876+ verifyItem(0, -498., 1040., false, "Regular", true);
1877+ verifyItem(1, 542., 390., true, "Mild", true);
1878+ QCOMPARE(lvwph->m_minYExtent, 1250/3.);
1879+ QCOMPARE(lvwph->m_clipItem->y(), 738.);
1880+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1881+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1882+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1883+ QCOMPARE(lvwph->contentY(), 738.);
1884+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1885+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1886+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1887+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1888+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1889+ }
1890+
1891+ void testMaximizeVisibleAreaBigElementInTheMiddle()
1892+ {
1893+ model->setProperty(1, "size", 1000);
1894+ changeContentY(650);
1895+
1896+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
1897+ QCOMPARE(lvwph->m_firstVisibleIndex, 1);
1898+ verifyItem(0, -410., 1040., false, "Regular", true);
1899+ verifyItem(1, 630., 390., true, "Mild", true);
1900+ QCOMPARE(lvwph->m_minYExtent, 525.);
1901+ QCOMPARE(lvwph->m_clipItem->y(), 650.);
1902+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1903+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1904+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1905+ QCOMPARE(lvwph->contentY(), 650.);
1906+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1907+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1908+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1909+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1910+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1911+
1912+ bool res = lvwph->maximizeVisibleArea(1);
1913+ QVERIFY(res);
1914+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1915+
1916+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 2);
1917+ QCOMPARE(lvwph->m_firstVisibleIndex, 1);
1918+ verifyItem(0, -410., 1040., false, "Regular", true);
1919+ verifyItem(1, 630., 390., true, "Mild", true);
1920+ QCOMPARE(lvwph->m_minYExtent, 525.);
1921+ QCOMPARE(lvwph->m_clipItem->y(), 650.);
1922+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1923+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1924+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1925+ QCOMPARE(lvwph->contentY(), 650.);
1926+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1927+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1928+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Regular"));
1929+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 1);
1930+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1931+ }
1932+
1933+ void testMaximizeVisibleAreaTopWithHalfPageHeader()
1934+ {
1935+ changeContentY(430);
1936+ changeContentY(-30);
1937+
1938+ bool res = lvwph->maximizeVisibleArea(1);
1939+ QVERIFY(res);
1940+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1941+
1942+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1943+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1944+ verifyItem(0, -190., 190., true, "Agressive", true);
1945+ verifyItem(1, 0., 240., false, "Regular", false);
1946+ verifyItem(2, 240, 390., false, "Mild", false);
1947+ verifyItem(3, 630, 390., true, "Bold", true);
1948+ QCOMPARE(lvwph->m_minYExtent, 0.);
1949+ QCOMPARE(lvwph->m_clipItem->y(), 240.);
1950+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1951+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1952+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1953+ QCOMPARE(lvwph->contentY(), 240.);
1954+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1955+ QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1956+ }
1957+
1958+ void testMaximizeVisibleAreaBottomWithHalfPageHeader()
1959+ {
1960+ changeContentY(430);
1961+ changeContentY(-30);
1962+
1963+ bool res = lvwph->maximizeVisibleArea(3);
1964+ QVERIFY(res);
1965+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1966+
1967+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1968+ QCOMPARE(lvwph->m_firstVisibleIndex, 1);
1969+ verifyItem(0, -478., 240., true, "Regular", true);
1970+ verifyItem(1, -238., 390., false, "Mild", true);
1971+ verifyItem(2, 152, 390., false, "Bold", false);
1972+ verifyItem(3, 542, 350., true, QString(), true);
1973+ QCOMPARE(lvwph->m_minYExtent, 152.5);
1974+ QCOMPARE(lvwph->m_clipItem->y(), 718.);
1975+ QCOMPARE(lvwph->m_clipItem->clip(), false);
1976+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
1977+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
1978+ QCOMPARE(lvwph->contentY(), 718.);
1979+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1980+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1981+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Mild"));
1982+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 2);
1983+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
1984+ }
1985+
1986+ void testMaximizeVisibleAreaTopSecondSectionItemStickySection()
1987+ {
1988+ QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 100), Q_ARG(QVariant, "Agressive"));
1989+ changeContentY(250);
1990+ bool res = lvwph->maximizeVisibleArea(1);
1991+ QVERIFY(res);
1992+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1993+
1994+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1995+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
1996+ verifyItem(0, -100., 140., false, "Agressive", true);
1997+ verifyItem(1, 40., 150., false, QString(), true);
1998+ verifyItem(2, 190, 240., false, "Regular", false);
1999+ verifyItem(3, 430, 390., false, "Mild", false);
2000+ QCOMPARE(lvwph->m_minYExtent, 0.);
2001+ QCOMPARE(lvwph->m_clipItem->y(), 150.);
2002+ QCOMPARE(lvwph->m_clipItem->clip(), false);
2003+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
2004+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
2005+ QCOMPARE(lvwph->contentY(), 150.);
2006+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
2007+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
2008+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
2009+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
2010+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
2011+
2012+ changeContentY(20);
2013+ res = lvwph->maximizeVisibleArea(1);
2014+ QVERIFY(res);
2015+ QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
2016+
2017+ QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
2018+ QCOMPARE(lvwph->m_firstVisibleIndex, 0);
2019+ verifyItem(0, -100., 140., false, "Agressive", true);
2020+ verifyItem(1, 40., 150., false, QString(), true);
2021+ verifyItem(2, 190, 240., false, "Regular", false);
2022+ verifyItem(3, 430, 390., false, "Mild", false);
2023+ QCOMPARE(lvwph->m_minYExtent, 0.);
2024+ QCOMPARE(lvwph->m_clipItem->y(), 150.);
2025+ QCOMPARE(lvwph->m_clipItem->clip(), false);
2026+ QCOMPARE(lvwph->m_headerItem->y(), 0.);
2027+ QCOMPARE(lvwph->m_headerItem->height(), 50.);
2028+ QCOMPARE(lvwph->contentY(), 150.);
2029+ QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
2030+ QVERIFY(!QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
2031+ QCOMPARE(section(lvwph->m_topSectionItem), QString("Agressive"));
2032+ QCOMPARE(sectionDelegateIndex(lvwph->m_topSectionItem), 0);
2033+ QCOMPARE(lvwph->m_topSectionItem->y(), 0.);
2034+ }
2035+
16372036private:
16382037 QQuickView *view;
16392038 ListViewWithPageHeader *lvwph;
2039+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
16402040 QQuickListModel *model;
2041+#else
2042+ QQmlListModel *model;
2043+#endif
16412044 QQmlComponent *otherDelegate;
16422045};
16432046