Details
Description
When testing tst_QQuick3DNode::testProperties on VxWorks 7 23.09 on the BD-SL-i.MX6 board (32bit arm), the test fails with the following error:
FAIL! : tst_QQuick3DNode::testProperties() Compared values are not the same
Actual (rot) : QQuaternion(scalar:0.473868, vector:(0.431712, -0.481702, 0.597526))
Expected (nodeItem.rotation()): QQuaternion(scalar:0.473868, vector:(0.431712, -0.481702, 0.597526))
Even though the numbers appear to be the same, after analyzing the state, it turned out that there has been a loss of precission.
The binary representations of the numbers differed:
rot:
x: 00111110110111010000100101010100
y: 10111110111101101010000110101011
z: 00111111000110001111011101110011
nodeItem.rotation:
x: 00111110110111010000100101010010
y: 10111110111101101010000110101001
z: 00111111000110001111011101110010
Since floating point numbers should almost never be compared using the operator==
the problem can be fixed by using qFuzzyCompare in the test.