diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-11-04 06:27:15 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-11-04 06:27:15 (GMT) |
commit | 867be3fd7a2017377e8ae5cc3ab789b3b01733bd (patch) | |
tree | 7e8ae170237570ea391807db70f2f3c76c612804 /tests | |
parent | 53e486c0e8d23d535711debdd3a71c8ef2211c58 (diff) | |
parent | ce14a4a0bc290018e597d0a4f8e9f279c63d4cc0 (diff) | |
download | Qt-867be3fd7a2017377e8ae5cc3ab789b3b01733bd.zip Qt-867be3fd7a2017377e8ae5cc3ab789b3b01733bd.tar.gz Qt-867be3fd7a2017377e8ae5cc3ab789b3b01733bd.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-graphics-team into 4.6
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp | 168 | ||||
-rw-r--r-- | tests/auto/qstatemachine/tst_qstatemachine.cpp | 94 | ||||
-rw-r--r-- | tests/auto/qvariant/tst_qvariant.cpp | 6 | ||||
-rw-r--r-- | tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp | 4 |
5 files changed, 87 insertions, 191 deletions
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index d8ab06e..9b15ab1 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -259,7 +259,7 @@ void tst_QGraphicsTransform::rotation3d() // Check that "rotation" produces the 4x4 form of the 3x3 matrix. // i.e. third row and column are 0 0 1 0. - t.setIdentity(); + t.setToIdentity(); rotation.applyTo(&t); QMatrix4x4 r(expected); if (sizeof(qreal) == sizeof(float) && angle == 268) { @@ -274,7 +274,7 @@ void tst_QGraphicsTransform::rotation3d() rotation.setAxis(QVector3D(0, 0, 0)); rotation.setOrigin(QVector3D(10, 10, 0)); - t.setIdentity(); + t.setToIdentity(); rotation.applyTo(&t); QVERIFY(t.isIdentity()); @@ -337,7 +337,7 @@ void tst_QGraphicsTransform::rotation3dArbitraryAxis() // Check that "rotation" produces the 4x4 form of the 3x3 matrix. // i.e. third row and column are 0 0 1 0. - t.setIdentity(); + t.setToIdentity(); rotation.applyTo(&t); QMatrix4x4 r(expected); QVERIFY(qFuzzyCompare(t, r)); diff --git a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp index ff5e00f..d6d217f2 100644 --- a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp +++ b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp @@ -151,14 +151,8 @@ private slots: void convertGeneric(); - void extractAxisRotation_data(); - void extractAxisRotation(); - - void extractTranslation_data(); - void extractTranslation(); - - void inferSpecialType_data(); - void inferSpecialType(); + void optimize_data(); + void optimize(); void columnsAndRows(); @@ -515,13 +509,13 @@ void tst_QMatrixNxN::create2x2() m5 = m3; QVERIFY(isSame(m5, uniqueValues2)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix2x2 m6(uniqueValues2); QVERIFY(isSame(m6, uniqueValues2)); qreal vals[4]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 4; ++index) QCOMPARE(vals[index], uniqueValues2[index]); } @@ -550,13 +544,13 @@ void tst_QMatrixNxN::create3x3() m5 = m3; QVERIFY(isSame(m5, uniqueValues3)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix3x3 m6(uniqueValues3); QVERIFY(isSame(m6, uniqueValues3)); qreal vals[9]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 9; ++index) QCOMPARE(vals[index], uniqueValues3[index]); } @@ -585,13 +579,13 @@ void tst_QMatrixNxN::create4x4() m5 = m3; QVERIFY(isSame(m5, uniqueValues4)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix4x4 m6(uniqueValues4); QVERIFY(isSame(m6, uniqueValues4)); qreal vals[16]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 16; ++index) QCOMPARE(vals[index], uniqueValues4[index]); @@ -627,13 +621,13 @@ void tst_QMatrixNxN::create4x3() m5 = m3; QVERIFY(isSame(m5, uniqueValues4x3)); - m5.setIdentity(); + m5.setToIdentity(); QVERIFY(isIdentity(m5)); QMatrix4x3 m6(uniqueValues4x3); QVERIFY(isSame(m6, uniqueValues4x3)); qreal vals[12]; - m6.toValueArray(vals); + m6.copyDataTo(vals); for (int index = 0; index < 12; ++index) QCOMPARE(vals[index], uniqueValues4x3[index]); } @@ -802,7 +796,7 @@ void tst_QMatrixNxN::transposed4x3() QMatrix4x3 m3(uniqueValues4x3); QMatrix3x4 m4 = m3.transposed(); qreal values[12]; - m4.toValueArray(values); + m4.copyDataTo(values); for (int index = 0; index < 12; ++index) QCOMPARE(values[index], transposedValues3x4[index]); } @@ -1296,7 +1290,7 @@ void tst_QMatrixNxN::multiply4x3() QGenericMatrix<3, 3, qreal> m4; m4 = m1 * m2; qreal values[9]; - m4.toValueArray(values); + m4.copyDataTo(values); for (int index = 0; index < 9; ++index) QCOMPARE(values[index], ((const qreal *)m3Values)[index]); } @@ -1898,7 +1892,7 @@ void tst_QMatrixNxN::inverted4x4() } // Test again, after inferring the special matrix type. - m1.inferSpecialType(); + m1.optimize(); m2 = m1.inverted(&inv); QVERIFY(isSame(m2, (const qreal *)m2Values)); QCOMPARE(inv, invertible); @@ -1913,12 +1907,12 @@ void tst_QMatrixNxN::orthonormalInverse4x4() m2.rotate(45.0, 1.0, 0.0, 0.0); m2.translate(10.0, 0.0, 0.0); - // Use inferSpecialType() to drop the internal flags that + // Use optimize() to drop the internal flags that // mark the matrix as orthonormal. This will force inverted() // to compute m3.inverted() the long way. We can then compare // the result to what the faster algorithm produces on m2. QMatrix4x4 m3 = m2; - m3.inferSpecialType(); + m3.optimize(); bool invertible; QVERIFY(qFuzzyCompare(m2.inverted(&invertible), m3.inverted())); QVERIFY(invertible); @@ -1926,7 +1920,7 @@ void tst_QMatrixNxN::orthonormalInverse4x4() QMatrix4x4 m4; m4.rotate(45.0, 0.0, 1.0, 0.0); QMatrix4x4 m5 = m4; - m5.inferSpecialType(); + m5.optimize(); QVERIFY(qFuzzyCompare(m4.inverted(), m5.inverted())); QMatrix4x4 m6; @@ -1934,7 +1928,7 @@ void tst_QMatrixNxN::orthonormalInverse4x4() m1.translate(-20.0, 20.0, 15.0); m1.rotate(25, 1.0, 0.0, 0.0); QMatrix4x4 m7 = m6; - m7.inferSpecialType(); + m7.optimize(); QVERIFY(qFuzzyCompare(m6.inverted(), m7.inverted())); } @@ -2081,7 +2075,7 @@ void tst_QMatrixNxN::scale4x4() m8.scale(x); QVERIFY(isSame(m8, (const qreal *)resultValues)); - m8.inferSpecialType(); + m8.optimize(); m8.scale(1.0f); QVERIFY(isSame(m8, (const qreal *)resultValues)); @@ -2412,7 +2406,7 @@ void tst_QMatrixNxN::rotate4x4() if (x != 0 || y != 0 || z != 0) { QQuaternion q = QQuaternion::fromAxisAndAngle(QVector3D(x, y, z), angle); - QVector3D vq = q.rotateVector(v1); + QVector3D vq = q.rotatedVector(v1); QVERIFY(fuzzyCompare(vq.x(), v1x)); QVERIFY(fuzzyCompare(vq.y(), v1y)); QVERIFY(fuzzyCompare(vq.z(), v1z)); @@ -2509,7 +2503,7 @@ void tst_QMatrixNxN::normalMatrix() // Perform the test again, after inferring special matrix types. // This tests the optimized paths in the normalMatrix() function. - m1.inferSpecialType(); + m1.optimize(); n1 = m1.normalMatrix(); if (invertible) @@ -2850,120 +2844,6 @@ void tst_QMatrixNxN::convertGeneric() QVERIFY(isSame(m11, conv4x4)); } -void tst_QMatrixNxN::extractAxisRotation_data() -{ - QTest::addColumn<float>("x"); - QTest::addColumn<float>("y"); - QTest::addColumn<float>("z"); - QTest::addColumn<float>("angle"); - - QTest::newRow("1, 0, 0, 0 deg") << 1.0f << 0.0f << 0.0f << 0.0f; - QTest::newRow("1, 0, 0, 90 deg") << 1.0f << 0.0f << 0.0f << 90.0f; - QTest::newRow("1, 0, 0, 270 deg") << 1.0f << 0.0f << 0.0f << 270.0f; - QTest::newRow("1, 0, 0, 45 deg") << 1.0f << 0.0f << 0.0f << 45.0f; - QTest::newRow("1, 0, 0, 120 deg") << 1.0f << 0.0f << 0.0f << 120.0f; - QTest::newRow("1, 0, 0, 300 deg") << 1.0f << 0.0f << 0.0f << 300.0f; - - QTest::newRow("0, 1, 0, 90 deg") << 0.0f << 1.0f << 0.0f << 90.0f; - QTest::newRow("0, 1, 0, 270 deg") << 0.0f << 1.0f << 0.0f << 270.0f; - QTest::newRow("0, 1, 0, 45 deg") << 0.0f << 1.0f << 0.0f << 45.0f; - QTest::newRow("0, 1, 0, 120 deg") << 0.0f << 1.0f << 0.0f << 120.0f; - QTest::newRow("0, 1, 0, 300 deg") << 0.0f << 1.0f << 0.0f << 300.0f; - - QTest::newRow("0, 0, 1, 90 deg") << 0.0f << 0.0f << 1.0f << 90.0f; - QTest::newRow("0, 0, 1, 270 deg") << 0.0f << 0.0f << 1.0f << 270.0f; - QTest::newRow("0, 0, 1, 45 deg") << 0.0f << 0.0f << 1.0f << 45.0f; - QTest::newRow("0, 0, 1, 120 deg") << 0.0f << 0.0f << 1.0f << 120.0f; - QTest::newRow("0, 0, 1, 300 deg") << 0.0f << 0.0f << 1.0f << 300.0f; - - QTest::newRow("1, 1, 1, 90 deg") << 1.0f << 1.0f << 1.0f << 90.0f; - QTest::newRow("1, 1, 1, 270 deg") << 1.0f << 1.0f << 1.0f << 270.0f; - QTest::newRow("1, 1, 1, 45 deg") << 1.0f << 1.0f << 1.0f << 45.0f; - QTest::newRow("1, 1, 1, 120 deg") << 1.0f << 1.0f << 1.0f << 120.0f; - QTest::newRow("1, 1, 1, 300 deg") << 1.0f << 1.0f << 1.0f << 300.0f; -} - -void tst_QMatrixNxN::extractAxisRotation() -{ - QFETCH(float, x); - QFETCH(float, y); - QFETCH(float, z); - QFETCH(float, angle); - - QMatrix4x4 m; - QVector3D origAxis(x, y, z); - - m.rotate(angle, x, y, z); - - origAxis.normalize(); - QVector3D extractedAxis; - qreal extractedAngle; - - m.extractAxisRotation(extractedAngle, extractedAxis); - - if (angle > 180) { - QVERIFY(fuzzyCompare(360.0f - angle, extractedAngle)); - QVERIFY(fuzzyCompare(extractedAxis, -origAxis)); - } else { - QVERIFY(fuzzyCompare(angle, extractedAngle)); - QVERIFY(fuzzyCompare(extractedAxis, origAxis)); - } -} - -void tst_QMatrixNxN::extractTranslation_data() -{ - QTest::addColumn<QMatrix4x4>("rotation"); - QTest::addColumn<float>("x"); - QTest::addColumn<float>("y"); - QTest::addColumn<float>("z"); - - static QMatrix4x4 m1; - - QTest::newRow("identity, 100, 50, 25") - << m1 << 100.0f << 50.0f << 250.0f; - - m1.rotate(45.0, 1.0, 0.0, 0.0); - QTest::newRow("rotX 45 + 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f; - - m1.setIdentity(); - m1.rotate(45.0, 0.0, 1.0, 0.0); - QTest::newRow("rotY 45 + 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f; - - m1.setIdentity(); - m1.rotate(75, 0.0, 0.0, 1.0); - m1.rotate(25, 1.0, 0.0, 0.0); - m1.rotate(45, 0.0, 1.0, 0.0); - QTest::newRow("rotZ 75, rotX 25, rotY 45, 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f; -} - -void tst_QMatrixNxN::extractTranslation() -{ - QFETCH(QMatrix4x4, rotation); - QFETCH(float, x); - QFETCH(float, y); - QFETCH(float, z); - - rotation.translate(x, y, z); - - QVector3D vec = rotation.extractTranslation(); - - QVERIFY(fuzzyCompare(vec.x(), x)); - QVERIFY(fuzzyCompare(vec.y(), y)); - QVERIFY(fuzzyCompare(vec.z(), z)); - - QMatrix4x4 lookAt; - QVector3D eye(1.5f, -2.5f, 2.5f); - lookAt.lookAt(eye, - QVector3D(10.0f, 10.0f, 10.0f), - QVector3D(0.0f, 1.0f, 0.0f)); - - QVector3D extEye = lookAt.extractTranslation(); - - QVERIFY(fuzzyCompare(eye.x(), -extEye.x())); - QVERIFY(fuzzyCompare(eye.y(), -extEye.y())); - QVERIFY(fuzzyCompare(eye.z(), -extEye.z())); -} - // Copy of "flagBits" in qmatrix4x4.h. enum { Identity = 0x0001, // Identity matrix @@ -2981,7 +2861,7 @@ struct Matrix4x4 }; // Test the inferring of special matrix types. -void tst_QMatrixNxN::inferSpecialType_data() +void tst_QMatrixNxN::optimize_data() { QTest::addColumn<void *>("mValues"); QTest::addColumn<int>("flagBits"); @@ -3029,13 +2909,13 @@ void tst_QMatrixNxN::inferSpecialType_data() QTest::newRow("below") << (void *)belowValues << (int)General; } -void tst_QMatrixNxN::inferSpecialType() +void tst_QMatrixNxN::optimize() { QFETCH(void *, mValues); QFETCH(int, flagBits); QMatrix4x4 m((const qreal *)mValues); - m.inferSpecialType(); + m.optimize(); QCOMPARE(reinterpret_cast<Matrix4x4 *>(&m)->flagBits, flagBits); } @@ -3362,7 +3242,7 @@ void tst_QMatrixNxN::mapVector() QFETCH(void *, mValues); QMatrix4x4 m1((const qreal *)mValues); - m1.inferSpecialType(); + m1.optimize(); QVector3D v(3.5f, -1.0f, 2.5f); diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp index 975b301..9a2b2ed 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp @@ -162,7 +162,7 @@ private slots: void defaultGlobalRestorePolicy(); void globalRestorePolicySetToRestore(); - void globalRestorePolicySetToDoNotRestore(); + void globalRestorePolicySetToDontRestore(); void noInitialStateForInitialState(); @@ -184,7 +184,7 @@ private slots: void twoAnimatedTransitions(); void playAnimationTwice(); void nestedTargetStateForAnimation(); - void polishedSignalTransitionsReuseAnimationGroup(); + void propertiesAssignedSignalTransitionsReuseAnimationGroup(); void animatedGlobalRestoreProperty(); void specificTargetValueOfAnimation(); @@ -286,8 +286,8 @@ void tst_QStateMachine::transitionToRootState() machine.addState(initialState); machine.setInitialState(initialState); - QAbstractTransition *trans = initialState->addTransition(new EventTransition(QEvent::User, &machine)); - QVERIFY(trans != 0); + QAbstractTransition *trans = new EventTransition(QEvent::User, &machine); + initialState->addTransition(trans); QCOMPARE(trans->sourceState(), initialState); QCOMPARE(trans->targetState(), static_cast<QAbstractState *>(&machine)); @@ -310,7 +310,7 @@ void tst_QStateMachine::transitionFromRootState() QState *root = &machine; QState *s1 = new QState(root); EventTransition *trans = new EventTransition(QEvent::User, s1); - QCOMPARE(root->addTransition(trans), static_cast<QAbstractTransition *>(trans)); + root->addTransition(trans); QCOMPARE(trans->sourceState(), root); QCOMPARE(trans->targetState(), static_cast<QAbstractState *>(s1)); } @@ -984,7 +984,7 @@ void tst_QStateMachine::customErrorStateNotInGraph() void tst_QStateMachine::restoreProperties() { QStateMachine machine; - QCOMPARE(machine.globalRestorePolicy(), QStateMachine::DoNotRestoreProperties); + QCOMPARE(machine.globalRestorePolicy(), QStateMachine::DontRestoreProperties); machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties); QObject *object = new QObject(&machine); @@ -1155,7 +1155,7 @@ void tst_QStateMachine::stateEntryAndExit() QCOMPARE(t->targetState(), (QAbstractState*)s2); QCOMPARE(t->targetStates().size(), 1); QCOMPARE(t->targetStates().at(0), (QAbstractState*)s2); - QCOMPARE(s1->addTransition(t), (QAbstractTransition*)t); + s1->addTransition(t); QCOMPARE(t->sourceState(), (QState*)s1); QCOMPARE(t->machine(), &machine); @@ -1173,7 +1173,7 @@ void tst_QStateMachine::stateEntryAndExit() s2->removeTransition(trans); QCOMPARE(trans->sourceState(), (QState*)0); QCOMPARE(trans->targetState(), (QAbstractState*)s3); - QCOMPARE(s2->addTransition(trans), trans); + s2->addTransition(trans); QCOMPARE(trans->sourceState(), (QState*)s2); } @@ -1319,9 +1319,9 @@ void tst_QStateMachine::assignProperty() QCOMPARE(s1->objectName(), QString::fromLatin1("foo")); { - QSignalSpy polishedSpy(s1, SIGNAL(polished())); + QSignalSpy propertiesAssignedSpy(s1, SIGNAL(propertiesAssigned())); machine.start(); - QTRY_COMPARE(polishedSpy.count(), 1); + QTRY_COMPARE(propertiesAssignedSpy.count(), 1); } // nested states @@ -1340,11 +1340,11 @@ void tst_QStateMachine::assignPropertyWithAnimation() // Single animation { QStateMachine machine; - QVERIFY(machine.animationsEnabled()); - machine.setAnimationsEnabled(false); - QVERIFY(!machine.animationsEnabled()); - machine.setAnimationsEnabled(true); - QVERIFY(machine.animationsEnabled()); + QVERIFY(machine.isAnimated()); + machine.setAnimated(false); + QVERIFY(!machine.isAnimated()); + machine.setAnimated(true); + QVERIFY(machine.isAnimated()); QObject obj; obj.setProperty("foo", 321); obj.setProperty("bar", 654); @@ -1371,7 +1371,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() QCOMPARE(trans->animations().size(), 1); QCOMPARE(trans->animations().at(0), (QAbstractAnimation*)&anim); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1399,7 +1399,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() anim2.setDuration(150); trans->addAnimation(&anim2); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1427,7 +1427,7 @@ void tst_QStateMachine::assignPropertyWithAnimation() group.addAnimation(new QPropertyAnimation(&obj, "bar")); trans->addAnimation(&group); QFinalState *s3 = new QFinalState(&machine); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1473,10 +1473,10 @@ void tst_QStateMachine::assignPropertyWithAnimation() anim2.setDuration(250); trans->addAnimation(&anim2); - s21->addTransition(s21, SIGNAL(polished()), s22); + s21->addTransition(s21, SIGNAL(propertiesAssigned()), s22); QFinalState *s3 = new QFinalState(&machine); - s22->addTransition(s2, SIGNAL(polished()), s3); + s22->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -1513,13 +1513,13 @@ void tst_QStateMachine::assignPropertyWithAnimation() machine.setInitialState(group); machine.start(); QTRY_COMPARE(machine.configuration().contains(s1), true); - QSignalSpy polishedSpy(s2, SIGNAL(polished())); + QSignalSpy propertiesAssignedSpy(s2, SIGNAL(propertiesAssigned())); emitter.emitSignalWithNoArg(); QTRY_COMPARE(machine.configuration().contains(s2), true); - QVERIFY(polishedSpy.isEmpty()); + QVERIFY(propertiesAssignedSpy.isEmpty()); emitter.emitSignalWithNoArg(); // will cause animations from s1-->s2 to abort QTRY_COMPARE(machine.configuration().contains(s3), true); - QVERIFY(polishedSpy.isEmpty()); + QVERIFY(propertiesAssignedSpy.isEmpty()); QCOMPARE(obj.property("foo").toInt(), 911); QCOMPARE(obj.property("bar").toInt(), 789); } @@ -2736,10 +2736,10 @@ void tst_QStateMachine::restorePolicyNotInherited() }*/ -void tst_QStateMachine::globalRestorePolicySetToDoNotRestore() +void tst_QStateMachine::globalRestorePolicySetToDontRestore() { QStateMachine machine; - machine.setGlobalRestorePolicy(QStateMachine::DoNotRestoreProperties); + machine.setGlobalRestorePolicy(QStateMachine::DontRestoreProperties); QObject *propertyHolder = new QObject(&machine); propertyHolder->setProperty("a", 1); @@ -3089,7 +3089,7 @@ void tst_QStateMachine::twoAnimations() QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - s2->addTransition(s2, SIGNAL(polished()), s3); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3); machine.setInitialState(s1); machine.start(); @@ -3117,7 +3117,9 @@ void tst_QStateMachine::twoAnimatedTransitions() QState *s2 = new QState(&machine); s2->assignProperty(object, "foo", 5.0); QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(fooAnimation); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3126,7 +3128,9 @@ void tst_QStateMachine::twoAnimatedTransitions() QState *s4 = new QState(&machine); s4->assignProperty(object, "foo", 2.0); QPropertyAnimation *fooAnimation2 = new QPropertyAnimation(object, "foo", s4); - s3->addTransition(new EventTransition(QEvent::User, s4))->addAnimation(fooAnimation2); + trans = new EventTransition(QEvent::User, s4); + s3->addTransition(trans); + trans->addAnimation(fooAnimation2); QState *s5 = new QState(&machine); QObject::connect(s5, SIGNAL(entered()), QApplication::instance(), SLOT(quit())); @@ -3161,7 +3165,9 @@ void tst_QStateMachine::playAnimationTwice() QState *s2 = new QState(&machine); s2->assignProperty(object, "foo", 5.0); QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(fooAnimation); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3169,7 +3175,9 @@ void tst_QStateMachine::playAnimationTwice() QState *s4 = new QState(&machine); s4->assignProperty(object, "foo", 2.0); - s3->addTransition(new EventTransition(QEvent::User, s4))->addAnimation(fooAnimation); + trans = new EventTransition(QEvent::User, s4); + s3->addTransition(trans); + trans->addAnimation(fooAnimation); QState *s5 = new QState(&machine); QObject::connect(s5, SIGNAL(entered()), QApplication::instance(), SLOT(quit())); @@ -3213,14 +3221,16 @@ void tst_QStateMachine::nestedTargetStateForAnimation() QState *s2Child2 = new QState(s2); s2Child2->assignProperty(object, "bar", 11.0); - QAbstractTransition *at = s2Child->addTransition(new EventTransition(QEvent::User, s2Child2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2Child2); + s2Child->addTransition(at); QPropertyAnimation *animation = new QPropertyAnimation(object, "bar", s2); animation->setDuration(2000); connect(animation, SIGNAL(finished()), &counter, SLOT(slot())); at->addAnimation(animation); - at = s1->addTransition(new EventTransition(QEvent::User, s2)); + at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); animation = new QPropertyAnimation(object, "foo", s2); connect(animation, SIGNAL(finished()), &counter, SLOT(slot())); @@ -3231,7 +3241,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation() at->addAnimation(animation); QState *s3 = new QState(&machine); - s2->addTransition(s2Child, SIGNAL(polished()), s3); + s2->addTransition(s2Child, SIGNAL(propertiesAssigned()), s3); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3248,7 +3258,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation() QCOMPARE(counter.counter, 2); } -void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup() +void tst_QStateMachine::propertiesAssignedSignalTransitionsReuseAnimationGroup() { QStateMachine machine; QObject *object = new QObject(&machine); @@ -3265,9 +3275,9 @@ void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup() QParallelAnimationGroup animationGroup; animationGroup.addAnimation(new QPropertyAnimation(object, "foo")); QSignalSpy animationFinishedSpy(&animationGroup, SIGNAL(finished())); - s1->addTransition(s1, SIGNAL(polished()), s2)->addAnimation(&animationGroup); - s2->addTransition(s2, SIGNAL(polished()), s3)->addAnimation(&animationGroup); - s3->addTransition(s3, SIGNAL(polished()), s4); + s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2)->addAnimation(&animationGroup); + s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3)->addAnimation(&animationGroup); + s3->addTransition(s3, SIGNAL(propertiesAssigned()), s4); machine.setInitialState(s1); QSignalSpy machineFinishedSpy(&machine, SIGNAL(finished())); @@ -3299,7 +3309,8 @@ void tst_QStateMachine::animatedGlobalRestoreProperty() QState *s4 = new QState(&machine); QObject::connect(s4, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", s2); connect(pa, SIGNAL(finished()), &counter, SLOT(slot())); at->addAnimation(pa); @@ -3341,7 +3352,9 @@ void tst_QStateMachine::specificTargetValueOfAnimation() QPropertyAnimation *anim = new QPropertyAnimation(object, "foo"); anim->setEndValue(10.0); - s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(anim); + EventTransition *trans = new EventTransition(QEvent::User, s2); + s1->addTransition(trans); + trans->addAnimation(anim); QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); @@ -3495,7 +3508,8 @@ void tst_QStateMachine::overrideDefaultAnimationWithSpecific() QState *s3 = new QState(&machine); QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2)); + QAbstractTransition *at = new EventTransition(QEvent::User, s2); + s1->addTransition(at); QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo"); connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index e2a606f..3d68a73 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -1432,8 +1432,10 @@ void tst_QVariant::matrix4x4() QVariant variant; QMatrix4x4 matrix = qVariantValue<QMatrix4x4>(variant); QVERIFY(matrix.isIdentity()); - qVariantSetValue(variant, QMatrix4x4().scale(2.0)); - QCOMPARE(QMatrix4x4().scale(2.0), qVariantValue<QMatrix4x4>(variant)); + QMatrix4x4 m; + m.scale(2.0f); + qVariantSetValue(variant, m); + QCOMPARE(m, qVariantValue<QMatrix4x4>(variant)); void *mmatrix = QMetaType::construct(QVariant::Matrix4x4, 0); QVERIFY(mmatrix); diff --git a/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp b/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp index 71f45ff..f80b579 100644 --- a/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp +++ b/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp @@ -220,7 +220,7 @@ void tst_QMatrix4x4::mapVector3D() QVector3D v(10.5f, -2.0f, 3.0f); QVector3D result; - m1.inferSpecialType(); + m1.optimize(); QBENCHMARK { result = m1 * v; @@ -244,7 +244,7 @@ void tst_QMatrix4x4::mapVector2D() QPointF v(10.5f, -2.0f); QPointF result; - m1.inferSpecialType(); + m1.optimize(); QBENCHMARK { result = m1 * v; |