Merge lp:~zeller-benjamin/ubuntu-ui-toolkit/mathutils_dont_warn into lp:ubuntu-ui-toolkit/staging

Proposed by Benjamin Zeller
Status: Merged
Approved by: Cris Dywan
Approved revision: 1734
Merged at revision: 1737
Proposed branch: lp:~zeller-benjamin/ubuntu-ui-toolkit/mathutils_dont_warn
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 78 lines (+0/-15)
2 files modified
src/Ubuntu/Components/plugin/ucmathutils.cpp (+0/-1)
tests/unit/tst_components/tst_math_utils.qml (+0/-14)
To merge this branch: bzr merge lp:~zeller-benjamin/ubuntu-ui-toolkit/mathutils_dont_warn
Reviewer Review Type Date Requested Status
Cris Dywan Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+279243@code.launchpad.net

Commit message

Fix Bug lp:1520557 "MathUtils.clamp, min value should not be bigger than the max value"

Description of the change

Fix Bug lp:1520557 "MathUtils.clamp, min value should not be bigger than the max value"

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Niiiiiice.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/Components/plugin/ucmathutils.cpp'
--- src/Ubuntu/Components/plugin/ucmathutils.cpp 2015-11-20 07:29:06 +0000
+++ src/Ubuntu/Components/plugin/ucmathutils.cpp 2015-12-02 11:43:04 +0000
@@ -40,7 +40,6 @@
40 return qBound(min, x, max);40 return qBound(min, x, max);
41 } else {41 } else {
42 // swap min/max if min > max42 // swap min/max if min > max
43 qWarning()<<"MathUtils.clamp, min value should not be bigger than the max value";
44 return qBound(max, x, min);43 return qBound(max, x, min);
45 }44 }
46}45}
4746
=== modified file 'tests/unit/tst_components/tst_math_utils.qml'
--- tests/unit/tst_components/tst_math_utils.qml 2015-11-20 07:38:55 +0000
+++ tests/unit/tst_components/tst_math_utils.qml 2015-12-02 11:43:04 +0000
@@ -89,8 +89,6 @@
89 var maxValue = 989 var maxValue = 9
90 var clampValue = -790 var clampValue = -7
9191
92 ignoreWarning("MathUtils.clamp, min value should not be bigger than the max value")
93
94 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)92 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)
95 compare(clamped, maxValue, "clamped value not within range")93 compare(clamped, maxValue, "clamped value not within range")
96 }94 }
@@ -100,8 +98,6 @@
100 var maxValue = 998 var maxValue = 9
101 var clampValue = 11199 var clampValue = 111
102100
103 ignoreWarning("MathUtils.clamp, min value should not be bigger than the max value")
104
105 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)101 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)
106 compare(clamped, minValue, "clamped value not within range")102 compare(clamped, minValue, "clamped value not within range")
107 }103 }
@@ -111,8 +107,6 @@
111 var maxValue = 9107 var maxValue = 9
112 var clampValue = 42108 var clampValue = 42
113109
114 ignoreWarning("MathUtils.clamp, min value should not be bigger than the max value")
115
116 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)110 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)
117 compare(clamped, clampValue, "clamped value changed even though it shouldn't have")111 compare(clamped, clampValue, "clamped value changed even though it shouldn't have")
118 }112 }
@@ -122,8 +116,6 @@
122 var maxValue = 9116 var maxValue = 9
123 var clampValue = 9117 var clampValue = 9
124118
125 ignoreWarning("MathUtils.clamp, min value should not be bigger than the max value")
126
127 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)119 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)
128 compare(clamped, clampValue, "clamped value changed even though it shouldn't have")120 compare(clamped, clampValue, "clamped value changed even though it shouldn't have")
129 }121 }
@@ -133,8 +125,6 @@
133 var maxValue = -42125 var maxValue = -42
134 var clampValue = -50126 var clampValue = -50
135127
136 ignoreWarning("MathUtils.clamp, min value should not be bigger than the max value")
137
138 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)128 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)
139 compare(clamped, maxValue, "clamped value not within range")129 compare(clamped, maxValue, "clamped value not within range")
140 }130 }
@@ -144,8 +134,6 @@
144 var maxValue = -42134 var maxValue = -42
145 var clampValue = 50135 var clampValue = 50
146136
147 ignoreWarning("MathUtils.clamp, min value should not be bigger than the max value")
148
149 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)137 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)
150 compare(clamped, minValue, "clamped value not within range")138 compare(clamped, minValue, "clamped value not within range")
151 }139 }
@@ -155,8 +143,6 @@
155 var maxValue = -42143 var maxValue = -42
156 var clampValue = 50144 var clampValue = 50
157145
158 ignoreWarning("MathUtils.clamp, min value should not be bigger than the max value")
159
160 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)146 var clamped = MathUtils.clamp(clampValue, minValue, maxValue)
161 compare(clamped, minValue, "clamped value not within range")147 compare(clamped, minValue, "clamped value not within range")
162 }148 }

Subscribers

People subscribed via source and target branches