Merge lp:~aacid/unity8/journal_misc_fixes into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 641
Merged at revision: 646
Proposed branch: lp:~aacid/unity8/journal_misc_fixes
Merge into: lp:unity8
Diff against target: 164 lines (+71/-11)
5 files modified
plugins/DashViews/abstractjournal.cpp (+1/-1)
plugins/DashViews/horizontaljournal.cpp (+1/-0)
plugins/DashViews/verticaljournal.cpp (+2/-1)
tests/plugins/DashViews/horizontaljournaltest.cpp (+35/-9)
tests/plugins/DashViews/verticaljournaltest.cpp (+32/-0)
To merge this branch: bzr merge lp:~aacid/unity8/journal_misc_fixes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michał Karnicki (community) Approve
Review via email: mp+201785@code.launchpad.net

Commit message

Misc journal fixes

Don't init *modelIndex to INT_MAX
  Makes no sense since we're not doing any qMin and the calling function also accepts any index >= 0 as valid
  so in some cases it may end up wanting to create an index that doesn't exist

Don't refill if height() < 0, that gives bad ranges for from/to and the code gets confused

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:640
http://jenkins.qa.ubuntu.com/job/unity8-ci/2070/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2365
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2238
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/922
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/592
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/594
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/594/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/592
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2075
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2367
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2367/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2238
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2238/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4695
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3121

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2070/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Karnicki (karni) wrote :

+1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:640
http://jenkins.qa.ubuntu.com/job/unity8-ci/2085/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2393
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2264
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/942
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/607
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/609
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/609/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/607
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2099
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2395
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2395/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2264
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2264/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4715
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3144

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2085/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Can we test this?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:641
http://jenkins.qa.ubuntu.com/job/unity8-ci/2097/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2426
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2282
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/955
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/619
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/621
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/621/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/619
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2118
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2428
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2428/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2282
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2282/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4728
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3164

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2097/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michał Karnicki (karni) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/949/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3912
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2446
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2296
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/962
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/335
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/335
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/335/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/335
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2136
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2448
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2448/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2296
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2296/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4742
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3180

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/950/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3918
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2461
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2304
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/963
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/336
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/336
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/336/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/336
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2150
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2463
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2463/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2304
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2304/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4750
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3195

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/DashViews/abstractjournal.cpp'
2--- plugins/DashViews/abstractjournal.cpp 2014-01-07 14:51:15 +0000
3+++ plugins/DashViews/abstractjournal.cpp 2014-01-17 10:09:05 +0000
4@@ -194,7 +194,7 @@
5
6 void AbstractJournal::refill()
7 {
8- if (!isComponentComplete()) {
9+ if (!isComponentComplete() || height() < 0) {
10 return;
11 }
12
13
14=== modified file 'plugins/DashViews/horizontaljournal.cpp'
15--- plugins/DashViews/horizontaljournal.cpp 2014-01-09 17:14:47 +0000
16+++ plugins/DashViews/horizontaljournal.cpp 2014-01-17 10:09:05 +0000
17@@ -173,6 +173,7 @@
18 m_visibleItems.clear();
19 m_lastInRowIndexPosition.clear();
20 m_firstVisibleIndex = -1;
21+ setImplicitHeightDirty();
22 }
23
24 void HorizontalJournal::calculateImplicitHeight()
25
26=== modified file 'plugins/DashViews/verticaljournal.cpp'
27--- plugins/DashViews/verticaljournal.cpp 2014-01-03 09:18:24 +0000
28+++ plugins/DashViews/verticaljournal.cpp 2014-01-17 10:09:05 +0000
29@@ -79,7 +79,7 @@
30
31 void VerticalJournal::findTopModelIndexToAdd(int *modelIndex, qreal *yPos)
32 {
33- *modelIndex = INT_MAX;
34+ *modelIndex = 0;
35 *yPos = std::numeric_limits<qreal>::lowest();
36 int columnToAddTo = -1;
37
38@@ -179,6 +179,7 @@
39 column.clear();
40 }
41 m_indexColumnMap.clear();
42+ setImplicitHeightDirty();
43 }
44
45 void VerticalJournal::calculateImplicitHeight()
46
47=== modified file 'tests/plugins/DashViews/horizontaljournaltest.cpp'
48--- tests/plugins/DashViews/horizontaljournaltest.cpp 2014-01-03 08:37:09 +0000
49+++ tests/plugins/DashViews/horizontaljournaltest.cpp 2014-01-17 10:09:05 +0000
50@@ -126,9 +126,9 @@
51 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
52
53 model = new WidthModel();
54- QStringList heightList;
55- heightList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
56- model->setStringList(heightList);
57+ QStringList widthList;
58+ widthList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
59+ model->setStringList(widthList);
60
61 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/horizontaljournaltest.qml"));
62
63@@ -336,9 +336,9 @@
64
65 void testModelReset()
66 {
67- QStringList heightList;
68- heightList << "100" << "50" << "125" << "25" << "50" << "50";
69- model->setStringList(heightList);
70+ QStringList widthList;
71+ widthList << "100" << "50" << "125" << "25" << "50" << "50";
72+ model->setStringList(widthList);
73
74 QTRY_COMPARE(hj->m_firstVisibleIndex, 0);
75 QTRY_COMPARE(hj->m_visibleItems.count(), 6);
76@@ -386,9 +386,9 @@
77 void testModelAppendRemoveLast()
78 {
79 WidthModel *model2 = new WidthModel();
80- QStringList heightList;
81- heightList << "100" << "50" << "125" << "25" << "50" << "50";
82- model2->setStringList(heightList);
83+ QStringList widthList;
84+ widthList << "100" << "50" << "125" << "25" << "50" << "50";
85+ model2->setStringList(widthList);
86 hj->setModel(model2);
87 delete model;
88 model = model2;
89@@ -454,6 +454,32 @@
90 QCOMPARE(hj->implicitHeight(), 310.);
91 }
92
93+ void testNegativeHeight()
94+ {
95+ QQuickItemPrivate::get(hj)->anchors()->resetFill();
96+ hj->setHeight(-8);
97+
98+ QStringList widthList;
99+ widthList << "100" << "50" << "125" << "25" << "50" << "50";
100+ model->setStringList(widthList);
101+
102+ QTRY_COMPARE(hj->m_visibleItems.count(), 0);
103+ QTRY_COMPARE(hj->implicitHeight(), 0.);
104+ }
105+
106+ void testNegativeDelegateCreationRange()
107+ {
108+ hj->setDelegateCreationBegin(0);
109+ hj->setDelegateCreationEnd(-100);
110+
111+ QStringList widthList;
112+ widthList << "100" << "50" << "50" << "30";
113+ model->setStringList(widthList);
114+
115+ QTRY_COMPARE(hj->m_visibleItems.count(), 0);
116+ QTRY_COMPARE(hj->implicitHeight(), 0.);
117+ }
118+
119 private:
120 QQuickView *view;
121 HorizontalJournal *hj;
122
123=== modified file 'tests/plugins/DashViews/verticaljournaltest.cpp'
124--- tests/plugins/DashViews/verticaljournaltest.cpp 2014-01-03 08:37:09 +0000
125+++ tests/plugins/DashViews/verticaljournaltest.cpp 2014-01-17 10:09:05 +0000
126@@ -459,6 +459,38 @@
127 verifyItem(vj->m_columnVisibleItems[1][2], 7, 160, 120, true);
128 }
129
130+ void testNegativeHeight()
131+ {
132+ QQuickItemPrivate::get(vj)->anchors()->resetFill();
133+ vj->setHeight(-8);
134+
135+ QStringList heightList;
136+ heightList << "100" << "50" << "50" << "30";
137+ model->setStringList(heightList);
138+
139+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 3);
140+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 0);
141+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 0);
142+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 0);
143+ QTRY_COMPARE(vj->implicitHeight(), 0.);
144+ }
145+
146+ void testNegativeDelegateCreationRange()
147+ {
148+ vj->setDelegateCreationBegin(0);
149+ vj->setDelegateCreationEnd(-100);
150+
151+ QStringList heightList;
152+ heightList << "100" << "50" << "50" << "30";
153+ model->setStringList(heightList);
154+
155+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 3);
156+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 0);
157+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 0);
158+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 0);
159+ QTRY_COMPARE(vj->implicitHeight(), 0.);
160+ }
161+
162 private:
163 QQuickView *view;
164 VerticalJournal *vj;

Subscribers

People subscribed via source and target branches