Merge lp:~aacid/unity8/lvwph_bad_header_position_1245824 into lp:unity8
- lvwph_bad_header_position_1245824
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | MichaĆ Sawicz |
Approved revision: | 499 |
Merged at revision: | 538 |
Proposed branch: | lp:~aacid/unity8/lvwph_bad_header_position_1245824 |
Merge into: | lp:unity8 |
Diff against target: |
181 lines (+107/-6) 3 files modified
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp (+4/-5) tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp (+22/-0) tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp (+81/-1) |
To merge this branch: | bzr merge lp:~aacid/unity8/lvwph_bad_header_position_1245824 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Nick Dedekind (community) | Approve | ||
Review via email:
|
Commit message
Fix header getting lost as per bug 1245824
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michael Zanetti (mzanetti) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:492
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:498
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Nick Dedekind (nick-dedekind) wrote : | # |
testMaximizeVis
Is this a validation of a previous assumption or testing something broken that was fixed?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : | # |
Yes, that is the point.
If you read the log you can see that in r493 I introduce testMaximizeVis
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Nick Dedekind (nick-dedekind) wrote : | # |
> Yes, that is the point.
>
> If you read the log you can see that in r493 I introduce
> testMaximizeVis
> failing at the moment, that is correct since highlights a regression caused by
> this branch" and then in r498 I introduce testDownAndUp that is "the test that
> shows why the fix is needed".
Ok thanks.
LGTM
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:499
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'plugins/ListViewWithPageHeader/listviewwithpageheader.cpp' |
2 | --- plugins/ListViewWithPageHeader/listviewwithpageheader.cpp 2013-11-19 04:53:47 +0000 |
3 | +++ plugins/ListViewWithPageHeader/listviewwithpageheader.cpp 2013-11-19 08:37:05 +0000 |
4 | @@ -477,7 +477,7 @@ |
5 | qreal diff = m_previousContentY - contentY(); |
6 | const bool showHeaderAnimationRunning = m_contentYAnimation->isRunning() && contentYAnimationType == ContentYAnimationShowHeader; |
7 | if (m_headerItem) { |
8 | - auto oldHeaderItemShownHeight = m_headerItemShownHeight; |
9 | + const auto oldHeaderItemShownHeight = m_headerItemShownHeight; |
10 | if (contentY() < -m_minYExtent) { |
11 | // Stick the header item to the top when dragging down |
12 | m_headerItem->setY(contentY()); |
13 | @@ -492,9 +492,9 @@ |
14 | const bool notShownByItsOwn = contentY() + diff >= m_headerItem->y() + m_headerItem->height(); |
15 | const bool maximizeVisibleAreaRunning = m_contentYAnimation->isRunning() && contentYAnimationType == ContentYAnimationMaximizeVisibleArea; |
16 | |
17 | - if (!scrolledUp && contentY() == -m_minYExtent) { |
18 | + if (!scrolledUp && (contentY() == -m_minYExtent || (m_headerItemShownHeight == 0 && m_previousContentY == m_headerItem->y()))) { |
19 | m_headerItemShownHeight = 0; |
20 | - m_headerItem->setY(contentY()); |
21 | + m_headerItem->setY(-m_minYExtent); |
22 | } else if ((scrolledUp && notRebounding && notShownByItsOwn && !maximizeVisibleAreaRunning) || (m_headerItemShownHeight > 0) || m_inContentHeightKeepHeaderShown) { |
23 | if (maximizeVisibleAreaRunning && diff > 0) // If we are maximizing and the header was shown, make sure we hide it |
24 | m_headerItemShownHeight -= diff; |
25 | @@ -981,7 +981,6 @@ |
26 | if (growUp) { |
27 | ListItem *firstItem = m_visibleItems.first(); |
28 | firstItem->setY(firstItem->y() - item->height()); |
29 | - adjustMinYExtent(); |
30 | } |
31 | // Adding an item may break a "same section" chain, so check |
32 | // if we need adding a new section item |
33 | @@ -992,7 +991,6 @@ |
34 | if (growUp && nextItem->m_sectionItem) { |
35 | ListItem *firstItem = m_visibleItems.first(); |
36 | firstItem->setY(firstItem->y() - nextItem->m_sectionItem->height()); |
37 | - adjustMinYExtent(); |
38 | } |
39 | } |
40 | } |
41 | @@ -1001,6 +999,7 @@ |
42 | ListItem *firstItem = m_visibleItems.first(); |
43 | firstItem->setY(oldFirstValidIndexPos); |
44 | } |
45 | + adjustMinYExtent(); |
46 | } else if (insert.index <= m_firstVisibleIndex) { |
47 | m_firstVisibleIndex += insert.count; |
48 | } |
49 | |
50 | === modified file 'tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp' |
51 | --- tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp 2013-11-18 08:33:33 +0000 |
52 | +++ tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp 2013-11-19 08:37:05 +0000 |
53 | @@ -1589,6 +1589,28 @@ |
54 | QCOMPARE(lvwph->m_headerItemShownHeight, 0.); |
55 | } |
56 | |
57 | + void testMaximizeVisibleAreaTopWithHalfPageHeaderUpDown() |
58 | + { |
59 | + testMaximizeVisibleAreaTopWithHalfPageHeader(); |
60 | + |
61 | + changeContentY(-60); |
62 | + changeContentY(15); |
63 | + |
64 | + QTRY_COMPARE(lvwph->m_visibleItems.count(), 4); |
65 | + QCOMPARE(lvwph->m_firstVisibleIndex, 0); |
66 | + verifyItem(0, -140., 150., false); |
67 | + verifyItem(1, 10., 200., false); |
68 | + verifyItem(2, 210, 350., false); |
69 | + verifyItem(3, 560, 350., true); |
70 | + QCOMPARE(lvwph->m_minYExtent, 0.); |
71 | + QCOMPARE(lvwph->m_clipItem->y(), 190.); |
72 | + QCOMPARE(lvwph->m_clipItem->clip(), true); |
73 | + QCOMPARE(lvwph->m_headerItem->y(), 140.); |
74 | + QCOMPARE(lvwph->m_headerItem->height(), 50.); |
75 | + QCOMPARE(lvwph->contentY(), 155.); |
76 | + QCOMPARE(lvwph->m_headerItemShownHeight, 35.); |
77 | + } |
78 | + |
79 | void testMaximizeVisibleAreaBottomWithHalfPageHeader() |
80 | { |
81 | changeContentY(430); |
82 | |
83 | === modified file 'tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp' |
84 | --- tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp 2013-09-02 13:26:12 +0000 |
85 | +++ tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp 2013-11-19 08:37:05 +0000 |
86 | @@ -1734,7 +1734,25 @@ |
87 | QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 50), Q_ARG(QVariant, "Agressive")); |
88 | QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 50), Q_ARG(QVariant, "Agressive")); |
89 | |
90 | - changeContentY(140); |
91 | + changeContentY(5); |
92 | + |
93 | + QTRY_COMPARE(lvwph->m_visibleItems.count(), 5); |
94 | + QCOMPARE(lvwph->m_firstVisibleIndex, 0); |
95 | + verifyItem(0, 45., 90., false, "Agressive", false); |
96 | + verifyItem(1, 135., 50., false, QString(), false); |
97 | + verifyItem(2, 185., 150., false, QString(), false); |
98 | + verifyItem(3, 335., 240., false, "Regular", false); |
99 | + verifyItem(4, 575., 390., true, "Mild", true); |
100 | + QCOMPARE(lvwph->m_minYExtent, 0.); |
101 | + QCOMPARE(lvwph->m_clipItem->y(), 5.); |
102 | + QCOMPARE(lvwph->m_clipItem->clip(), false); |
103 | + QCOMPARE(lvwph->m_headerItem->y(), 0.); |
104 | + QCOMPARE(lvwph->m_headerItem->height(), 50.); |
105 | + QCOMPARE(lvwph->contentY(), 5.); |
106 | + QCOMPARE(lvwph->m_headerItemShownHeight, 0.); |
107 | + QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled); |
108 | + |
109 | + changeContentY(135); |
110 | |
111 | QTRY_COMPARE(lvwph->m_visibleItems.count(), 5); |
112 | QCOMPARE(lvwph->m_firstVisibleIndex, 0); |
113 | @@ -2076,6 +2094,68 @@ |
114 | QCOMPARE(spy.count(), 0); |
115 | } |
116 | |
117 | + void testDownAndUp() |
118 | + { |
119 | + QMetaObject::invokeMethod(model, "removeItems", Q_ARG(QVariant, 1), Q_ARG(QVariant, 5)); |
120 | + |
121 | + QTRY_COMPARE(lvwph->m_visibleItems.count(), 1); |
122 | + QCOMPARE(lvwph->m_firstVisibleIndex, 0); |
123 | + verifyItem(0, 50., 190., false, "Agressive", false); |
124 | + QCOMPARE(lvwph->m_minYExtent, 0.); |
125 | + QCOMPARE(lvwph->m_clipItem->y(), 0.); |
126 | + QCOMPARE(lvwph->m_clipItem->clip(), false); |
127 | + QCOMPARE(lvwph->m_headerItem->y(), 0.); |
128 | + QCOMPARE(lvwph->m_headerItem->height(), 50.); |
129 | + QCOMPARE(lvwph->contentY(), 0.); |
130 | + QCOMPARE(lvwph->m_headerItemShownHeight, 0.); |
131 | + QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled); |
132 | + |
133 | + QTest::qWait(1); |
134 | + |
135 | + changeContentY(-15); |
136 | + |
137 | + QTRY_COMPARE(lvwph->m_visibleItems.count(), 1); |
138 | + QCOMPARE(lvwph->m_firstVisibleIndex, 0); |
139 | + verifyItem(0, 65., 190., false, "Agressive", false); |
140 | + QCOMPARE(lvwph->m_minYExtent, 0.); |
141 | + QCOMPARE(lvwph->m_clipItem->y(), -15.); |
142 | + QCOMPARE(lvwph->m_clipItem->clip(), false); |
143 | + QCOMPARE(lvwph->m_headerItem->y(), -15.); |
144 | + QCOMPARE(lvwph->m_headerItem->height(), 65.); |
145 | + QCOMPARE(lvwph->contentY(), -15.); |
146 | + QCOMPARE(lvwph->m_headerItemShownHeight, 0.); |
147 | + QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled); |
148 | + |
149 | + changeContentY(25); |
150 | + |
151 | + QTRY_COMPARE(lvwph->m_visibleItems.count(), 1); |
152 | + QCOMPARE(lvwph->m_firstVisibleIndex, 0); |
153 | + verifyItem(0, 40., 190., false, "Agressive", false); |
154 | + QCOMPARE(lvwph->m_minYExtent, 0.); |
155 | + QCOMPARE(lvwph->m_clipItem->y(), 10.); |
156 | + QCOMPARE(lvwph->m_clipItem->clip(), false); |
157 | + QCOMPARE(lvwph->m_headerItem->y(), 0.); |
158 | + QCOMPARE(lvwph->m_headerItem->height(), 50.); |
159 | + QCOMPARE(lvwph->contentY(), 10.); |
160 | + QCOMPARE(lvwph->m_headerItemShownHeight, 0.); |
161 | + QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled); |
162 | + |
163 | + |
164 | + QTest::mouseClick(view, Qt::LeftButton, Qt::NoModifier, QPoint(0, 0)); |
165 | + |
166 | + QTRY_COMPARE(lvwph->m_visibleItems.count(), 1); |
167 | + QCOMPARE(lvwph->m_firstVisibleIndex, 0); |
168 | + verifyItem(0, 50., 190., false, "Agressive", false); |
169 | + QCOMPARE(lvwph->m_minYExtent, 0.); |
170 | + QCOMPARE(lvwph->m_clipItem->y(), 0.); |
171 | + QCOMPARE(lvwph->m_clipItem->clip(), false); |
172 | + QCOMPARE(lvwph->m_headerItem->y(), 0.); |
173 | + QCOMPARE(lvwph->m_headerItem->height(), 50.); |
174 | + QCOMPARE(lvwph->contentY(), 0.); |
175 | + QCOMPARE(lvwph->m_headerItemShownHeight, 0.); |
176 | + QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled); |
177 | + } |
178 | + |
179 | private: |
180 | QQuickView *view; |
181 | ListViewWithPageHeader *lvwph; |
yes! fixes the issue for me!