Merge lp:~unity-team/ubuntu-ui-toolkit/dynamic-grid-unit into lp:ubuntu-ui-toolkit/staging

Proposed by Michał Sawicz
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 1321
Merged at revision: 1966
Proposed branch: lp:~unity-team/ubuntu-ui-toolkit/dynamic-grid-unit
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 146 lines (+31/-15)
7 files modified
src/Ubuntu/Components/1.3/OptionSelectorDelegate.qml (+1/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml (+7/-7)
src/Ubuntu/Components/Themes/Ambiance/1.3/SheetForegroundStyle.qml (+1/-1)
src/Ubuntu/Components/plugin/label_p.h (+0/-1)
src/Ubuntu/Components/plugin/uclabel.cpp (+3/-5)
src/Ubuntu/Components/plugin/uclabel.h (+1/-0)
tests/unit/tst_components/tst_label13.qml (+18/-0)
To merge this branch: bzr merge lp:~unity-team/ubuntu-ui-toolkit/dynamic-grid-unit
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+293135@code.launchpad.net

Commit message

Additional DGU fixes

To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

+++ src/Ubuntu/Components/1.2/OptionSelectorDelegate.qml
+++ src/Ubuntu/Components/Themes/Ambiance/1.2/SheetForegroundStyle.qml

Unsure if those 1.2 bits should be done. Arguably they are not critical fixes and it's better to avoid changing that version.

The Qt.binding pattern seems sensible. Probably not unit-testable as they all affect visuals which we don't test for exact values anyway.
However uclabel.cpp we need to test. We had a bug before with defaults, not the size but the color. See tests/unit_x11/tst_components/tst_label_extras.qml. More generally size-related cases are covered by tests/unit/tst_components/tst_label13.qml. I'm guessing this would reproduce by changing the font once or twice.

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote :

> Unsure if those 1.2 bits should be done. Arguably they are not critical
> fixes and it's better to avoid changing that version.

1.2 changes reverted

Revision history for this message
Albert Astals Cid (aacid) wrote :

> However uclabel.cpp we need to test.

Added a test that proves the change is needed (fails with the old code). None of the existing tests regresses. Is that enough?

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

> > However uclabel.cpp we need to test.
>
> Added a test that proves the change is needed (fails with the old code). None
> of the existing tests regresses. Is that enough?

Perfect!

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/1.3/OptionSelectorDelegate.qml'
2--- src/Ubuntu/Components/1.3/OptionSelectorDelegate.qml 2015-09-21 14:44:13 +0000
3+++ src/Ubuntu/Components/1.3/OptionSelectorDelegate.qml 2016-04-29 10:30:35 +0000
4@@ -127,7 +127,7 @@
5 }
6
7 Component.onCompleted: {
8- height = listView.itemHeight = childrenRect.height;
9+ height = listView.itemHeight = Qt.binding(function() { return childrenRect.height; });
10 }
11
12 //Since we don't want to add states to our divider, we use the exposed alias provided in Empty to access it and alter it's opacity from here.
13
14=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml'
15--- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2016-04-27 13:58:24 +0000
16+++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2016-04-29 10:30:35 +0000
17@@ -63,19 +63,19 @@
18 if (landscape) {
19 if (hasSubtitle) {
20 // with subtitle, and with or without extension
21- titleAreaHeight = units.gu(4);
22- titleBottomSpacing = units.gu(2);
23+ titleAreaHeight = Qt.binding(function() { return units.gu(4) });
24+ titleBottomSpacing = Qt.binding(function() { return units.gu(2) });
25 } else if (hasExtension) {
26- titleAreaHeight = units.gu(4);
27- titleBottomSpacing = units.gu(1);
28+ titleAreaHeight = Qt.binding(function() { return units.gu(4) });
29+ titleBottomSpacing = Qt.binding(function() { return units.gu(1) });
30 } else {
31- titleAreaHeight = units.gu(5)
32+ titleAreaHeight = Qt.binding(function() { return units.gu(5) });
33 titleBottomSpacing = 0;
34 }
35 } else { // portrait
36- titleAreaHeight = units.gu(6);
37+ titleAreaHeight = Qt.binding(function() { return units.gu(6) });
38 if (hasSubtitle) {
39- titleBottomSpacing = units.gu(1);
40+ titleBottomSpacing = Qt.binding(function() { return units.gu(1) });
41 } else {
42 titleBottomSpacing = 0;
43 }
44
45=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/SheetForegroundStyle.qml'
46--- src/Ubuntu/Components/Themes/Ambiance/1.3/SheetForegroundStyle.qml 2015-04-25 07:36:13 +0000
47+++ src/Ubuntu/Components/Themes/Ambiance/1.3/SheetForegroundStyle.qml 2016-04-29 10:30:35 +0000
48@@ -81,7 +81,7 @@
49 button.anchors.left = container.left;
50 button.anchors.right = container.right;
51 button.anchors.verticalCenter = container.verticalCenter;
52- button.anchors.margins = units.gu(1);
53+ button.anchors.margins = Qt.binding(function() { return units.gu(1) });
54 }
55
56 Connections {
57
58=== modified file 'src/Ubuntu/Components/plugin/label_p.h'
59--- src/Ubuntu/Components/plugin/label_p.h 2016-03-11 19:28:41 +0000
60+++ src/Ubuntu/Components/plugin/label_p.h 2016-04-29 10:30:35 +0000
61@@ -47,7 +47,6 @@
62 };
63
64 UCLabel *q_ptr;
65- QFont defaultFont;
66 UCLabel::ColorProviderFunc defaultColor;
67 UCLabel::TextSize textSize;
68 quint8 flags;
69
70=== modified file 'src/Ubuntu/Components/plugin/uclabel.cpp'
71--- src/Ubuntu/Components/plugin/uclabel.cpp 2016-04-20 15:00:27 +0000
72+++ src/Ubuntu/Components/plugin/uclabel.cpp 2016-04-29 10:30:35 +0000
73@@ -130,16 +130,14 @@
74 q->postThemeChanged();
75
76 updatePixelSize();
77- defaultFont = q->font();
78+ QFont defaultFont = q->font();
79 defaultFont.setFamily("Ubuntu");
80 defaultFont.setWeight(QFont::Light);
81 q->setFont(defaultFont);
82 updateRenderType();
83
84 QObject::connect(UCUnits::instance(), SIGNAL(gridUnitChanged()), q, SLOT(updateRenderType()));
85- QObject::connect(UCUnits::instance(), &UCUnits::gridUnitChanged, q, [this](){
86- updatePixelSize();
87- }, Qt::DirectConnection);
88+ QObject::connect(UCUnits::instance(), SIGNAL(gridUnitChanged()), q, SLOT(updatePixelSize()));
89
90 QObject::connect(q, &UCLabel::enabledChanged, q, &UCLabel::postThemeChanged, Qt::DirectConnection);
91
92@@ -202,7 +200,7 @@
93 Q_D(UCLabel);
94 // we must restrict ourself to the pixelSize change as any font property change will
95 // lead to the setter call.
96- if (d->defaultFont.pixelSize() != font.pixelSize()) {
97+ if (this->font().pixelSize() != font.pixelSize()) {
98 d->flags |= UCLabelPrivate::PixelSizeSet;
99 }
100 QQuickText::setFont(font);
101
102=== modified file 'src/Ubuntu/Components/plugin/uclabel.h'
103--- src/Ubuntu/Components/plugin/uclabel.h 2016-04-20 15:00:27 +0000
104+++ src/Ubuntu/Components/plugin/uclabel.h 2016-04-29 10:30:35 +0000
105@@ -91,6 +91,7 @@
106 Q_DECLARE_PRIVATE_D(d_ptr.data(), UCLabel)
107 Q_DISABLE_COPY(UCLabel)
108 Q_PRIVATE_SLOT(d_func(), void updateRenderType())
109+ Q_PRIVATE_SLOT(d_func(), void updatePixelSize())
110 };
111
112 QML_DECLARE_TYPE(UCLabel)
113
114=== modified file 'tests/unit/tst_components/tst_label13.qml'
115--- tests/unit/tst_components/tst_label13.qml 2016-03-14 18:56:42 +0000
116+++ tests/unit/tst_components/tst_label13.qml 2016-04-29 10:30:35 +0000
117@@ -158,6 +158,20 @@
118 verifyManualRenderType(textSetRenderType, Text.NativeRendering);
119 }
120
121+ function test_colorGUPixelSize() {
122+ units.gridUnit = 8;
123+ textTestColorGUPixelSize.font.bold = true;
124+ var pixelSizeAt8GU = textTestColorGUPixelSize.font.pixelSize;
125+
126+ units.gridUnit = 16;
127+ textTestColorGUPixelSize.font.bold = false;
128+ verify(textTestColorGUPixelSize.font.pixelSize > pixelSizeAt8GU);
129+
130+ units.gridUnit = 8;
131+ textTestColorGUPixelSize.font.bold = true;
132+ compare(textTestColorGUPixelSize.font.pixelSize, pixelSizeAt8GU);
133+ }
134+
135 Label {
136 id: textCustom
137 }
138@@ -192,4 +206,8 @@
139 Label {
140 id: textSetRenderType
141 }
142+
143+ Label {
144+ id: textTestColorGUPixelSize
145+ }
146 }

Subscribers

People subscribed via source and target branches