summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/global/qglobal
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@nokia.com>2012-08-01 16:02:10 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-22 04:04:57 +0200
commit09dd19df5c4b708960e5aade568eb15d996ef200 (patch)
tree3a997704b1324dfb45f69d892128399affcac242 /tests/auto/corelib/global/qglobal
parent7f469ef4cc614925d7a4fdb3380ff5470e25b03b (diff)
Do not consider sign in qIsNull.
The current implementation of qIsNull only returns true if the value is positive zero. This behaviour is not useful for use cases like QPointF::isNull, where QPointF(-0, -0).isNull() will return false. There doesn't seem to be a reason why the function exhibits this behaviour (-0.0 is not accounted for in the unit tests), and for the case of QSizeF::scale it causes a bug: qIsNull is used to check for division by 0.0 before it proceeds, which fails in the case of -0.0. Task-number: QTBUG-7303 Change-Id: I767e5280bd26614e8e78ae62b274eb9bc4ade385 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'tests/auto/corelib/global/qglobal')
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index 529bafaa7a..e8dd433cdc 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -72,6 +72,12 @@ void tst_QGlobal::qIsNull()
QVERIFY(!::qIsNull(d));
QVERIFY(!::qIsNull(f));
+
+ d = -0.0;
+ f = -0.0f;
+
+ QVERIFY(::qIsNull(d));
+ QVERIFY(::qIsNull(f));
}
void tst_QGlobal::for_each()