on xenial help sign in
showHeader at bottom bugfix + test
commitc5e376f3820d00d341f84d1ed8537c9f3ef7ef9b authorAlbert Astals <albert.astals@canonical.com> dateThu 20 Jun 2013, 16:28 (13 years ago) parentab1237b
3 files changed+24−2
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+4−2 tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp+10 tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp+10
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+4−2
@@ -394,10 +394,12 @@ void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
394394 // We will be changing the clip item, need to accomadate for it
395395 // otherwise we move the firstItem down/up twice (unless the
396396 // show header animation is running, where we want to keep the viewport stable)
397− if (!m_headerShowAnimation->isRunning())
397+ if (!m_headerShowAnimation->isRunning()) {
398398 diff += oldHeaderItemShownHeight - m_headerItemShownHeight;
399− else
399+ } else {
400400 diff = -diff;
401+ m_contentHeightDirty = true;
402+ }
401403 }
402404 if (!m_visibleItems.isEmpty()) {
403405 updateClipItem();
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp+10
@@ -1446,6 +1446,16 @@ private Q_SLOTS:
14461446 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
14471447 }
14481448
1449+ void testShowHeaderAtBottom()
1450+ {
1451+ scrollToBottom();
1452+
1453+ lvwph->showHeader();
1454+
1455+ QTRY_VERIFY(!lvwph->m_headerShowAnimation->isRunning());
1456+ QVERIFY (lvwph->isAtYEnd());
1457+ }
1458+
14491459private:
14501460 QQuickView *view;
14511461 ListViewWithPageHeader *lvwph;
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp+10
@@ -1667,6 +1667,16 @@ private Q_SLOTS:
16671667 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
16681668 }
16691669
1670+ void testShowHeaderAtBottom()
1671+ {
1672+ scrollToBottom();
1673+
1674+ lvwph->showHeader();
1675+
1676+ QTRY_VERIFY(!lvwph->m_headerShowAnimation->isRunning());
1677+ QVERIFY (lvwph->isAtYEnd());
1678+ }
1679+
16701680private:
16711681 QQuickView *view;
16721682 ListViewWithPageHeader *lvwph;