on xenial help sign in
showHeader at bottom bugfix + test
c5e376fAlbert Astals
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+4−2
@@ -394,10 +394,12 @@ void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
394 // We will be changing the clip item, need to accomadate for it
394 // We will be changing the clip item, need to accomadate for it
395 // otherwise we move the firstItem down/up twice (unless the
395 // otherwise we move the firstItem down/up twice (unless the
396 // show header animation is running, where we want to keep the viewport stable)
396 // show header animation is running, where we want to keep the viewport stable)
397− if (!m_headerShowAnimation->isRunning())
397+ if (!m_headerShowAnimation->isRunning()) {
398 diff += oldHeaderItemShownHeight - m_headerItemShownHeight;
398 diff += oldHeaderItemShownHeight - m_headerItemShownHeight;
399− else
399+ } else {
400 diff = -diff;
400 diff = -diff;
401+ m_contentHeightDirty = true;
402+ }
401 }
403 }
402 if (!m_visibleItems.isEmpty()) {
404 if (!m_visibleItems.isEmpty()) {
403 updateClipItem();
405 updateClipItem();
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp+10
@@ -1446,6 +1446,16 @@ private Q_SLOTS:
1446 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1446 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1447 }
1447 }
1448
1448
1449+ void testShowHeaderAtBottom()
1450+ {
1451+ scrollToBottom();
1452+
1453+ lvwph->showHeader();
1454+
1455+ QTRY_VERIFY(!lvwph->m_headerShowAnimation->isRunning());
1456+ QVERIFY (lvwph->isAtYEnd());
1457+ }
1458+
1449private:
1459private:
1450 QQuickView *view;
1460 QQuickView *view;
1451 ListViewWithPageHeader *lvwph;
1461 ListViewWithPageHeader *lvwph;
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp+10
@@ -1667,6 +1667,16 @@ private Q_SLOTS:
1667 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1667 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
1668 }
1668 }
1669
1669
1670+ void testShowHeaderAtBottom()
1671+ {
1672+ scrollToBottom();
1673+
1674+ lvwph->showHeader();
1675+
1676+ QTRY_VERIFY(!lvwph->m_headerShowAnimation->isRunning());
1677+ QVERIFY (lvwph->isAtYEnd());
1678+ }
1679+
1670private:
1680private:
1671 QQuickView *view;
1681 QQuickView *view;
1672 ListViewWithPageHeader *lvwph;
1682 ListViewWithPageHeader *lvwph;