summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2009-08-13 17:00:32 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-08-13 17:00:32 (GMT)
commitbd714736bdc43175e202bc3809e6f7a614736f87 (patch)
treed2b19f5b0e32a5a878f4b44f881477e0cb2b0cb4 /tests
parent2a5f0086fd45c92fe8fffc35db7a360c3e51778e (diff)
parent98fb13e3ef2627664642c21f34d11c10537379f7 (diff)
downloadQt-bd714736bdc43175e202bc3809e6f7a614736f87.zip
Qt-bd714736bdc43175e202bc3809e6f7a614736f87.tar.gz
Qt-bd714736bdc43175e202bc3809e6f7a614736f87.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro1
-rw-r--r--tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp236
-rw-r--r--tests/auto/qdockwidget/tst_qdockwidget.cpp2
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp42
-rw-r--r--tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro16
-rw-r--r--tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp2
-rw-r--r--tests/auto/qhelpenginecore/tst_qhelpenginecore.pro17
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp42
-rw-r--r--tests/auto/qtextcodec/test/test.pro17
-rw-r--r--tests/auto/qtouchevent/tst_qtouchevent.cpp508
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp4
-rw-r--r--tests/auto/uiloader/baseline/css_borderradius_allwidgets.ui458
-rw-r--r--tests/benchmarks/qscriptengine/qscriptengine.pro7
-rw-r--r--tests/benchmarks/qscriptengine/tst_qscriptengine.cpp229
-rw-r--r--tests/benchmarks/qscriptvalue/qscriptvalue.pro7
-rw-r--r--tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp193
16 files changed, 1537 insertions, 244 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index d7f27bd..dd188cd 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -444,6 +444,7 @@ SUBDIRS += checkxmlfiles \
xmlpatternsdiagnosticsts.depends = xmlpatternsxqts
xmlpatternsview.depends = xmlpatternsxqts
xmlpatternsxslts.depends = xmlpatternsxqts
+xmlpatternsschemats.depends = xmlpatternsxqts
}
unix:!embedded:contains(QT_CONFIG, dbus):SUBDIRS += \
diff --git a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
index 5e20d06..5541162 100644
--- a/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
+++ b/tests/auto/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
@@ -43,12 +43,12 @@
#include <QtCore/qmath.h>
#include "math3dincludes.h"
-class tst_QMatrix : public QObject
+class tst_QMatrixNxN : public QObject
{
Q_OBJECT
public:
- tst_QMatrix() {}
- ~tst_QMatrix() {}
+ tst_QMatrixNxN() {}
+ ~tst_QMatrixNxN() {}
private slots:
void create2x2();
@@ -298,25 +298,25 @@ static qreal const transposedValues3x4[12] =
// Set a matrix to a specified array of values, which are assumed
// to be in row-major order. This sets the values using floating-point.
-void tst_QMatrix::setMatrix(QMatrix2x2& m, const qreal *values)
+void tst_QMatrixNxN::setMatrix(QMatrix2x2& m, const qreal *values)
{
for (int row = 0; row < 2; ++row)
for (int col = 0; col < 2; ++col)
m(row, col) = values[row * 2 + col];
}
-void tst_QMatrix::setMatrix(QMatrix3x3& m, const qreal *values)
+void tst_QMatrixNxN::setMatrix(QMatrix3x3& m, const qreal *values)
{
for (int row = 0; row < 3; ++row)
for (int col = 0; col < 3; ++col)
m(row, col) = values[row * 3 + col];
}
-void tst_QMatrix::setMatrix(QMatrix4x4& m, const qreal *values)
+void tst_QMatrixNxN::setMatrix(QMatrix4x4& m, const qreal *values)
{
for (int row = 0; row < 4; ++row)
for (int col = 0; col < 4; ++col)
m(row, col) = values[row * 4 + col];
}
-void tst_QMatrix::setMatrix(QMatrix4x3& m, const qreal *values)
+void tst_QMatrixNxN::setMatrix(QMatrix4x3& m, const qreal *values)
{
for (int row = 0; row < 3; ++row)
for (int col = 0; col < 4; ++col)
@@ -326,7 +326,7 @@ void tst_QMatrix::setMatrix(QMatrix4x3& m, const qreal *values)
// Set a matrix to a specified array of values, which are assumed
// to be in row-major order. This sets the values directly into
// the internal data() array.
-void tst_QMatrix::setMatrixDirect(QMatrix2x2& m, const qreal *values)
+void tst_QMatrixNxN::setMatrixDirect(QMatrix2x2& m, const qreal *values)
{
float *data = m.data();
for (int row = 0; row < 2; ++row) {
@@ -335,7 +335,7 @@ void tst_QMatrix::setMatrixDirect(QMatrix2x2& m, const qreal *values)
}
}
}
-void tst_QMatrix::setMatrixDirect(QMatrix3x3& m, const qreal *values)
+void tst_QMatrixNxN::setMatrixDirect(QMatrix3x3& m, const qreal *values)
{
float *data = m.data();
for (int row = 0; row < 3; ++row) {
@@ -344,7 +344,7 @@ void tst_QMatrix::setMatrixDirect(QMatrix3x3& m, const qreal *values)
}
}
}
-void tst_QMatrix::setMatrixDirect(QMatrix4x4& m, const qreal *values)
+void tst_QMatrixNxN::setMatrixDirect(QMatrix4x4& m, const qreal *values)
{
float *data = m.data();
for (int row = 0; row < 4; ++row) {
@@ -353,7 +353,7 @@ void tst_QMatrix::setMatrixDirect(QMatrix4x4& m, const qreal *values)
}
}
}
-void tst_QMatrix::setMatrixDirect(QMatrix4x3& m, const qreal *values)
+void tst_QMatrixNxN::setMatrixDirect(QMatrix4x3& m, const qreal *values)
{
float *data = m.data();
for (int row = 0; row < 3; ++row) {
@@ -398,7 +398,7 @@ static bool matrixFuzzyCompare(const QMatrix4x4 &m1, const QMatrix4x4 &m2)
// Determine if a matrix is the same as a specified array of values.
// The values are assumed to be specified in row-major order.
-bool tst_QMatrix::isSame(const QMatrix2x2& m, const qreal *values)
+bool tst_QMatrixNxN::isSame(const QMatrix2x2& m, const qreal *values)
{
const float *mv = m.constData();
for (int row = 0; row < 2; ++row) {
@@ -419,7 +419,7 @@ bool tst_QMatrix::isSame(const QMatrix2x2& m, const qreal *values)
}
return true;
}
-bool tst_QMatrix::isSame(const QMatrix3x3& m, const qreal *values)
+bool tst_QMatrixNxN::isSame(const QMatrix3x3& m, const qreal *values)
{
const float *mv = m.constData();
for (int row = 0; row < 3; ++row) {
@@ -440,7 +440,7 @@ bool tst_QMatrix::isSame(const QMatrix3x3& m, const qreal *values)
}
return true;
}
-bool tst_QMatrix::isSame(const QMatrix4x4& m, const qreal *values)
+bool tst_QMatrixNxN::isSame(const QMatrix4x4& m, const qreal *values)
{
const float *mv = m.constData();
for (int row = 0; row < 4; ++row) {
@@ -461,7 +461,7 @@ bool tst_QMatrix::isSame(const QMatrix4x4& m, const qreal *values)
}
return true;
}
-bool tst_QMatrix::isSame(const QMatrix4x3& m, const qreal *values)
+bool tst_QMatrixNxN::isSame(const QMatrix4x3& m, const qreal *values)
{
const float *mv = m.constData();
for (int row = 0; row < 3; ++row) {
@@ -484,26 +484,26 @@ bool tst_QMatrix::isSame(const QMatrix4x3& m, const qreal *values)
}
// Determine if a matrix is the identity.
-bool tst_QMatrix::isIdentity(const QMatrix2x2& m)
+bool tst_QMatrixNxN::isIdentity(const QMatrix2x2& m)
{
return isSame(m, identityValues2);
}
-bool tst_QMatrix::isIdentity(const QMatrix3x3& m)
+bool tst_QMatrixNxN::isIdentity(const QMatrix3x3& m)
{
return isSame(m, identityValues3);
}
-bool tst_QMatrix::isIdentity(const QMatrix4x4& m)
+bool tst_QMatrixNxN::isIdentity(const QMatrix4x4& m)
{
return isSame(m, identityValues4);
}
-bool tst_QMatrix::isIdentity(const QMatrix4x3& m)
+bool tst_QMatrixNxN::isIdentity(const QMatrix4x3& m)
{
return isSame(m, identityValues4x3);
}
// Test the creation of QMatrix2x2 objects in various ways:
// construct, copy, and modify.
-void tst_QMatrix::create2x2()
+void tst_QMatrixNxN::create2x2()
{
QMatrix2x2 m1;
QVERIFY(isIdentity(m1));
@@ -538,7 +538,7 @@ void tst_QMatrix::create2x2()
// Test the creation of QMatrix3x3 objects in various ways:
// construct, copy, and modify.
-void tst_QMatrix::create3x3()
+void tst_QMatrixNxN::create3x3()
{
QMatrix3x3 m1;
QVERIFY(isIdentity(m1));
@@ -573,7 +573,7 @@ void tst_QMatrix::create3x3()
// Test the creation of QMatrix4x4 objects in various ways:
// construct, copy, and modify.
-void tst_QMatrix::create4x4()
+void tst_QMatrixNxN::create4x4()
{
QMatrix4x4 m1;
QVERIFY(isIdentity(m1));
@@ -615,7 +615,7 @@ void tst_QMatrix::create4x4()
// Test the creation of QMatrix4x3 objects in various ways:
// construct, copy, and modify.
-void tst_QMatrix::create4x3()
+void tst_QMatrixNxN::create4x3()
{
QMatrix4x3 m1;
QVERIFY(isIdentity(m1));
@@ -649,7 +649,7 @@ void tst_QMatrix::create4x3()
}
// Test isIdentity() for 2x2 matrices.
-void tst_QMatrix::isIdentity2x2()
+void tst_QMatrixNxN::isIdentity2x2()
{
for (int i = 0; i < 2 * 2; ++i) {
QMatrix2x2 m;
@@ -660,7 +660,7 @@ void tst_QMatrix::isIdentity2x2()
}
// Test isIdentity() for 3x3 matrices.
-void tst_QMatrix::isIdentity3x3()
+void tst_QMatrixNxN::isIdentity3x3()
{
for (int i = 0; i < 3 * 3; ++i) {
QMatrix3x3 m;
@@ -671,7 +671,7 @@ void tst_QMatrix::isIdentity3x3()
}
// Test isIdentity() for 4x4 matrices.
-void tst_QMatrix::isIdentity4x4()
+void tst_QMatrixNxN::isIdentity4x4()
{
for (int i = 0; i < 4 * 4; ++i) {
QMatrix4x4 m;
@@ -687,7 +687,7 @@ void tst_QMatrix::isIdentity4x4()
}
// Test isIdentity() for 4x3 matrices.
-void tst_QMatrix::isIdentity4x3()
+void tst_QMatrixNxN::isIdentity4x3()
{
for (int i = 0; i < 4 * 3; ++i) {
QMatrix4x3 m;
@@ -698,7 +698,7 @@ void tst_QMatrix::isIdentity4x3()
}
// Test 2x2 matrix comparisons.
-void tst_QMatrix::compare2x2()
+void tst_QMatrixNxN::compare2x2()
{
QMatrix2x2 m1(uniqueValues2);
QMatrix2x2 m2(uniqueValues2);
@@ -711,7 +711,7 @@ void tst_QMatrix::compare2x2()
}
// Test 3x3 matrix comparisons.
-void tst_QMatrix::compare3x3()
+void tst_QMatrixNxN::compare3x3()
{
QMatrix3x3 m1(uniqueValues3);
QMatrix3x3 m2(uniqueValues3);
@@ -724,7 +724,7 @@ void tst_QMatrix::compare3x3()
}
// Test 4x4 matrix comparisons.
-void tst_QMatrix::compare4x4()
+void tst_QMatrixNxN::compare4x4()
{
QMatrix4x4 m1(uniqueValues4);
QMatrix4x4 m2(uniqueValues4);
@@ -737,7 +737,7 @@ void tst_QMatrix::compare4x4()
}
// Test 4x3 matrix comparisons.
-void tst_QMatrix::compare4x3()
+void tst_QMatrixNxN::compare4x3()
{
QMatrix4x3 m1(uniqueValues4x3);
QMatrix4x3 m2(uniqueValues4x3);
@@ -750,7 +750,7 @@ void tst_QMatrix::compare4x3()
}
// Test matrix 2x2 transpose operations.
-void tst_QMatrix::transposed2x2()
+void tst_QMatrixNxN::transposed2x2()
{
// Transposing the identity should result in the identity.
QMatrix2x2 m1;
@@ -769,7 +769,7 @@ void tst_QMatrix::transposed2x2()
}
// Test matrix 3x3 transpose operations.
-void tst_QMatrix::transposed3x3()
+void tst_QMatrixNxN::transposed3x3()
{
// Transposing the identity should result in the identity.
QMatrix3x3 m1;
@@ -788,7 +788,7 @@ void tst_QMatrix::transposed3x3()
}
// Test matrix 4x4 transpose operations.
-void tst_QMatrix::transposed4x4()
+void tst_QMatrixNxN::transposed4x4()
{
// Transposing the identity should result in the identity.
QMatrix4x4 m1;
@@ -807,7 +807,7 @@ void tst_QMatrix::transposed4x4()
}
// Test matrix 4x3 transpose operations.
-void tst_QMatrix::transposed4x3()
+void tst_QMatrixNxN::transposed4x3()
{
QMatrix4x3 m3(uniqueValues4x3);
QMatrix3x4 m4 = m3.transposed();
@@ -818,7 +818,7 @@ void tst_QMatrix::transposed4x3()
}
// Test matrix addition for 2x2 matrices.
-void tst_QMatrix::add2x2_data()
+void tst_QMatrixNxN::add2x2_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<void *>("m2Values");
@@ -839,7 +839,7 @@ void tst_QMatrix::add2x2_data()
QTest::newRow("unique")
<< (void *)uniqueValues2 << (void *)transposedValues2 << (void *)sumValues;
}
-void tst_QMatrix::add2x2()
+void tst_QMatrixNxN::add2x2()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -858,7 +858,7 @@ void tst_QMatrix::add2x2()
}
// Test matrix addition for 3x3 matrices.
-void tst_QMatrix::add3x3_data()
+void tst_QMatrixNxN::add3x3_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<void *>("m2Values");
@@ -880,7 +880,7 @@ void tst_QMatrix::add3x3_data()
QTest::newRow("unique")
<< (void *)uniqueValues3 << (void *)transposedValues3 << (void *)sumValues;
}
-void tst_QMatrix::add3x3()
+void tst_QMatrixNxN::add3x3()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -899,7 +899,7 @@ void tst_QMatrix::add3x3()
}
// Test matrix addition for 4x4 matrices.
-void tst_QMatrix::add4x4_data()
+void tst_QMatrixNxN::add4x4_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<void *>("m2Values");
@@ -922,7 +922,7 @@ void tst_QMatrix::add4x4_data()
QTest::newRow("unique")
<< (void *)uniqueValues4 << (void *)transposedValues4 << (void *)sumValues;
}
-void tst_QMatrix::add4x4()
+void tst_QMatrixNxN::add4x4()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -941,7 +941,7 @@ void tst_QMatrix::add4x4()
}
// Test matrix addition for 4x3 matrices.
-void tst_QMatrix::add4x3_data()
+void tst_QMatrixNxN::add4x3_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<void *>("m2Values");
@@ -963,7 +963,7 @@ void tst_QMatrix::add4x3_data()
QTest::newRow("unique")
<< (void *)uniqueValues4x3 << (void *)transposedValues3x4 << (void *)sumValues;
}
-void tst_QMatrix::add4x3()
+void tst_QMatrixNxN::add4x3()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -982,12 +982,12 @@ void tst_QMatrix::add4x3()
}
// Test matrix subtraction for 2x2 matrices.
-void tst_QMatrix::subtract2x2_data()
+void tst_QMatrixNxN::subtract2x2_data()
{
// Use the same test cases as the add test.
add2x2_data();
}
-void tst_QMatrix::subtract2x2()
+void tst_QMatrixNxN::subtract2x2()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -1015,12 +1015,12 @@ void tst_QMatrix::subtract2x2()
}
// Test matrix subtraction for 3x3 matrices.
-void tst_QMatrix::subtract3x3_data()
+void tst_QMatrixNxN::subtract3x3_data()
{
// Use the same test cases as the add test.
add3x3_data();
}
-void tst_QMatrix::subtract3x3()
+void tst_QMatrixNxN::subtract3x3()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -1048,12 +1048,12 @@ void tst_QMatrix::subtract3x3()
}
// Test matrix subtraction for 4x4 matrices.
-void tst_QMatrix::subtract4x4_data()
+void tst_QMatrixNxN::subtract4x4_data()
{
// Use the same test cases as the add test.
add4x4_data();
}
-void tst_QMatrix::subtract4x4()
+void tst_QMatrixNxN::subtract4x4()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -1081,12 +1081,12 @@ void tst_QMatrix::subtract4x4()
}
// Test matrix subtraction for 4x3 matrices.
-void tst_QMatrix::subtract4x3_data()
+void tst_QMatrixNxN::subtract4x3_data()
{
// Use the same test cases as the add test.
add4x3_data();
}
-void tst_QMatrix::subtract4x3()
+void tst_QMatrixNxN::subtract4x3()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -1114,7 +1114,7 @@ void tst_QMatrix::subtract4x3()
}
// Test matrix multiplication for 2x2 matrices.
-void tst_QMatrix::multiply2x2_data()
+void tst_QMatrixNxN::multiply2x2_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<void *>("m2Values");
@@ -1148,7 +1148,7 @@ void tst_QMatrix::multiply2x2_data()
QTest::newRow("unique/transposed")
<< (void *)uniqueValues2 << (void *)transposedValues2 << (void *)uniqueResult;
}
-void tst_QMatrix::multiply2x2()
+void tst_QMatrixNxN::multiply2x2()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -1163,7 +1163,7 @@ void tst_QMatrix::multiply2x2()
}
// Test matrix multiplication for 3x3 matrices.
-void tst_QMatrix::multiply3x3_data()
+void tst_QMatrixNxN::multiply3x3_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<void *>("m2Values");
@@ -1197,7 +1197,7 @@ void tst_QMatrix::multiply3x3_data()
QTest::newRow("unique/transposed")
<< (void *)uniqueValues3 << (void *)transposedValues3 << (void *)uniqueResult;
}
-void tst_QMatrix::multiply3x3()
+void tst_QMatrixNxN::multiply3x3()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -1212,7 +1212,7 @@ void tst_QMatrix::multiply3x3()
}
// Test matrix multiplication for 4x4 matrices.
-void tst_QMatrix::multiply4x4_data()
+void tst_QMatrixNxN::multiply4x4_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<void *>("m2Values");
@@ -1246,7 +1246,7 @@ void tst_QMatrix::multiply4x4_data()
QTest::newRow("unique/transposed")
<< (void *)uniqueValues4 << (void *)transposedValues4 << (void *)uniqueResult;
}
-void tst_QMatrix::multiply4x4()
+void tst_QMatrixNxN::multiply4x4()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -1266,7 +1266,7 @@ void tst_QMatrix::multiply4x4()
}
// Test matrix multiplication for 4x3 matrices.
-void tst_QMatrix::multiply4x3_data()
+void tst_QMatrixNxN::multiply4x3_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<void *>("m2Values");
@@ -1294,7 +1294,7 @@ void tst_QMatrix::multiply4x3_data()
QTest::newRow("unique/transposed")
<< (void *)uniqueValues4x3 << (void *)transposedValues3x4 << (void *)uniqueResult;
}
-void tst_QMatrix::multiply4x3()
+void tst_QMatrixNxN::multiply4x3()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -1312,7 +1312,7 @@ void tst_QMatrix::multiply4x3()
}
// Test matrix multiplication by a factor for 2x2 matrices.
-void tst_QMatrix::multiplyFactor2x2_data()
+void tst_QMatrixNxN::multiplyFactor2x2_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<qreal>("factor");
@@ -1343,7 +1343,7 @@ void tst_QMatrix::multiplyFactor2x2_data()
QTest::newRow("zero")
<< (void *)values << (qreal)0.0f << (void *)nullValues4;
}
-void tst_QMatrix::multiplyFactor2x2()
+void tst_QMatrixNxN::multiplyFactor2x2()
{
QFETCH(void *, m1Values);
QFETCH(qreal, factor);
@@ -1366,7 +1366,7 @@ void tst_QMatrix::multiplyFactor2x2()
}
// Test matrix multiplication by a factor for 3x3 matrices.
-void tst_QMatrix::multiplyFactor3x3_data()
+void tst_QMatrixNxN::multiplyFactor3x3_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<qreal>("factor");
@@ -1400,7 +1400,7 @@ void tst_QMatrix::multiplyFactor3x3_data()
QTest::newRow("zero")
<< (void *)values << (qreal)0.0f << (void *)nullValues4;
}
-void tst_QMatrix::multiplyFactor3x3()
+void tst_QMatrixNxN::multiplyFactor3x3()
{
QFETCH(void *, m1Values);
QFETCH(qreal, factor);
@@ -1423,7 +1423,7 @@ void tst_QMatrix::multiplyFactor3x3()
}
// Test matrix multiplication by a factor for 4x4 matrices.
-void tst_QMatrix::multiplyFactor4x4_data()
+void tst_QMatrixNxN::multiplyFactor4x4_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<qreal>("factor");
@@ -1460,7 +1460,7 @@ void tst_QMatrix::multiplyFactor4x4_data()
QTest::newRow("zero")
<< (void *)values << (qreal)0.0f << (void *)nullValues4;
}
-void tst_QMatrix::multiplyFactor4x4()
+void tst_QMatrixNxN::multiplyFactor4x4()
{
QFETCH(void *, m1Values);
QFETCH(qreal, factor);
@@ -1483,7 +1483,7 @@ void tst_QMatrix::multiplyFactor4x4()
}
// Test matrix multiplication by a factor for 4x3 matrices.
-void tst_QMatrix::multiplyFactor4x3_data()
+void tst_QMatrixNxN::multiplyFactor4x3_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<qreal>("factor");
@@ -1517,7 +1517,7 @@ void tst_QMatrix::multiplyFactor4x3_data()
QTest::newRow("zero")
<< (void *)values << (qreal)0.0f << (void *)nullValues4x3;
}
-void tst_QMatrix::multiplyFactor4x3()
+void tst_QMatrixNxN::multiplyFactor4x3()
{
QFETCH(void *, m1Values);
QFETCH(qreal, factor);
@@ -1540,12 +1540,12 @@ void tst_QMatrix::multiplyFactor4x3()
}
// Test matrix division by a factor for 2x2 matrices.
-void tst_QMatrix::divideFactor2x2_data()
+void tst_QMatrixNxN::divideFactor2x2_data()
{
// Use the same test cases as the multiplyFactor test.
multiplyFactor2x2_data();
}
-void tst_QMatrix::divideFactor2x2()
+void tst_QMatrixNxN::divideFactor2x2()
{
QFETCH(void *, m1Values);
QFETCH(qreal, factor);
@@ -1567,12 +1567,12 @@ void tst_QMatrix::divideFactor2x2()
}
// Test matrix division by a factor for 3x3 matrices.
-void tst_QMatrix::divideFactor3x3_data()
+void tst_QMatrixNxN::divideFactor3x3_data()
{
// Use the same test cases as the multiplyFactor test.
multiplyFactor3x3_data();
}
-void tst_QMatrix::divideFactor3x3()
+void tst_QMatrixNxN::divideFactor3x3()
{
QFETCH(void *, m1Values);
QFETCH(qreal, factor);
@@ -1594,12 +1594,12 @@ void tst_QMatrix::divideFactor3x3()
}
// Test matrix division by a factor for 4x4 matrices.
-void tst_QMatrix::divideFactor4x4_data()
+void tst_QMatrixNxN::divideFactor4x4_data()
{
// Use the same test cases as the multiplyFactor test.
multiplyFactor4x4_data();
}
-void tst_QMatrix::divideFactor4x4()
+void tst_QMatrixNxN::divideFactor4x4()
{
QFETCH(void *, m1Values);
QFETCH(qreal, factor);
@@ -1621,12 +1621,12 @@ void tst_QMatrix::divideFactor4x4()
}
// Test matrix division by a factor for 4x3 matrices.
-void tst_QMatrix::divideFactor4x3_data()
+void tst_QMatrixNxN::divideFactor4x3_data()
{
// Use the same test cases as the multiplyFactor test.
multiplyFactor4x3_data();
}
-void tst_QMatrix::divideFactor4x3()
+void tst_QMatrixNxN::divideFactor4x3()
{
QFETCH(void *, m1Values);
QFETCH(qreal, factor);
@@ -1648,12 +1648,12 @@ void tst_QMatrix::divideFactor4x3()
}
// Test matrix negation for 2x2 matrices.
-void tst_QMatrix::negate2x2_data()
+void tst_QMatrixNxN::negate2x2_data()
{
// Use the same test cases as the multiplyFactor test.
multiplyFactor2x2_data();
}
-void tst_QMatrix::negate2x2()
+void tst_QMatrixNxN::negate2x2()
{
QFETCH(void *, m1Values);
@@ -1671,12 +1671,12 @@ void tst_QMatrix::negate2x2()
}
// Test matrix negation for 3x3 matrices.
-void tst_QMatrix::negate3x3_data()
+void tst_QMatrixNxN::negate3x3_data()
{
// Use the same test cases as the multiplyFactor test.
multiplyFactor3x3_data();
}
-void tst_QMatrix::negate3x3()
+void tst_QMatrixNxN::negate3x3()
{
QFETCH(void *, m1Values);
@@ -1694,12 +1694,12 @@ void tst_QMatrix::negate3x3()
}
// Test matrix negation for 4x4 matrices.
-void tst_QMatrix::negate4x4_data()
+void tst_QMatrixNxN::negate4x4_data()
{
// Use the same test cases as the multiplyFactor test.
multiplyFactor4x4_data();
}
-void tst_QMatrix::negate4x4()
+void tst_QMatrixNxN::negate4x4()
{
QFETCH(void *, m1Values);
@@ -1717,12 +1717,12 @@ void tst_QMatrix::negate4x4()
}
// Test matrix negation for 4x3 matrices.
-void tst_QMatrix::negate4x3_data()
+void tst_QMatrixNxN::negate4x3_data()
{
// Use the same test cases as the multiplyFactor test.
multiplyFactor4x3_data();
}
-void tst_QMatrix::negate4x3()
+void tst_QMatrixNxN::negate4x3()
{
QFETCH(void *, m1Values);
@@ -1823,7 +1823,7 @@ static void m4Inverse(const Matrix4& min, Matrix4& mout)
}
// Test matrix inverted for 4x4 matrices.
-void tst_QMatrix::inverted4x4_data()
+void tst_QMatrixNxN::inverted4x4_data()
{
QTest::addColumn<void *>("m1Values");
QTest::addColumn<void *>("m2Values");
@@ -1866,7 +1866,7 @@ void tst_QMatrix::inverted4x4_data()
QTest::newRow("translate")
<< (void *)translate.v << (void *)inverseTranslate.v << true;
}
-void tst_QMatrix::inverted4x4()
+void tst_QMatrixNxN::inverted4x4()
{
QFETCH(void *, m1Values);
QFETCH(void *, m2Values);
@@ -1914,7 +1914,7 @@ void tst_QMatrix::inverted4x4()
QCOMPARE(inv, invertible);
}
-void tst_QMatrix::orthonormalInverse4x4()
+void tst_QMatrixNxN::orthonormalInverse4x4()
{
QMatrix4x4 m1;
QVERIFY(matrixFuzzyCompare(m1.inverted(), m1));
@@ -1949,7 +1949,7 @@ void tst_QMatrix::orthonormalInverse4x4()
}
// Test the generation and use of 4x4 scale matrices.
-void tst_QMatrix::scale4x4_data()
+void tst_QMatrixNxN::scale4x4_data()
{
QTest::addColumn<qreal>("x");
QTest::addColumn<qreal>("y");
@@ -1991,7 +1991,7 @@ void tst_QMatrix::scale4x4_data()
QTest::newRow("complex2D")
<< (qreal)2.0f << (qreal)-11.0f << (qreal)1.0f << (void *)complexScale2D;
}
-void tst_QMatrix::scale4x4()
+void tst_QMatrixNxN::scale4x4()
{
QFETCH(qreal, x);
QFETCH(qreal, y);
@@ -2103,7 +2103,7 @@ void tst_QMatrix::scale4x4()
}
// Test the generation and use of 4x4 translation matrices.
-void tst_QMatrix::translate4x4_data()
+void tst_QMatrixNxN::translate4x4_data()
{
QTest::addColumn<qreal>("x");
QTest::addColumn<qreal>("y");
@@ -2137,7 +2137,7 @@ void tst_QMatrix::translate4x4_data()
QTest::newRow("complex2D")
<< (qreal)2.0f << (qreal)-11.0f << (qreal)0.0f << (void *)complexTranslate2D;
}
-void tst_QMatrix::translate4x4()
+void tst_QMatrixNxN::translate4x4()
{
QFETCH(qreal, x);
QFETCH(qreal, y);
@@ -2203,7 +2203,7 @@ void tst_QMatrix::translate4x4()
}
// Test the generation and use of 4x4 rotation matrices.
-void tst_QMatrix::rotate4x4_data()
+void tst_QMatrixNxN::rotate4x4_data()
{
QTest::addColumn<qreal>("angle");
QTest::addColumn<qreal>("x");
@@ -2326,7 +2326,7 @@ void tst_QMatrix::rotate4x4_data()
<< (qreal)x << (qreal)y << (qreal)z
<< (void *)complexRotate;
}
-void tst_QMatrix::rotate4x4()
+void tst_QMatrixNxN::rotate4x4()
{
QFETCH(qreal, angle);
QFETCH(qreal, x);
@@ -2441,7 +2441,7 @@ static bool isSame(const QMatrix3x3& m1, const Matrix3& m2)
}
// Test the computation of normal matrices from 4x4 transformation matrices.
-void tst_QMatrix::normalMatrix_data()
+void tst_QMatrixNxN::normalMatrix_data()
{
QTest::addColumn<void *>("mValues");
@@ -2488,7 +2488,7 @@ void tst_QMatrix::normalMatrix_data()
QTest::newRow("null scale 2") << (void *)nullScaleValues2;
QTest::newRow("null scale 3") << (void *)nullScaleValues3;
}
-void tst_QMatrix::normalMatrix()
+void tst_QMatrixNxN::normalMatrix()
{
QFETCH(void *, mValues);
const qreal *values = (const qreal *)mValues;
@@ -2529,7 +2529,7 @@ void tst_QMatrix::normalMatrix()
}
// Test optimized transformations on 4x4 matrices.
-void tst_QMatrix::optimizedTransforms()
+void tst_QMatrixNxN::optimizedTransforms()
{
static qreal const translateValues[16] =
{1.0f, 0.0f, 0.0f, 4.0f,
@@ -2640,7 +2640,7 @@ void tst_QMatrix::optimizedTransforms()
}
// Test orthographic projections.
-void tst_QMatrix::ortho()
+void tst_QMatrixNxN::ortho()
{
QMatrix4x4 m1;
m1.ortho(QRect(0, 0, 300, 150));
@@ -2729,7 +2729,7 @@ void tst_QMatrix::ortho()
}
// Test perspective frustum projections.
-void tst_QMatrix::frustum()
+void tst_QMatrixNxN::frustum()
{
QMatrix4x4 m1;
m1.frustum(-1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f);
@@ -2765,7 +2765,7 @@ void tst_QMatrix::frustum()
}
// Test perspective field-of-view projections.
-void tst_QMatrix::perspective()
+void tst_QMatrixNxN::perspective()
{
QMatrix4x4 m1;
m1.perspective(45.0f, 1.0f, -1.0f, 1.0f);
@@ -2801,7 +2801,7 @@ void tst_QMatrix::perspective()
}
// Test left-handed vs right-handed coordinate flipping.
-void tst_QMatrix::flipCoordinates()
+void tst_QMatrixNxN::flipCoordinates()
{
QMatrix4x4 m1;
m1.flipCoordinates();
@@ -2828,7 +2828,7 @@ void tst_QMatrix::flipCoordinates()
}
// Test conversion of generic matrices to and from the non-generic types.
-void tst_QMatrix::convertGeneric()
+void tst_QMatrixNxN::convertGeneric()
{
QMatrix4x3 m1(uniqueValues4x3);
@@ -2860,7 +2860,7 @@ void tst_QMatrix::convertGeneric()
QVERIFY(isSame(m11, conv4x4));
}
-void tst_QMatrix::extractAxisRotation_data()
+void tst_QMatrixNxN::extractAxisRotation_data()
{
QTest::addColumn<float>("x");
QTest::addColumn<float>("y");
@@ -2893,7 +2893,7 @@ void tst_QMatrix::extractAxisRotation_data()
QTest::newRow("1, 1, 1, 300 deg") << 1.0f << 1.0f << 1.0f << 300.0f;
}
-void tst_QMatrix::extractAxisRotation()
+void tst_QMatrixNxN::extractAxisRotation()
{
QFETCH(float, x);
QFETCH(float, y);
@@ -2922,7 +2922,7 @@ void tst_QMatrix::extractAxisRotation()
}
}
-void tst_QMatrix::extractTranslation_data()
+void tst_QMatrixNxN::extractTranslation_data()
{
QTest::addColumn<QMatrix4x4>("rotation");
QTest::addColumn<float>("x");
@@ -2948,7 +2948,7 @@ void tst_QMatrix::extractTranslation_data()
QTest::newRow("rotZ 75, rotX 25, rotY 45, 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f;
}
-void tst_QMatrix::extractTranslation()
+void tst_QMatrixNxN::extractTranslation()
{
QFETCH(QMatrix4x4, rotation);
QFETCH(float, x);
@@ -2995,7 +2995,7 @@ struct Matrix4x4
};
// Test the inferring of special matrix types.
-void tst_QMatrix::inferSpecialType_data()
+void tst_QMatrixNxN::inferSpecialType_data()
{
QTest::addColumn<void *>("mValues");
QTest::addColumn<int>("flagBits");
@@ -3043,7 +3043,7 @@ void tst_QMatrix::inferSpecialType_data()
QTest::newRow("below")
<< (void *)belowValues << (int)General;
}
-void tst_QMatrix::inferSpecialType()
+void tst_QMatrixNxN::inferSpecialType()
{
QFETCH(void *, mValues);
QFETCH(int, flagBits);
@@ -3054,7 +3054,7 @@ void tst_QMatrix::inferSpecialType()
QCOMPARE(reinterpret_cast<Matrix4x4 *>(&m)->flagBits, flagBits);
}
-void tst_QMatrix::columnsAndRows()
+void tst_QMatrixNxN::columnsAndRows()
{
QMatrix4x4 m1(uniqueValues4);
@@ -3102,7 +3102,7 @@ void tst_QMatrix::columnsAndRows()
// Test converting QMatrix objects into QMatrix4x4 and then
// checking that transformations in the original perform the
// equivalent transformations in the new matrix.
-void tst_QMatrix::convertQMatrix()
+void tst_QMatrixNxN::convertQMatrix()
{
QMatrix m1;
m1.translate(-3.5, 2.0);
@@ -3149,7 +3149,7 @@ void tst_QMatrix::convertQMatrix()
// Test converting QTransform objects into QMatrix4x4 and then
// checking that transformations in the original perform the
// equivalent transformations in the new matrix.
-void tst_QMatrix::convertQTransform()
+void tst_QMatrixNxN::convertQTransform()
{
QTransform m1;
m1.translate(-3.5, 2.0);
@@ -3197,7 +3197,7 @@ void tst_QMatrix::convertQTransform()
}
// Test filling matrices with specific values.
-void tst_QMatrix::fill()
+void tst_QMatrixNxN::fill()
{
QMatrix4x4 m1;
m1.fill(0.0f);
@@ -3224,7 +3224,7 @@ void tst_QMatrix::fill()
}
// Test the mapRect() function for QRect and QRectF.
-void tst_QMatrix::mapRect_data()
+void tst_QMatrixNxN::mapRect_data()
{
QTest::addColumn<qreal>("x");
QTest::addColumn<qreal>("y");
@@ -3236,7 +3236,7 @@ void tst_QMatrix::mapRect_data()
QTest::newRow("rect")
<< (qreal)1.0f << (qreal)-20.5f << (qreal)100.0f << (qreal)63.75f;
}
-void tst_QMatrix::mapRect()
+void tst_QMatrixNxN::mapRect()
{
QFETCH(qreal, x);
QFETCH(qreal, y);
@@ -3334,12 +3334,12 @@ void tst_QMatrix::mapRect()
QVERIFY(mri == tri);
}
-class tst_QMatrix4x4Properties : public QObject
+class tst_QMatrixNxN4x4Properties : public QObject
{
Q_OBJECT
Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix)
public:
- tst_QMatrix4x4Properties(QObject *parent = 0) : QObject(parent) {}
+ tst_QMatrixNxN4x4Properties(QObject *parent = 0) : QObject(parent) {}
QMatrix4x4 matrix() const { return m; }
void setMatrix(const QMatrix4x4& value) { m = value; }
@@ -3349,9 +3349,9 @@ private:
};
// Test getting and setting matrix properties via the metaobject system.
-void tst_QMatrix::properties()
+void tst_QMatrixNxN::properties()
{
- tst_QMatrix4x4Properties obj;
+ tst_QMatrixNxN4x4Properties obj;
QMatrix4x4 m1(uniqueValues4);
obj.setMatrix(m1);
@@ -3366,7 +3366,7 @@ void tst_QMatrix::properties()
QVERIFY(isSame(m2, transposedValues4));
}
-void tst_QMatrix::metaTypes()
+void tst_QMatrixNxN::metaTypes()
{
QVERIFY(QMetaType::type("QMatrix4x4") == QMetaType::QMatrix4x4);
@@ -3378,6 +3378,6 @@ void tst_QMatrix::metaTypes()
QVERIFY(qMetaTypeId<QMatrix4x4>() == QMetaType::QMatrix4x4);
}
-QTEST_APPLESS_MAIN(tst_QMatrix)
+QTEST_APPLESS_MAIN(tst_QMatrixNxN)
#include "tst_qmatrixnxn.moc"
diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp
index e0548a7..686f62f 100644
--- a/tests/auto/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp
@@ -598,7 +598,7 @@ void tst_QDockWidget::visibilityChanged()
QCOMPARE(spy.count(), 0);
mw.addDockWidget(Qt::RightDockWidgetArea, &dw2);
- qApp->processEvents();
+ QTest::qWait(200);
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).at(0).toBool(), true);
}
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index eadf8b7..a623b50 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -280,6 +280,7 @@ private slots:
void autoDetectFocusProxy();
void subFocus();
void reverseCreateAutoFocusProxy();
+ void focusProxyDeletion();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -7516,5 +7517,46 @@ void tst_QGraphicsItem::reverseCreateAutoFocusProxy()
QVERIFY(text2->hasFocus());
}
+void tst_QGraphicsItem::focusProxyDeletion()
+{
+ QGraphicsRectItem *rect = new QGraphicsRectItem;
+ QGraphicsRectItem *rect2 = new QGraphicsRectItem;
+ rect->setFocusProxy(rect2);
+ QCOMPARE(rect->focusProxy(), (QGraphicsItem *)rect2);
+
+ delete rect2;
+ QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0);
+
+ rect2 = new QGraphicsRectItem;
+ rect->setFocusProxy(rect2);
+ delete rect; // don't crash
+
+ rect = new QGraphicsRectItem;
+ rect->setFocusProxy(rect2);
+ QGraphicsScene *scene = new QGraphicsScene;
+ scene->addItem(rect);
+ scene->addItem(rect2);
+ delete rect2;
+ QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0);
+
+ rect2 = new QGraphicsRectItem;
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsItem::setFocusProxy: focus proxy must be in same scene");
+ rect->setFocusProxy(rect2);
+ QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0);
+ scene->addItem(rect2);
+ rect->setFocusProxy(rect2);
+ QCOMPARE(rect->focusProxy(), (QGraphicsItem *)rect2);
+ delete rect; // don't crash
+
+ rect = new QGraphicsRectItem;
+ rect2 = new QGraphicsRectItem;
+ rect->setFocusProxy(rect2);
+ QCOMPARE(rect->focusProxy(), (QGraphicsItem *)rect2);
+ scene->addItem(rect);
+ scene->addItem(rect2);
+ rect->setFocusProxy(rect2);
+ delete scene; // don't crash
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro b/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro
index 7cd8d51..889aac9 100644
--- a/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro
+++ b/tests/auto/qhelpcontentmodel/tst_qhelpcontentmodel.pro
@@ -3,6 +3,20 @@ SOURCES += tst_qhelpcontentmodel.cpp
CONFIG += help
-DEFINES += SRCDIR=\\\"$$PWD\\\"
DEFINES += QT_USE_USING_NAMESPACE
!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
+
+wince*: {
+ DEFINES += SRCDIR=\\\"./\\\"
+ QT += network
+ addFiles.sources = $$PWD/data/*.*
+ addFiles.path = data
+ clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll
+
+ DEPLOYMENT += addFiles
+ DEPLOYMENT += clucene
+
+ DEPLOYMENT_PLUGIN += qsqlite
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+} \ No newline at end of file
diff --git a/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp b/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp
index 499c367..d765c25 100644
--- a/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp
+++ b/tests/auto/qhelpenginecore/tst_qhelpenginecore.cpp
@@ -98,6 +98,8 @@ void tst_QHelpEngineCore::init()
// defined in profile
m_path = QLatin1String(SRCDIR);
+ m_path = QFileInfo(m_path).absoluteFilePath();
+
m_colFile = m_path + QLatin1String("/data/col.qhc");
if (QFile::exists(m_colFile))
QDir::current().remove(m_colFile);
diff --git a/tests/auto/qhelpenginecore/tst_qhelpenginecore.pro b/tests/auto/qhelpenginecore/tst_qhelpenginecore.pro
index 11fca8e..27ebd0f 100644
--- a/tests/auto/qhelpenginecore/tst_qhelpenginecore.pro
+++ b/tests/auto/qhelpenginecore/tst_qhelpenginecore.pro
@@ -3,6 +3,21 @@ SOURCES += tst_qhelpenginecore.cpp
CONFIG += help
QT += sql
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+
DEFINES += QT_USE_USING_NAMESPACE
!contains(QT_BUILD_PARTS, tools): DEFINES += QT_NO_BUILD_TOOLS
+
+wince*: {
+ DEFINES += SRCDIR=\\\"./\\\"
+ QT += network
+ addFiles.sources = $$PWD/data/*.*
+ addFiles.path = data
+ clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll
+
+ DEPLOYMENT += addFiles
+ DEPLOYMENT += clucene
+
+ DEPLOYMENT_PLUGIN += qsqlite
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
index 6f49d8e..5af6f39 100644
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -102,6 +102,7 @@ private slots:
void easingcurve_data();
void easingcurve();
void startWithoutStartValue();
+ void startBackwardWithoutEndValue();
void playForwardBackward();
void interpolated();
void setStartEndValues_data();
@@ -582,6 +583,47 @@ void tst_QPropertyAnimation::startWithoutStartValue()
QVERIFY(current <= 110);
}
+void tst_QPropertyAnimation::startBackwardWithoutEndValue()
+{
+ QObject o;
+ o.setProperty("ole", 42);
+ QCOMPARE(o.property("ole").toInt(), 42);
+
+ QPropertyAnimation anim(&o, "ole");
+ anim.setStartValue(100);
+ anim.setDirection(QAbstractAnimation::Backward);
+
+ //we start without an end value
+ anim.start();
+ QCOMPARE(anim.state(), QAbstractAnimation::Running);
+ QCOMPARE(o.property("ole").toInt(), 42); //the initial value
+
+ QTest::qWait(100);
+ int current = anim.currentValue().toInt();
+ //it is somewhere in the animation
+ QVERIFY(current > 42);
+ QVERIFY(current < 100);
+
+ QTest::qWait(200);
+ QCOMPARE(anim.state(), QVariantAnimation::Stopped);
+ current = anim.currentValue().toInt();
+ QCOMPARE(current, 100);
+ QCOMPARE(o.property("ole").toInt(), current);
+
+ anim.setStartValue(110);
+ anim.start();
+ current = anim.currentValue().toInt();
+ // the default start value will reevaluate the current property
+ // and set it to the end value of the last iteration
+ QCOMPARE(current, 100);
+ QTest::qWait(100);
+ current = anim.currentValue().toInt();
+ //it is somewhere in the animation
+ QVERIFY(current >= 100);
+ QVERIFY(current <= 110);
+}
+
+
void tst_QPropertyAnimation::playForwardBackward()
{
QObject o;
diff --git a/tests/auto/qtextcodec/test/test.pro b/tests/auto/qtextcodec/test/test.pro
index 9c07e76..99f94d4 100644
--- a/tests/auto/qtextcodec/test/test.pro
+++ b/tests/auto/qtextcodec/test/test.pro
@@ -1,6 +1,21 @@
load(qttest_p4)
-TARGET = ../tst_qtextcodec
+
SOURCES += ../tst_qtextcodec.cpp
+
+!wince*: {
+TARGET = ../tst_qtextcodec
+
+win32: {
+ CONFIG(debug, debug|release) {
+ TARGET = ../../debug/tst_qtextcodec
+} else {
+ TARGET = ../../release/tst_qtextcodec
+ }
+}
+} else {
+ TARGET = tst_qtextcodec
+}
+
wince*: {
addFiles.sources = ../*.txt
addFiles.path = .
diff --git a/tests/auto/qtouchevent/tst_qtouchevent.cpp b/tests/auto/qtouchevent/tst_qtouchevent.cpp
index f30c4db..69b8888 100644
--- a/tests/auto/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/qtouchevent/tst_qtouchevent.cpp
@@ -96,6 +96,63 @@ public:
}
};
+class tst_QTouchEventGraphicsItem : public QGraphicsItem
+{
+public:
+ QList<QTouchEvent::TouchPoint> touchBeginPoints, touchUpdatePoints, touchEndPoints;
+ bool seenTouchBegin, seenTouchUpdate, seenTouchEnd;
+ bool acceptTouchBegin, acceptTouchUpdate, acceptTouchEnd;
+
+ tst_QTouchEventGraphicsItem()
+ : QGraphicsItem()
+ {
+ reset();
+ }
+
+ void reset()
+ {
+ touchBeginPoints.clear();
+ touchUpdatePoints.clear();
+ touchEndPoints.clear();
+ seenTouchBegin = seenTouchUpdate = seenTouchEnd = false;
+ acceptTouchBegin = acceptTouchUpdate = acceptTouchEnd = true;
+ }
+
+ QRectF boundingRect() const { return QRectF(0, 0, 10, 10); }
+ void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) { }
+
+ bool sceneEvent(QEvent *event)
+ {
+ switch (event->type()) {
+ case QEvent::TouchBegin:
+ if (seenTouchBegin) qWarning("TouchBegin: already seen a TouchBegin");
+ if (seenTouchUpdate) qWarning("TouchBegin: TouchUpdate cannot happen before TouchBegin");
+ if (seenTouchEnd) qWarning("TouchBegin: TouchEnd cannot happen before TouchBegin");
+ seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd;
+ touchBeginPoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ event->setAccepted(acceptTouchBegin);
+ break;
+ case QEvent::TouchUpdate:
+ if (!seenTouchBegin) qWarning("TouchUpdate: have not seen TouchBegin");
+ if (seenTouchEnd) qWarning("TouchUpdate: TouchEnd cannot happen before TouchUpdate");
+ seenTouchUpdate = seenTouchBegin && !seenTouchEnd;
+ touchUpdatePoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ event->setAccepted(acceptTouchUpdate);
+ break;
+ case QEvent::TouchEnd:
+ if (!seenTouchBegin) qWarning("TouchEnd: have not seen TouchBegin");
+ if (seenTouchEnd) qWarning("TouchEnd: already seen a TouchEnd");
+ seenTouchEnd = seenTouchBegin && !seenTouchEnd;
+ touchEndPoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ event->setAccepted(acceptTouchEnd);
+ break;
+ default:
+ return QGraphicsItem::sceneEvent(event);
+ }
+ return true;
+ }
+};
+
class tst_QTouchEvent : public QObject
{
Q_OBJECT
@@ -115,139 +172,348 @@ private slots:
void tst_QTouchEvent::touchDisabledByDefault()
{
- // the widget attribute is not enabled by default
- QWidget widget;
- QVERIFY(!widget.testAttribute(Qt::WA_AcceptTouchEvents));
-
- // events should not be accepted since they are not enabled
- QList<QTouchEvent::TouchPoint> touchPoints;
- touchPoints.append(QTouchEvent::TouchPoint(0));
- QTouchEvent touchEvent(QEvent::TouchBegin,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointPressed,
- touchPoints);
- bool res = QApplication::sendEvent(&widget, &touchEvent);
- QVERIFY(!res);
- QVERIFY(!touchEvent.isAccepted());
+ // QWidget
+ {
+ // the widget attribute is not enabled by default
+ QWidget widget;
+ QVERIFY(!widget.testAttribute(Qt::WA_AcceptTouchEvents));
+
+ // events should not be accepted since they are not enabled
+ QList<QTouchEvent::TouchPoint> touchPoints;
+ touchPoints.append(QTouchEvent::TouchPoint(0));
+ QTouchEvent touchEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ touchPoints);
+ bool res = QApplication::sendEvent(&widget, &touchEvent);
+ QVERIFY(!res);
+ QVERIFY(!touchEvent.isAccepted());
+ }
+
+ // QGraphicsView
+ {
+ QGraphicsScene scene;
+ tst_QTouchEventGraphicsItem item;
+ QGraphicsView view(&scene);
+ scene.addItem(&item);
+ item.setPos(100, 100);
+ view.resize(200, 200);
+ view.fitInView(scene.sceneRect());
+
+ // touch events are not accepted by default
+ QVERIFY(!item.acceptTouchEvents());
+
+ // compose an event to the scene that is over the item
+ QTouchEvent::TouchPoint touchPoint(0);
+ touchPoint.setState(Qt::TouchPointPressed);
+ touchPoint.setPos(view.mapFromScene(item.mapToScene(item.boundingRect().center())));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ QTouchEvent touchEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ (QList<QTouchEvent::TouchPoint>() << touchPoint));
+ bool res = QApplication::sendEvent(view.viewport(), &touchEvent);
+ QVERIFY(!res);
+ QVERIFY(!touchEvent.isAccepted());
+ QVERIFY(!item.seenTouchBegin);
+ }
}
void tst_QTouchEvent::touchEventAcceptedByDefault()
{
- // enabling touch events should automatically accept touch events
- QWidget widget;
- widget.setAttribute(Qt::WA_AcceptTouchEvents);
-
- // QWidget handles touch event by converting them into a mouse event, so the event is both
- // accepted and handled (res == true)
- QList<QTouchEvent::TouchPoint> touchPoints;
- touchPoints.append(QTouchEvent::TouchPoint(0));
- QTouchEvent touchEvent(QEvent::TouchBegin,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointPressed,
- touchPoints);
- bool res = QApplication::sendEvent(&widget, &touchEvent);
- QVERIFY(res);
- QVERIFY(touchEvent.isAccepted());
-
- // tst_QTouchEventWidget does handle, sending succeeds
- tst_QTouchEventWidget touchWidget;
- touchWidget.setAttribute(Qt::WA_AcceptTouchEvents);
- touchEvent.ignore();
- res = QApplication::sendEvent(&touchWidget, &touchEvent);
- QVERIFY(res);
- QVERIFY(touchEvent.isAccepted());
+ // QWidget
+ {
+ // enabling touch events should automatically accept touch events
+ QWidget widget;
+ widget.setAttribute(Qt::WA_AcceptTouchEvents);
+
+ // QWidget handles touch event by converting them into a mouse event, so the event is both
+ // accepted and handled (res == true)
+ QList<QTouchEvent::TouchPoint> touchPoints;
+ touchPoints.append(QTouchEvent::TouchPoint(0));
+ QTouchEvent touchEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ touchPoints);
+ bool res = QApplication::sendEvent(&widget, &touchEvent);
+ QVERIFY(res);
+ QVERIFY(touchEvent.isAccepted());
+
+ // tst_QTouchEventWidget does handle, sending succeeds
+ tst_QTouchEventWidget touchWidget;
+ touchWidget.setAttribute(Qt::WA_AcceptTouchEvents);
+ touchEvent.ignore();
+ res = QApplication::sendEvent(&touchWidget, &touchEvent);
+ QVERIFY(res);
+ QVERIFY(touchEvent.isAccepted());
+ }
+
+ // QGraphicsView
+ {
+ QGraphicsScene scene;
+ tst_QTouchEventGraphicsItem item;
+ QGraphicsView view(&scene);
+ scene.addItem(&item);
+ item.setPos(100, 100);
+ view.resize(200, 200);
+ view.fitInView(scene.sceneRect());
+
+ // enabling touch events on the item also enables events on the viewport
+ item.setAcceptTouchEvents(true);
+ QVERIFY(view.viewport()->testAttribute(Qt::WA_AcceptTouchEvents));
+
+ // compose an event to the scene that is over the item
+ QTouchEvent::TouchPoint touchPoint(0);
+ touchPoint.setState(Qt::TouchPointPressed);
+ touchPoint.setPos(view.mapFromScene(item.mapToScene(item.boundingRect().center())));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ QTouchEvent touchEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ (QList<QTouchEvent::TouchPoint>() << touchPoint));
+ bool res = QApplication::sendEvent(view.viewport(), &touchEvent);
+ QVERIFY(res);
+ QVERIFY(touchEvent.isAccepted());
+ QVERIFY(item.seenTouchBegin);
+ }
}
void tst_QTouchEvent::touchBeginPropagatesWhenIgnored()
{
- tst_QTouchEventWidget window, child, grandchild;
- child.setParent(&window);
- grandchild.setParent(&child);
-
- // all widgets accept touch events, grandchild ignores, so child sees the event, but not window
- window.setAttribute(Qt::WA_AcceptTouchEvents);
- child.setAttribute(Qt::WA_AcceptTouchEvents);
- grandchild.setAttribute(Qt::WA_AcceptTouchEvents);
- grandchild.acceptTouchBegin = false;
-
- QList<QTouchEvent::TouchPoint> touchPoints;
- touchPoints.append(QTouchEvent::TouchPoint(0));
- QTouchEvent touchEvent(QEvent::TouchBegin,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointPressed,
- touchPoints);
- bool res = QApplication::sendEvent(&grandchild, &touchEvent);
- QVERIFY(res);
- QVERIFY(touchEvent.isAccepted());
- QVERIFY(grandchild.seenTouchBegin);
- QVERIFY(child.seenTouchBegin);
- QVERIFY(!window.seenTouchBegin);
-
- // disable touch on grandchild. even though it doesn't accept it, child should still get the
- // TouchBegin
- grandchild.reset();
- child.reset();
- window.reset();
- grandchild.setAttribute(Qt::WA_AcceptTouchEvents, false);
-
- touchEvent.ignore();
- res = QApplication::sendEvent(&grandchild, &touchEvent);
- QVERIFY(res);
- QVERIFY(touchEvent.isAccepted());
- QVERIFY(!grandchild.seenTouchBegin);
- QVERIFY(child.seenTouchBegin);
- QVERIFY(!window.seenTouchBegin);
+ // QWidget
+ {
+ tst_QTouchEventWidget window, child, grandchild;
+ child.setParent(&window);
+ grandchild.setParent(&child);
+
+ // all widgets accept touch events, grandchild ignores, so child sees the event, but not window
+ window.setAttribute(Qt::WA_AcceptTouchEvents);
+ child.setAttribute(Qt::WA_AcceptTouchEvents);
+ grandchild.setAttribute(Qt::WA_AcceptTouchEvents);
+ grandchild.acceptTouchBegin = false;
+
+ QList<QTouchEvent::TouchPoint> touchPoints;
+ touchPoints.append(QTouchEvent::TouchPoint(0));
+ QTouchEvent touchEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ touchPoints);
+ bool res = QApplication::sendEvent(&grandchild, &touchEvent);
+ QVERIFY(res);
+ QVERIFY(touchEvent.isAccepted());
+ QVERIFY(grandchild.seenTouchBegin);
+ QVERIFY(child.seenTouchBegin);
+ QVERIFY(!window.seenTouchBegin);
+
+ // disable touch on grandchild. even though it doesn't accept it, child should still get the
+ // TouchBegin
+ grandchild.reset();
+ child.reset();
+ window.reset();
+ grandchild.setAttribute(Qt::WA_AcceptTouchEvents, false);
+
+ touchEvent.ignore();
+ res = QApplication::sendEvent(&grandchild, &touchEvent);
+ QVERIFY(res);
+ QVERIFY(touchEvent.isAccepted());
+ QVERIFY(!grandchild.seenTouchBegin);
+ QVERIFY(child.seenTouchBegin);
+ QVERIFY(!window.seenTouchBegin);
+ }
+
+ // QGraphicsView
+ {
+ QGraphicsScene scene;
+ tst_QTouchEventGraphicsItem root, child, grandchild;
+ QGraphicsView view(&scene);
+ scene.addItem(&root);
+ root.setPos(100, 100);
+ child.setParentItem(&root);
+ grandchild.setParentItem(&child);
+ view.resize(200, 200);
+ view.fitInView(scene.sceneRect());
+
+ // all items accept touch events, grandchild ignores, so child sees the event, but not root
+ root.setAcceptTouchEvents(true);
+ child.setAcceptTouchEvents(true);
+ grandchild.setAcceptTouchEvents(true);
+ grandchild.acceptTouchBegin = false;
+
+ // compose an event to the scene that is over the grandchild
+ QTouchEvent::TouchPoint touchPoint(0);
+ touchPoint.setState(Qt::TouchPointPressed);
+ touchPoint.setPos(view.mapFromScene(grandchild.mapToScene(grandchild.boundingRect().center())));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ QTouchEvent touchEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ (QList<QTouchEvent::TouchPoint>() << touchPoint));
+ bool res = QApplication::sendEvent(view.viewport(), &touchEvent);
+ QVERIFY(res);
+ QVERIFY(touchEvent.isAccepted());
+ QVERIFY(grandchild.seenTouchBegin);
+ QVERIFY(child.seenTouchBegin);
+ QVERIFY(!root.seenTouchBegin);
+ }
+
+ // QGraphicsView
+ {
+ QGraphicsScene scene;
+ tst_QTouchEventGraphicsItem root, child, grandchild;
+ QGraphicsView view(&scene);
+ scene.addItem(&root);
+ root.setPos(100, 100);
+ child.setParentItem(&root);
+ grandchild.setParentItem(&child);
+ view.resize(200, 200);
+ view.fitInView(scene.sceneRect());
+
+ // leave touch disabled on grandchild. even though it doesn't accept it, child should
+ // still get the TouchBegin
+ root.setAcceptTouchEvents(true);
+ child.setAcceptTouchEvents(true);
+
+ // compose an event to the scene that is over the grandchild
+ QTouchEvent::TouchPoint touchPoint(0);
+ touchPoint.setState(Qt::TouchPointPressed);
+ touchPoint.setPos(view.mapFromScene(grandchild.mapToScene(grandchild.boundingRect().center())));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ QTouchEvent touchEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ (QList<QTouchEvent::TouchPoint>() << touchPoint));
+ bool res = QApplication::sendEvent(view.viewport(), &touchEvent);
+ QVERIFY(res);
+ QVERIFY(touchEvent.isAccepted());
+ QVERIFY(!grandchild.seenTouchBegin);
+ QVERIFY(child.seenTouchBegin);
+ QVERIFY(!root.seenTouchBegin);
+ }
}
void tst_QTouchEvent::touchUpdateAndEndNeverPropagate()
{
- tst_QTouchEventWidget window, child;
- child.setParent(&window);
-
- window.setAttribute(Qt::WA_AcceptTouchEvents);
- child.setAttribute(Qt::WA_AcceptTouchEvents);
- child.acceptTouchUpdate = false;
- child.acceptTouchEnd = false;
-
- QList<QTouchEvent::TouchPoint> touchPoints;
- touchPoints.append(QTouchEvent::TouchPoint(0));
- QTouchEvent touchBeginEvent(QEvent::TouchBegin,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointPressed,
- touchPoints);
- bool res = QApplication::sendEvent(&child, &touchBeginEvent);
- QVERIFY(res);
- QVERIFY(touchBeginEvent.isAccepted());
- QVERIFY(child.seenTouchBegin);
- QVERIFY(!window.seenTouchBegin);
-
- // send the touch update to the child, but ignore it, it doesn't propagate
- QTouchEvent touchUpdateEvent(QEvent::TouchUpdate,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointMoved,
- touchPoints);
- res = QApplication::sendEvent(&child, &touchUpdateEvent);
- QVERIFY(res);
- QVERIFY(!touchUpdateEvent.isAccepted());
- QVERIFY(child.seenTouchUpdate);
- QVERIFY(!window.seenTouchUpdate);
-
- // send the touch end, same thing should happen as with touch update
- QTouchEvent touchEndEvent(QEvent::TouchEnd,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointReleased,
- touchPoints);
- res = QApplication::sendEvent(&child, &touchEndEvent);
- QVERIFY(res);
- QVERIFY(!touchEndEvent.isAccepted());
- QVERIFY(child.seenTouchEnd);
- QVERIFY(!window.seenTouchEnd);
+ // QWidget
+ {
+ tst_QTouchEventWidget window, child;
+ child.setParent(&window);
+
+ window.setAttribute(Qt::WA_AcceptTouchEvents);
+ child.setAttribute(Qt::WA_AcceptTouchEvents);
+ child.acceptTouchUpdate = false;
+ child.acceptTouchEnd = false;
+
+ QList<QTouchEvent::TouchPoint> touchPoints;
+ touchPoints.append(QTouchEvent::TouchPoint(0));
+ QTouchEvent touchBeginEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ touchPoints);
+ bool res = QApplication::sendEvent(&child, &touchBeginEvent);
+ QVERIFY(res);
+ QVERIFY(touchBeginEvent.isAccepted());
+ QVERIFY(child.seenTouchBegin);
+ QVERIFY(!window.seenTouchBegin);
+
+ // send the touch update to the child, but ignore it, it doesn't propagate
+ QTouchEvent touchUpdateEvent(QEvent::TouchUpdate,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointMoved,
+ touchPoints);
+ res = QApplication::sendEvent(&child, &touchUpdateEvent);
+ QVERIFY(res);
+ QVERIFY(!touchUpdateEvent.isAccepted());
+ QVERIFY(child.seenTouchUpdate);
+ QVERIFY(!window.seenTouchUpdate);
+
+ // send the touch end, same thing should happen as with touch update
+ QTouchEvent touchEndEvent(QEvent::TouchEnd,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointReleased,
+ touchPoints);
+ res = QApplication::sendEvent(&child, &touchEndEvent);
+ QVERIFY(res);
+ QVERIFY(!touchEndEvent.isAccepted());
+ QVERIFY(child.seenTouchEnd);
+ QVERIFY(!window.seenTouchEnd);
+ }
+
+ // QGraphicsView
+ {
+ QGraphicsScene scene;
+ tst_QTouchEventGraphicsItem root, child, grandchild;
+ QGraphicsView view(&scene);
+ scene.addItem(&root);
+ root.setPos(100, 100);
+ child.setParentItem(&root);
+ grandchild.setParentItem(&child);
+ view.resize(200, 200);
+ view.fitInView(scene.sceneRect());
+
+ root.setAcceptTouchEvents(true);
+ child.setAcceptTouchEvents(true);
+ child.acceptTouchUpdate = false;
+ child.acceptTouchEnd = false;
+
+ // compose an event to the scene that is over the child
+ QTouchEvent::TouchPoint touchPoint(0);
+ touchPoint.setState(Qt::TouchPointPressed);
+ touchPoint.setPos(view.mapFromScene(grandchild.mapToScene(grandchild.boundingRect().center())));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
+ touchPoint.setScenePos(view.mapToScene(touchPoint.pos().toPoint()));
+ QTouchEvent touchBeginEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ (QList<QTouchEvent::TouchPoint>() << touchPoint));
+ bool res = QApplication::sendEvent(view.viewport(), &touchBeginEvent);
+ QVERIFY(res);
+ QVERIFY(touchBeginEvent.isAccepted());
+ QVERIFY(child.seenTouchBegin);
+ QVERIFY(!root.seenTouchBegin);
+
+ // send the touch update to the child, but ignore it, it doesn't propagate
+ touchPoint.setState(Qt::TouchPointMoved);
+ QTouchEvent touchUpdateEvent(QEvent::TouchUpdate,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointMoved,
+ (QList<QTouchEvent::TouchPoint>() << touchPoint));
+ res = QApplication::sendEvent(view.viewport(), &touchUpdateEvent);
+ QVERIFY(res);
+ // the scene accepts the event, since it found an item to send the event to
+ QVERIFY(touchUpdateEvent.isAccepted());
+ QVERIFY(child.seenTouchUpdate);
+ QVERIFY(!root.seenTouchUpdate);
+
+ // send the touch end, same thing should happen as with touch update
+ touchPoint.setState(Qt::TouchPointReleased);
+ QTouchEvent touchEndEvent(QEvent::TouchEnd,
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointReleased,
+ (QList<QTouchEvent::TouchPoint>() << touchPoint));
+ res = QApplication::sendEvent(view.viewport(), &touchEndEvent);
+ QVERIFY(res);
+ // the scene accepts the event, since it found an item to send the event to
+ QVERIFY(touchEndEvent.isAccepted());
+ QVERIFY(child.seenTouchEnd);
+ QVERIFY(!root.seenTouchEnd);
+ }
}
QPointF normalized(const QPointF &pos, const QRectF &rect)
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index fc91b74..34971a9 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -5827,7 +5827,9 @@ void tst_QWidget::setToolTip()
QCOMPARE(widget.toolTip(), QString());
QCOMPARE(spy.count(), 2);
-
+#ifdef Q_OS_WINCE_WM
+ QSKIP("Mouse over doesn't work on Windows mobile.", SkipAll);
+#endif
for (int pass = 0; pass < 2; ++pass) {
QWidget *popup = new QWidget(0, Qt::Popup);
diff --git a/tests/auto/uiloader/baseline/css_borderradius_allwidgets.ui b/tests/auto/uiloader/baseline/css_borderradius_allwidgets.ui
new file mode 100644
index 0000000..8c5f57c
--- /dev/null
+++ b/tests/auto/uiloader/baseline/css_borderradius_allwidgets.ui
@@ -0,0 +1,458 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>698</width>
+ <height>589</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">* {
+ background: yellow;
+ padding: 2px;
+ border-radius: 4px;
+}
+
+QGroupBox {
+ border: 1px solid gray;
+}
+
+QAbstractButton {
+ background: cyan;
+}
+
+QFrame, QMenuBar {
+ background: magenta;
+}
+
+QLineEdit, QSpinBox {
+ background: white;
+}
+
+#gb1 * {
+}
+
+#gb2 * {
+ border: 1px solid blue;
+}
+
+#gb3 * {
+ border: 0px solid blue;
+}
+
+#gb4 * {
+ border-image: url(&quot;images/pushbutton.png&quot;) 6 6 6 6;
+ border-width:6px;
+}
+</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="gb1">
+ <property name="title">
+ <string>No border</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QFrame" name="frame">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QPushButton" name="pushButton_4">
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox_2"/>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="radioButton_6">
+ <property name="text">
+ <string>RadioButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBox_4">
+ <property name="text">
+ <string>CheckBox</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit">
+ <property name="text">
+ <string>LineEdit</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBox">
+ <item>
+ <property name="text">
+ <string>ComboBox</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="listWidget_2">
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="gb3">
+ <property name="title">
+ <string>0px border</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QFrame" name="frame_2">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QPushButton" name="pushButton_5">
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox_3"/>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="radioButton_7">
+ <property name="text">
+ <string>RadioButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBox_5">
+ <property name="text">
+ <string>CheckBox</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit_2">
+ <property name="text">
+ <string>LineEdit</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBox_2">
+ <item>
+ <property name="text">
+ <string>ComboBox</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="listWidget_3">
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QGroupBox" name="gb4">
+ <property name="title">
+ <string>border-image</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QFrame" name="frame_4">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QPushButton" name="pushButton_7">
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox_5"/>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="radioButton_9">
+ <property name="text">
+ <string>RadioButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBox_7">
+ <property name="text">
+ <string>CheckBox</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit_4">
+ <property name="text">
+ <string>LineEdit</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBox_4">
+ <item>
+ <property name="text">
+ <string>ComboBox</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="listWidget_5">
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QGroupBox" name="gb2">
+ <property name="title">
+ <string>1px border</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QFrame" name="frame_3">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QPushButton" name="pushButton_6">
+ <property name="text">
+ <string>PushButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox_4"/>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="radioButton_8">
+ <property name="text">
+ <string>RadioButton</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBox_6">
+ <property name="text">
+ <string>CheckBox</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit_3">
+ <property name="text">
+ <string>LineEdit</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBox_3">
+ <item>
+ <property name="text">
+ <string>ComboBox</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="listWidget_4">
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>698</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>File</string>
+ </property>
+ <addaction name="actionOpen"/>
+ <addaction name="actionClose"/>
+ </widget>
+ <widget class="QMenu" name="menuEdit">
+ <property name="title">
+ <string>Edit</string>
+ </property>
+ </widget>
+ <addaction name="menuFile"/>
+ <addaction name="menuEdit"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="actionOpen">
+ <property name="text">
+ <string>Open</string>
+ </property>
+ </action>
+ <action name="actionClose">
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </action>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/benchmarks/qscriptengine/qscriptengine.pro b/tests/benchmarks/qscriptengine/qscriptengine.pro
new file mode 100644
index 0000000..22bbccd
--- /dev/null
+++ b/tests/benchmarks/qscriptengine/qscriptengine.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qscriptengine
+
+SOURCES += tst_qscriptengine.cpp
+
+QT += script
diff --git a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp
new file mode 100644
index 0000000..81dedfa
--- /dev/null
+++ b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp
@@ -0,0 +1,229 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtScript>
+
+//TESTED_FILES=
+
+class tst_QScriptEngine : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QScriptEngine();
+ virtual ~tst_QScriptEngine();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void constructor();
+ void evaluate_data();
+ void evaluate();
+ void connectAndDisconnect();
+ void newObject();
+ void newQObject();
+ void newFunction();
+ void newVariant();
+ void collectGarbage();
+ void pushAndPopContext();
+ void toStringHandle();
+ void castValueToQreal();
+};
+
+tst_QScriptEngine::tst_QScriptEngine()
+{
+}
+
+tst_QScriptEngine::~tst_QScriptEngine()
+{
+}
+
+void tst_QScriptEngine::init()
+{
+}
+
+void tst_QScriptEngine::cleanup()
+{
+}
+
+void tst_QScriptEngine::constructor()
+{
+ QBENCHMARK {
+ QScriptEngine engine;
+ (void)engine.parent();
+ }
+}
+
+void tst_QScriptEngine::evaluate_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::newRow("empty script") << QString::fromLatin1("");
+ QTest::newRow("number literal") << QString::fromLatin1("123");
+ QTest::newRow("string literal") << QString::fromLatin1("'ciao'");
+ QTest::newRow("regexp literal") << QString::fromLatin1("/foo/gim");
+ QTest::newRow("null literal") << QString::fromLatin1("null");
+ QTest::newRow("undefined literal") << QString::fromLatin1("undefined");
+ QTest::newRow("null literal") << QString::fromLatin1("null");
+ QTest::newRow("empty object literal") << QString::fromLatin1("{}");
+ QTest::newRow("this") << QString::fromLatin1("this");
+ QTest::newRow("object literal with one property") << QString::fromLatin1("{ foo: 123 }");
+ QTest::newRow("object literal with two properties") << QString::fromLatin1("{ foo: 123, bar: 456 }");
+ QTest::newRow("object literal with many properties") << QString::fromLatin1("{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10 }");
+ QTest::newRow("empty array literal") << QString::fromLatin1("[]");
+ QTest::newRow("array literal with one element") << QString::fromLatin1("[1]");
+ QTest::newRow("array literal with two elements") << QString::fromLatin1("[1,2]");
+ QTest::newRow("array literal with many elements") << QString::fromLatin1("[1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1]");
+ QTest::newRow("empty function definition") << QString::fromLatin1("function foo() { }");
+ QTest::newRow("function definition") << QString::fromLatin1("function foo() { return 123; }");
+ QTest::newRow("for loop with empty body (1000 iterations)") << QString::fromLatin1("for (i = 0; i < 1000; ++i) {}");
+ QTest::newRow("for loop with empty body (10000 iterations)") << QString::fromLatin1("for (i = 0; i < 10000; ++i) {}");
+ QTest::newRow("for loop with empty body (100000 iterations)") << QString::fromLatin1("for (i = 0; i < 100000; ++i) {}");
+ QTest::newRow("for loop with empty body (1000000 iterations)") << QString::fromLatin1("for (i = 0; i < 1000000; ++i) {}");
+ QTest::newRow("for loop (1000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 1000; ++i) { j += i; }; j");
+ QTest::newRow("for loop (10000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 10000; ++i) { j += i; }; j");
+ QTest::newRow("for loop (100000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 100000; ++i) { j += i; }; j");
+ QTest::newRow("for loop (1000000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 1000000; ++i) { j += i; }; j");
+ QTest::newRow("assignments") << QString::fromLatin1("a = 1; b = 2; c = 3; d = 4");
+ QTest::newRow("while loop (1000 iterations)") << QString::fromLatin1("i = 0; while (i < 1000) { ++i; }; i");
+ QTest::newRow("while loop (10000 iterations)") << QString::fromLatin1("i = 0; while (i < 10000) { ++i; }; i");
+ QTest::newRow("while loop (100000 iterations)") << QString::fromLatin1("i = 0; while (i < 100000) { ++i; }; i");
+ QTest::newRow("while loop (1000000 iterations)") << QString::fromLatin1("i = 0; while (i < 1000000) { ++i; }; i");
+ QTest::newRow("function expression") << QString::fromLatin1("(function(a, b, c){ return a + b + c; })(1, 2, 3)");
+}
+
+void tst_QScriptEngine::evaluate()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+
+ QBENCHMARK {
+ (void)engine.evaluate(code);
+ }
+}
+
+void tst_QScriptEngine::connectAndDisconnect()
+{
+ QScriptEngine engine;
+ QScriptValue fun = engine.evaluate("(function() { })");
+ QBENCHMARK {
+ qScriptConnect(&engine, SIGNAL(destroyed()), QScriptValue(), fun);
+ qScriptDisconnect(&engine, SIGNAL(destroyed()), QScriptValue(), fun);
+ }
+}
+
+void tst_QScriptEngine::newObject()
+{
+ QScriptEngine engine;
+ QBENCHMARK {
+ (void)engine.newObject();
+ }
+}
+
+void tst_QScriptEngine::newQObject()
+{
+ QScriptEngine engine;
+ QBENCHMARK {
+ (void)engine.newQObject(QCoreApplication::instance());
+ }
+}
+
+static QScriptValue testFunction(QScriptContext *, QScriptEngine *)
+{
+ return 0;
+}
+
+void tst_QScriptEngine::newFunction()
+{
+ QScriptEngine engine;
+ QBENCHMARK {
+ (void)engine.newFunction(testFunction);
+ }
+}
+
+void tst_QScriptEngine::newVariant()
+{
+ QScriptEngine engine;
+ QVariant var(123);
+ QBENCHMARK {
+ (void)engine.newVariant(var);
+ }
+}
+
+void tst_QScriptEngine::collectGarbage()
+{
+ QScriptEngine engine;
+ QBENCHMARK {
+ engine.collectGarbage();
+ }
+}
+
+void tst_QScriptEngine::pushAndPopContext()
+{
+ QScriptEngine engine;
+ QBENCHMARK {
+ (void)engine.pushContext();
+ engine.popContext();
+ }
+}
+
+void tst_QScriptEngine::toStringHandle()
+{
+ QScriptEngine engine;
+ QString str = QString::fromLatin1("foobarbaz");
+ QBENCHMARK {
+ (void)engine.toStringHandle(str);
+ }
+}
+
+void tst_QScriptEngine::castValueToQreal()
+{
+ QScriptEngine engine;
+ QScriptValue val(123);
+ QBENCHMARK {
+ (void)qscriptvalue_cast<qreal>(val);
+ }
+}
+
+QTEST_MAIN(tst_QScriptEngine)
+#include "tst_qscriptengine.moc"
diff --git a/tests/benchmarks/qscriptvalue/qscriptvalue.pro b/tests/benchmarks/qscriptvalue/qscriptvalue.pro
new file mode 100644
index 0000000..04ea324
--- /dev/null
+++ b/tests/benchmarks/qscriptvalue/qscriptvalue.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qscriptvalue
+
+SOURCES += tst_qscriptvalue.cpp
+
+QT += script
diff --git a/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp b/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp
new file mode 100644
index 0000000..904674e
--- /dev/null
+++ b/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp
@@ -0,0 +1,193 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtScript>
+
+//TESTED_FILES=
+
+class tst_QScriptValue : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QScriptValue();
+ virtual ~tst_QScriptValue();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void numberConstructor();
+ void stringConstructor();
+ void call_data();
+ void call();
+ void construct_data();
+ void construct();
+ void toString_data();
+ void toString();
+ void toQObject();
+ void property();
+ void setProperty();
+};
+
+tst_QScriptValue::tst_QScriptValue()
+{
+}
+
+tst_QScriptValue::~tst_QScriptValue()
+{
+}
+
+void tst_QScriptValue::init()
+{
+}
+
+void tst_QScriptValue::cleanup()
+{
+}
+
+void tst_QScriptValue::numberConstructor()
+{
+ QBENCHMARK {
+ (void)QScriptValue(123);
+ }
+}
+
+void tst_QScriptValue::stringConstructor()
+{
+ QString str = QString::fromLatin1("ciao");
+ QBENCHMARK {
+ (void)QScriptValue(str);
+ }
+}
+
+void tst_QScriptValue::call_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::newRow("empty function") << QString::fromLatin1("(function(){})");
+ QTest::newRow("function returning number") << QString::fromLatin1("(function(){ return 123; })");
+ QTest::newRow("closure") << QString::fromLatin1("(function(a, b){ return function() { return a + b; }; })(1, 2)");
+}
+
+void tst_QScriptValue::call()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+ QScriptValue fun = engine.evaluate(code);
+ QVERIFY(fun.isFunction());
+ QBENCHMARK {
+ (void)fun.call();
+ }
+}
+
+void tst_QScriptValue::construct_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::newRow("empty function") << QString::fromLatin1("(function(){})");
+ QTest::newRow("simple constructor") << QString::fromLatin1("(function(){ this.x = 10; this.y = 20; })");
+}
+
+void tst_QScriptValue::construct()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+ QScriptValue fun = engine.evaluate(code);
+ QVERIFY(fun.isFunction());
+ QBENCHMARK {
+ (void)fun.construct();
+ }
+}
+
+void tst_QScriptValue::toString_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::newRow("number") << QString::fromLatin1("123");
+ QTest::newRow("string") << QString::fromLatin1("'ciao'");
+ QTest::newRow("null") << QString::fromLatin1("null");
+ QTest::newRow("undefined") << QString::fromLatin1("undefined");
+ QTest::newRow("function") << QString::fromLatin1("(function foo(a, b, c) { return a + b + c; })");
+}
+
+void tst_QScriptValue::toString()
+{
+ QFETCH(QString, code);
+ QScriptEngine engine;
+ QScriptValue val = engine.evaluate(code);
+ QBENCHMARK {
+ (void)val.toString();
+ }
+}
+
+void tst_QScriptValue::toQObject()
+{
+ QScriptEngine engine;
+ QScriptValue obj = engine.newQObject(QCoreApplication::instance());
+ QBENCHMARK {
+ (void)obj.toQObject();
+ }
+}
+
+void tst_QScriptValue::property()
+{
+ QScriptEngine engine;
+ QScriptValue obj = engine.newObject();
+ QString propertyName = QString::fromLatin1("foo");
+ obj.setProperty(propertyName, 123);
+ QBENCHMARK {
+ (void)obj.property(propertyName);
+ }
+}
+
+void tst_QScriptValue::setProperty()
+{
+ QScriptEngine engine;
+ QScriptValue obj = engine.newObject();
+ QString propertyName = QString::fromLatin1("foo");
+ QScriptValue val(123);
+ QBENCHMARK {
+ obj.setProperty(propertyName, val);
+ }
+}
+
+QTEST_MAIN(tst_QScriptValue)
+#include "tst_qscriptvalue.moc"