summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-07-05 08:32:25 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-07-05 08:32:25 (GMT)
commit42318a57e95a875b2168ca027679d9258fcc929b (patch)
tree88217a1a9df26fc0ec7f4af83607c727c9944b38 /tests
parent09f07b98dfdaec2e48749768b967a48e588d3f7f (diff)
parent739d4460d28d0ebcde4e5960f533c2a7554049f6 (diff)
downloadQt-42318a57e95a875b2168ca027679d9258fcc929b.zip
Qt-42318a57e95a875b2168ca027679d9258fcc929b.tar.gz
Qt-42318a57e95a875b2168ca027679d9258fcc929b.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp46
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart-arm.pngbin0 -> 12596 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/heart200-arm.pngbin0 -> 8063 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp16
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importFile.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/importFile.qml3
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp1
-rw-r--r--tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/alignments.qml6
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp5
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/alignments.qml2
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp41
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/halign_center.pngbin0 -> 293 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/halign_left.pngbin0 -> 291 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/halign_right.pngbin0 -> 292 bytes
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml22
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp56
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp16
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/basic.qml2
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/elements.qml2
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/javaScript.qml2
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/loadError.qml2
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/newwindows.qml2
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml2
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/sethtml.qml2
-rw-r--r--tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp2
-rw-r--r--tests/auto/moc/tst_moc.cpp19
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp54
-rw-r--r--tests/auto/qimage/tst_qimage.cpp4
-rw-r--r--tests/auto/qmenubar/tst_qmenubar.cpp29
-rw-r--r--tests/auto/qmetaobject/tst_qmetaobject.cpp2
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp16
-rw-r--r--tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gifbin0 -> 4138 bytes
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp61
-rw-r--r--tests/benchmarks/gui/text/qtext/main.cpp41
-rw-r--r--tests/benchmarks/opengl/main.cpp51
-rw-r--r--tests/manual/qtabletevent/regular_widgets/main.cpp150
-rw-r--r--tests/manual/qtabletevent/regular_widgets/regular_widgets.pro3
45 files changed, 590 insertions, 90 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index a965ef3..3e80c2c 100644
--- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -310,7 +310,7 @@ void tst_qdeclarativeanimations::badTypes()
c.create();
QVERIFY(c.errors().count() == 1);
- QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: double expected"));
+ QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: number expected"));
}
//make sure we get a compiler error
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml
index db7f2b5..2c79729 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml
@@ -7,7 +7,7 @@ MyTypeObject {
uintProperty: if(1) 10
intProperty: if(1) -19
realProperty: if(1) 23.2
- doubleProperty: if(1) -19.7
+ doubleProperty: if(1) -19.75
floatProperty: if(1) 8.5
colorProperty: if(1) "red"
dateProperty: if(1) "1982-11-25"
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml
index 72ae865..1cd78a5 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml
@@ -9,7 +9,7 @@ MyTypeObject {
uintProperty = 10
intProperty = -19
realProperty = 23.2
- doubleProperty = -19.7
+ doubleProperty = -19.75
floatProperty = 8.5
colorProperty = "red"
dateProperty = "1982-11-25"
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index 849879e..19bfd37 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -572,7 +572,7 @@ public:
Q_INVOKABLE void method_NoArgs() { invoke(0); }
Q_INVOKABLE int method_NoArgs_int() { invoke(1); return 6; }
- Q_INVOKABLE qreal method_NoArgs_real() { invoke(2); return 19.7; }
+ Q_INVOKABLE qreal method_NoArgs_real() { invoke(2); return 19.75; }
Q_INVOKABLE QPointF method_NoArgs_QPointF() { invoke(3); return QPointF(123, 4.5); }
Q_INVOKABLE QObject *method_NoArgs_QObject() { invoke(4); return this; }
Q_INVOKABLE MyInvokableObject *method_NoArgs_unknown() { invoke(5); return this; }
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 43900ae..a6d2dac 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -179,7 +179,7 @@ void tst_qdeclarativeecmascript::assignBasicTypes()
QCOMPARE(object->uintProperty(), uint(10));
QCOMPARE(object->intProperty(), -19);
QCOMPARE((float)object->realProperty(), float(23.2));
- QCOMPARE((float)object->doubleProperty(), float(-19.7));
+ QCOMPARE((float)object->doubleProperty(), float(-19.75));
QCOMPARE((float)object->floatProperty(), float(8.5));
QCOMPARE(object->colorProperty(), QColor("red"));
QCOMPARE(object->dateProperty(), QDate(1982, 11, 25));
@@ -207,7 +207,7 @@ void tst_qdeclarativeecmascript::assignBasicTypes()
QCOMPARE(object->uintProperty(), uint(10));
QCOMPARE(object->intProperty(), -19);
QCOMPARE((float)object->realProperty(), float(23.2));
- QCOMPARE((float)object->doubleProperty(), float(-19.7));
+ QCOMPARE((float)object->doubleProperty(), float(-19.75));
QCOMPARE((float)object->floatProperty(), float(8.5));
QCOMPARE(object->colorProperty(), QColor("red"));
QCOMPARE(object->dateProperty(), QDate(1982, 11, 25));
@@ -280,8 +280,8 @@ void tst_qdeclarativeecmascript::signalAssignment()
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->string(), QString());
- emit object->argumentSignal(19, "Hello world!", 10.3);
- QCOMPARE(object->string(), QString("pass 19 Hello world! 10.3"));
+ emit object->argumentSignal(19, "Hello world!", 10.25);
+ QCOMPARE(object->string(), QString("pass 19 Hello world! 10.25"));
}
}
@@ -1387,7 +1387,7 @@ void tst_qdeclarativeecmascript::callQtInvokables()
QCOMPARE(o.actuals().count(), 0);
o.reset();
- QVERIFY(engine->evaluate("object.method_NoArgs_real()").strictlyEquals(QScriptValue(engine, 19.7)));
+ QVERIFY(engine->evaluate("object.method_NoArgs_real()").strictlyEquals(QScriptValue(engine, 19.75)));
QCOMPARE(o.error(), false);
QCOMPARE(o.invoked(), 2);
QCOMPARE(o.actuals().count(), 0);
@@ -1818,7 +1818,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
QVERIFY(object != 0);
QCOMPARE(object->property("test").toBool(), false);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toBool(), true);
delete object;
@@ -1831,7 +1831,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
QVERIFY(object != 0);
QCOMPARE(object->property("test").toBool(), false);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toBool(), true);
delete object;
@@ -1844,7 +1844,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
QVERIFY(object != 0);
QCOMPARE(object->property("test").toBool(), false);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toBool(), true);
delete object;
@@ -1857,7 +1857,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
QVERIFY(object != 0);
QCOMPARE(object->methodCalled(), false);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->methodCalled(), true);
delete object;
@@ -1870,7 +1870,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
QVERIFY(object != 0);
QCOMPARE(object->methodCalled(), false);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->methodCalled(), true);
delete object;
@@ -1883,7 +1883,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
QVERIFY(object != 0);
QCOMPARE(object->property("test").toInt(), 0);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 2);
delete object;
@@ -1899,13 +1899,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect()
QVERIFY(object != 0);
QCOMPARE(object->property("test").toInt(), 0);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 1);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 2);
emit object->basicSignal();
QCOMPARE(object->property("test").toInt(), 2);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 2);
delete object;
@@ -1918,13 +1918,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect()
QVERIFY(object != 0);
QCOMPARE(object->property("test").toInt(), 0);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 1);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 2);
emit object->basicSignal();
QCOMPARE(object->property("test").toInt(), 2);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 2);
delete object;
@@ -1937,13 +1937,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect()
QVERIFY(object != 0);
QCOMPARE(object->property("test").toInt(), 0);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 1);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 2);
emit object->basicSignal();
QCOMPARE(object->property("test").toInt(), 2);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 3);
delete object;
@@ -1955,13 +1955,13 @@ void tst_qdeclarativeecmascript::scriptDisconnect()
QVERIFY(object != 0);
QCOMPARE(object->property("test").toInt(), 0);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 1);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 2);
emit object->basicSignal();
QCOMPARE(object->property("test").toInt(), 2);
- emit object->argumentSignal(19, "Hello world!", 10.3);
+ emit object->argumentSignal(19, "Hello world!", 10.25);
QCOMPARE(object->property("test").toInt(), 3);
delete object;
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png b/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png
new file mode 100644
index 0000000..3245027
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeimage/data/heart-arm.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png b/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png
new file mode 100644
index 0000000..b16db76
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeimage/data/heart200-arm.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index c09f7fc..df029f5 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -124,8 +124,8 @@ void tst_qdeclarativeimage::noSource()
void tst_qdeclarativeimage::imageSource_data()
{
QTest::addColumn<QString>("source");
- QTest::addColumn<qreal>("width");
- QTest::addColumn<qreal>("height");
+ QTest::addColumn<double>("width");
+ QTest::addColumn<double>("height");
QTest::addColumn<bool>("remote");
QTest::addColumn<bool>("async");
QTest::addColumn<QString>("error");
@@ -146,8 +146,8 @@ void tst_qdeclarativeimage::imageSource_data()
void tst_qdeclarativeimage::imageSource()
{
QFETCH(QString, source);
- QFETCH(qreal, width);
- QFETCH(qreal, height);
+ QFETCH(double, width);
+ QFETCH(double, height);
QFETCH(bool, remote);
QFETCH(bool, async);
QFETCH(QString, error);
@@ -178,8 +178,8 @@ void tst_qdeclarativeimage::imageSource()
if (error.isEmpty()) {
TRY_WAIT(obj->status() == QDeclarativeImage::Ready);
- QCOMPARE(obj->width(), width);
- QCOMPARE(obj->height(), height);
+ QCOMPARE(obj->width(), qreal(width));
+ QCOMPARE(obj->height(), qreal(height));
QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch);
QCOMPARE(obj->progress(), 1.0);
} else {
@@ -307,6 +307,8 @@ void tst_qdeclarativeimage::svg()
QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-mac.png"));
#elif defined(Q_OS_WIN32)
QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-win32.png"));
+#elif defined(QT_ARCH_ARM)
+ QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart-arm.png"));
#else
QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart.png"));
#endif
@@ -321,6 +323,8 @@ void tst_qdeclarativeimage::svg()
QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-mac.png"));
#elif defined(Q_OS_WIN32)
QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-win32.png"));
+#elif defined(QT_ARCH_ARM)
+ QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200-arm.png"));
#else
QCOMPARE(obj->pixmap(), QPixmap(SRCDIR "/data/heart200.png"));
#endif
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importFile.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importFile.errors.txt
new file mode 100644
index 0000000..3fdac09
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importFile.errors.txt
@@ -0,0 +1 @@
+1:1:"MyComponent.qml": no such directory
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importFile.qml b/tests/auto/declarative/qdeclarativelanguage/data/importFile.qml
new file mode 100644
index 0000000..a0d8410
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/importFile.qml
@@ -0,0 +1,3 @@
+import "MyComponent.qml" 1.0
+
+MyComponent { text: "Hello" }
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt
index 886da55..6e11786 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt
@@ -1,2 +1,2 @@
4:5:Unable to create type NestedErrorsType
-4:8:Invalid property assignment: double expected
+4:8:Invalid property assignment: number expected
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt
index d0a0b00..d2b8c54 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt
@@ -1 +1 @@
-3:19:Invalid property assignment: double expected
+3:19:Invalid property assignment: number expected
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 3ce356e..cde25d7 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -289,6 +289,7 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("importNonExistOlder (installed)") << "importNonExistOlder.qml" << "importNonExistOlder.errors.txt" << false;
QTest::newRow("importNewerVersion (installed)") << "importNewerVersion.qml" << "importNewerVersion.errors.txt" << false;
QTest::newRow("invalidImportID") << "invalidImportID.qml" << "invalidImportID.errors.txt" << false;
+ QTest::newRow("importFile") << "importFile.qml" << "importFile.errors.txt" << false;
QTest::newRow("signal.1") << "signal.1.qml" << "signal.1.errors.txt" << false;
QTest::newRow("signal.2") << "signal.2.qml" << "signal.2.errors.txt" << false;
diff --git a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp
index 8964f8a..b06ad7c 100644
--- a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp
+++ b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp
@@ -124,6 +124,7 @@ QML_DECLARE_TYPE(ValueInterceptorTestType);
{ \
cpptype v = (value); cpptype v2 = (value); \
QVERIFY(QDeclarativeMetaType::copy(QMetaType:: metatype, &v, 0)); \
+ QCOMPARE((cpptype)(v),(cpptype)(defaultvalue)); \
QVERIFY(v == (defaultvalue)); \
QVERIFY(QDeclarativeMetaType::copy(QMetaType:: metatype, &v, &v2)); \
QVERIFY(v == (value)); \
@@ -273,7 +274,7 @@ void tst_qdeclarativemetatype::copy()
QWidget widgetValue;
COPY_TEST(QObject *, QObjectStar, &objectValue, 0);
COPY_TEST(QWidget *, QWidgetStar, &widgetValue, 0);
- COPY_TEST(qreal, QReal, 10.2, 0);
+ COPY_TEST(qreal, QReal, 10.5, 0);
{
QVariant tv = QVariant::fromValue(QVariant(10));
diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments.qml b/tests/auto/declarative/qdeclarativetext/data/alignments.qml
index b1f701b..762e2b6 100644
--- a/tests/auto/declarative/qdeclarativetext/data/alignments.qml
+++ b/tests/auto/declarative/qdeclarativetext/data/alignments.qml
@@ -20,9 +20,9 @@ Rectangle {
id: t
anchors.fill: parent
- horizontalAlignment: TextEdit.AlignRight
- verticalAlignment: TextEdit.AlignBottom
- wrapMode: TextEdit.WordWrap
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignBottom
+ wrapMode: Text.WordWrap
text: top.txt
}
Timer {
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 8a4f152..80198eb 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -48,6 +48,7 @@
#include <QGraphicsSceneMouseEvent>
#include <qmath.h>
#include <QDeclarativeView>
+#include <private/qapplication_p.h>
#include "../../../shared/util.h"
#include "testhttpserver.h"
@@ -452,7 +453,9 @@ void tst_qdeclarativetext::alignments()
#ifdef Q_WS_X11
// Font-specific, but not likely platform-specific, so only test on one platform
- QCOMPARE(actual,expect);
+ if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") {
+ QCOMPARE(actual,expect);
+ }
#endif
}
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml
index b1f701b..9281a06 100644
--- a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml
+++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml
@@ -16,7 +16,7 @@ Rectangle {
height: 40
color: "green"
- Text {
+ TextEdit {
id: t
anchors.fill: parent
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index f1a367f..65d45b1 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -53,8 +53,10 @@
#include <private/qdeclarativetextedit_p_p.h>
#include <QFontMetrics>
#include <QDeclarativeView>
+#include <QDir>
#include <QStyle>
#include <QInputContext>
+#include <private/qapplication_p.h>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -305,17 +307,17 @@ void tst_qdeclarativetextedit::alignments_data()
QTest::addColumn<int>("vAlign");
QTest::addColumn<QString>("expectfile");
- QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << SRCDIR "/data/alignments_lt.png";
- QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << SRCDIR "/data/alignments_rt.png";
- QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << SRCDIR "/data/alignments_ct.png";
+ QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << "alignments_lt";
+ QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << "alignments_rt";
+ QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << "alignments_ct";
- QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_lb.png";
- QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_rb.png";
- QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_cb.png";
+ QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << "alignments_lb";
+ QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << "alignments_rb";
+ QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << "alignments_cb";
- QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_lc.png";
- QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_rc.png";
- QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_cc.png";
+ QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << "alignments_lc";
+ QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << "alignments_rc";
+ QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << "alignments_cc";
}
@@ -325,13 +327,6 @@ void tst_qdeclarativetextedit::alignments()
QFETCH(int, vAlign);
QFETCH(QString, expectfile);
-#ifdef Q_WS_X11
- // Font-specific, but not likely platform-specific, so only test on one platform
- QFont fn;
- fn.setRawName("-misc-fixed-medium-r-*-*-8-*-*-*-*-*-*-*");
- QApplication::setFont(fn);
-#endif
-
QDeclarativeView *canvas = createView(SRCDIR "/data/alignments.qml");
canvas->show();
@@ -349,12 +344,20 @@ void tst_qdeclarativetextedit::alignments()
QPainter p(&actual);
canvas->render(&p);
+ // XXX This will be replaced by some clever persistent platform image store.
+ QString persistent_dir = SRCDIR "/data";
+ QString arch = "unknown-architecture"; // QTest needs to help with this.
+
+ expectfile = persistent_dir + QDir::separator() + expectfile + "-" + arch + ".png";
+
+ if (!QFile::exists(expectfile)) {
+ actual.save(expectfile);
+ qWarning() << "created" << expectfile;
+ }
+
QImage expect(expectfile);
-#ifdef Q_WS_X11
- // Font-specific, but not likely platform-specific, so only test on one platform
QCOMPARE(actual,expect);
-#endif
}
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/halign_center.png b/tests/auto/declarative/qdeclarativetextinput/data/halign_center.png
new file mode 100644
index 0000000..53e09a8
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextinput/data/halign_center.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/halign_left.png b/tests/auto/declarative/qdeclarativetextinput/data/halign_left.png
new file mode 100644
index 0000000..247acbc
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextinput/data/halign_left.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/halign_right.png b/tests/auto/declarative/qdeclarativetextinput/data/halign_right.png
new file mode 100644
index 0000000..691bc75
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextinput/data/halign_right.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml
new file mode 100644
index 0000000..b97f18e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml
@@ -0,0 +1,22 @@
+import Qt 4.7
+
+Rectangle {
+ id: top
+ width: 70; height: 70;
+
+ property alias horizontalAlignment: text.horizontalAlignment
+ property string text: "Test"
+
+ Rectangle {
+ anchors.centerIn: parent
+ width: 60
+ height: 20
+ color: "green"
+
+ TextInput {
+ id: text
+ anchors.fill: parent
+ text: top.text
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index a55b42e..b6ca7e5 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -49,6 +49,7 @@
#include <QDebug>
#include <QStyle>
#include <QInputContext>
+#include <private/qapplication_p.h>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -63,12 +64,16 @@ public:
tst_qdeclarativetextinput();
private slots:
+
void text();
void width();
void font();
void color();
void selection();
+ void horizontalAlignment_data();
+ void horizontalAlignment();
+
void positionAt();
void maxLength();
@@ -153,7 +158,7 @@ void tst_qdeclarativetextinput::width()
QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create());
QVERIFY(textinputObject != 0);
- QCOMPARE(textinputObject->width(), 1.);//1 for the cursor
+ QCOMPARE(textinputObject->width(), 1.); // 1 for the cursor
delete textinputObject;
}
@@ -170,7 +175,8 @@ void tst_qdeclarativetextinput::width()
QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create());
QVERIFY(textinputObject != 0);
- QCOMPARE(textinputObject->width(), qreal(metricWidth) + 1.);//1 for the cursor
+ int delta = abs(int(textinputObject->width()) - metricWidth);
+ QVERIFY(delta <= 3.0); // As best as we can hope for cross-platform.
delete textinputObject;
}
@@ -370,6 +376,52 @@ void tst_qdeclarativetextinput::selection()
delete textinputObject;
}
+void tst_qdeclarativetextinput::horizontalAlignment_data()
+{
+ QTest::addColumn<int>("hAlign");
+ QTest::addColumn<QString>("expectfile");
+
+ QTest::newRow("L") << int(Qt::AlignLeft) << SRCDIR "/data/halign_left.png";
+ QTest::newRow("R") << int(Qt::AlignRight) << SRCDIR "/data/halign_right.png";
+ QTest::newRow("C") << int(Qt::AlignHCenter) << SRCDIR "/data/halign_center.png";
+}
+
+void tst_qdeclarativetextinput::horizontalAlignment()
+{
+ QFETCH(int, hAlign);
+ QFETCH(QString, expectfile);
+
+#ifdef Q_WS_X11
+ // Font-specific, but not likely platform-specific, so only test on one platform
+ QFont fn;
+ fn.setRawName("-misc-fixed-medium-r-*-*-8-*-*-*-*-*-*-*");
+ QApplication::setFont(fn);
+#endif
+
+ QDeclarativeView *canvas = createView(SRCDIR "/data/horizontalAlignment.qml");
+
+ canvas->show();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+ QObject *ob = canvas->rootObject();
+ QVERIFY(ob != 0);
+ ob->setProperty("horizontalAlignment",hAlign);
+ QImage actual(canvas->width(), canvas->height(), QImage::Format_RGB32);
+ actual.fill(qRgb(255,255,255));
+ QPainter p(&actual);
+ canvas->render(&p);
+
+ QImage expect(expectfile);
+
+#ifdef Q_WS_X11
+ // Font-specific, but not likely platform-specific, so only test on one platform
+ if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") {
+ QCOMPARE(actual,expect);
+ }
+#endif
+}
+
void tst_qdeclarativetextinput::positionAt()
{
QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml");
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
index 81334f2..a4819f3 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
+++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
@@ -141,8 +141,8 @@ void tst_qdeclarativevaluetypes::pointf()
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
- QCOMPARE(object->property("p_x").toDouble(), 11.3);
- QCOMPARE(object->property("p_y").toDouble(), -10.9);
+ QCOMPARE(float(object->property("p_x").toDouble()), float(11.3));
+ QCOMPARE(float(object->property("p_y").toDouble()), float(-10.9));
QCOMPARE(object->property("copy"), QVariant(QPointF(11.3, -10.9)));
delete object;
@@ -191,8 +191,8 @@ void tst_qdeclarativevaluetypes::sizef()
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
- QCOMPARE(object->property("s_width").toDouble(), 0.1);
- QCOMPARE(object->property("s_height").toDouble(), 100923.2);
+ QCOMPARE(float(object->property("s_width").toDouble()), float(0.1));
+ QCOMPARE(float(object->property("s_height").toDouble()), float(100923.2));
QCOMPARE(object->property("copy"), QVariant(QSizeF(0.1, 100923.2)));
delete object;
@@ -287,10 +287,10 @@ void tst_qdeclarativevaluetypes::rectf()
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
- QCOMPARE(object->property("r_x").toDouble(), 103.8);
- QCOMPARE(object->property("r_y").toDouble(), 99.2);
- QCOMPARE(object->property("r_width").toDouble(), 88.1);
- QCOMPARE(object->property("r_height").toDouble(), 77.6);
+ QCOMPARE(float(object->property("r_x").toDouble()), float(103.8));
+ QCOMPARE(float(object->property("r_y").toDouble()), float(99.2));
+ QCOMPARE(float(object->property("r_width").toDouble()), float(88.1));
+ QCOMPARE(float(object->property("r_height").toDouble()), float(77.6));
QCOMPARE(object->property("copy"), QVariant(QRectF(103.8, 99.2, 88.1, 77.6)));
delete object;
diff --git a/tests/auto/declarative/qdeclarativewebview/data/basic.qml b/tests/auto/declarative/qdeclarativewebview/data/basic.qml
index a5a8d34..ff5d3fd 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/basic.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/basic.qml
@@ -1,5 +1,5 @@
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
WebView {
url: "basic.html"
diff --git a/tests/auto/declarative/qdeclarativewebview/data/elements.qml b/tests/auto/declarative/qdeclarativewebview/data/elements.qml
index 5af76ed..3adfff8 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/elements.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/elements.qml
@@ -1,5 +1,5 @@
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
WebView {
url: "elements.html"
diff --git a/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml
index 4141166..9f07a51 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml
@@ -1,5 +1,5 @@
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
WebView {
url: "javaScript.html"
diff --git a/tests/auto/declarative/qdeclarativewebview/data/loadError.qml b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml
index 2061b5f..a0cc4c8 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/loadError.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml
@@ -1,5 +1,5 @@
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
WebView {
url: "does-not-exist.html"
diff --git a/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml
index d066c07..e5967b5 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml
@@ -1,7 +1,7 @@
// Demonstrates opening new WebViews from HTML
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
Grid {
columns: 3
diff --git a/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml
index 45684ff..569f4a5 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml
@@ -1,5 +1,5 @@
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
Item {
width: 240
diff --git a/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml
index b14bcf9..1edd436 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml
+++ b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml
@@ -1,5 +1,5 @@
import Qt 4.7
-import org.webkit 1.0
+import QtWebKit 1.0
WebView {
html: "<p>This is a <b>string</b> set on the WebView"
diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
index f33e5a4..2bded6b 100644
--- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
+++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
@@ -156,10 +156,8 @@ void tst_qdeclarativewebview::basicProperties()
QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")),QPixmap(SRCDIR "/data/basic.png"));
QCOMPARE(wv->property("statusText").toString(),QString("status here"));
QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString()));
- QCOMPARE(wv->property("width").toDouble(), 123.0);
QCOMPARE(wv->property("preferredWidth").toInt(), 0);
QCOMPARE(wv->property("preferredHeight").toInt(), 0);
- QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0);
QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html"));
QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/);
QVERIFY(qvariant_cast<QAction*>(wv->property("reload")));
@@ -258,9 +256,7 @@ void tst_qdeclarativewebview::historyNav()
QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")),QPixmap(SRCDIR "/data/basic.png"));
QCOMPARE(wv->property("statusText").toString(),QString("status here"));
QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/basic.html")), strippedHtml(wv->property("html").toString()));
- QCOMPARE(wv->property("width").toDouble(), 123.0);
QCOMPARE(wv->property("preferredWidth").toDouble(), 0.0);
- QCOMPARE(wv->property("zoomFactor").toDouble(), 1.0);
QCOMPARE(wv->property("url").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/basic.html"));
QCOMPARE(wv->property("status").toInt(), 1 /*QDeclarativeWebView::Ready*/);
QVERIFY(qvariant_cast<QAction*>(wv->property("reload")));
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
index 8e98874..3140265 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -134,7 +134,7 @@ void tst_QDeclarativeWorkerScript::messaging_data()
QTest::newRow("invalid") << QVariant();
QTest::newRow("bool") << qVariantFromValue(true);
QTest::newRow("int") << qVariantFromValue(1001);
- QTest::newRow("real") << qVariantFromValue(10334.323);
+ QTest::newRow("real") << qVariantFromValue(10334.375);
QTest::newRow("string") << qVariantFromValue(QString("More cheeeese, Gromit!"));
QTest::newRow("variant list") << qVariantFromValue((QVariantList() << "a" << "b" << "c"));
}
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index a56d842..19f3677 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -1322,6 +1322,25 @@ public slots:
void foo(struct const_ *) {};
};
+
+template<typename T1, typename T2>
+class TestTemplate2
+{
+};
+
+class QTBUG11647_constInTemplateParameter : public QObject
+{ Q_OBJECT
+public slots:
+ void testSlot(TestTemplate2<const int, const short*>) {}
+ void testSlot2(TestTemplate2<int, short const * const >) {}
+ void testSlot3(TestTemplate2<TestTemplate2 < const int, const short* > const *,
+ TestTemplate2< TestTemplate2 < void, int > , unsigned char *> > ) {}
+
+signals:
+ void testSignal(TestTemplate2<const int, const short*>);
+};
+
+
QTEST_APPLESS_MAIN(tst_Moc)
#include "tst_moc.moc"
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index fe68c8e..31a6845 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -442,6 +442,7 @@ private slots:
void updateMicroFocus();
void textItem_shortcuts();
void scroll();
+ void stopClickFocusPropagation();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -10268,6 +10269,59 @@ void tst_QGraphicsItem::scroll()
QCOMPARE(item2->lastExposedRect, expectedItem2Expose);
}
+void tst_QGraphicsItem::stopClickFocusPropagation()
+{
+ class MyItem : public QGraphicsRectItem
+ {
+ public:
+ MyItem() : QGraphicsRectItem(0, 0, 100, 100) {}
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+ {
+ painter->fillRect(boundingRect(), hasFocus() ? QBrush(Qt::red) : brush());
+ }
+ };
+
+ QGraphicsScene scene(-50, -50, 400, 400);
+ scene.setStickyFocus(true);
+
+ QGraphicsRectItem *noFocusOnTop = new MyItem;
+ noFocusOnTop->setBrush(Qt::yellow);
+ noFocusOnTop->setFlag(QGraphicsItem::ItemStopsClickFocusPropagation);
+
+ QGraphicsRectItem *focusableUnder = new MyItem;
+ focusableUnder->setBrush(Qt::blue);
+ focusableUnder->setFlag(QGraphicsItem::ItemIsFocusable);
+ focusableUnder->setPos(50, 50);
+
+ QGraphicsRectItem *itemWithFocus = new MyItem;
+ itemWithFocus->setBrush(Qt::black);
+ itemWithFocus->setFlag(QGraphicsItem::ItemIsFocusable);
+ itemWithFocus->setPos(250, 10);
+
+ scene.addItem(noFocusOnTop);
+ scene.addItem(focusableUnder);
+ scene.addItem(itemWithFocus);
+ focusableUnder->stackBefore(noFocusOnTop);
+ itemWithFocus->setFocus();
+
+ QGraphicsView view(&scene);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ QApplication::setActiveWindow(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+ QVERIFY(itemWithFocus->hasFocus());
+
+ QPointF mousePressPoint = noFocusOnTop->mapToScene(QPointF());
+ mousePressPoint.rx() += 60;
+ mousePressPoint.ry() += 60;
+ const QList<QGraphicsItem *> itemsAtMousePressPosition = scene.items(mousePressPoint);
+ QVERIFY(itemsAtMousePressPosition.contains(focusableUnder));
+
+ sendMousePress(&scene, mousePressPoint);
+ QVERIFY(itemWithFocus->hasFocus());
+}
+
void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor()
{
struct Item : public QGraphicsTextItem
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp
index 16deb03..5052114 100644
--- a/tests/auto/qimage/tst_qimage.cpp
+++ b/tests/auto/qimage/tst_qimage.cpp
@@ -945,11 +945,11 @@ void tst_QImage::rotate()
const int n = original.colorTable().size();
for (int x = 0; x < w; ++x) {
original.setPixel(x, 0, x % n);
- original.setPixel(x,h - 1, n - (x % n));
+ original.setPixel(x, h - 1, n - (x % n) - 1);
}
for (int y = 0; y < h; ++y) {
original.setPixel(0, y, y % n);
- original.setPixel(w - 1, y, n - (y % n));
+ original.setPixel(w - 1, y, n - (y % n) - 1);
}
}
diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp
index 4cb63a1..cc9fb0c 100644
--- a/tests/auto/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/qmenubar/tst_qmenubar.cpp
@@ -168,6 +168,7 @@ private slots:
void task256322_highlight();
void menubarSizeHint();
void taskQTBUG4965_escapeEaten();
+ void taskQTBUG11823_crashwithInvisibleActions();
#if defined(QT3_SUPPORT)
void indexBasedInsertion_data();
@@ -1690,6 +1691,34 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten()
QTRY_VERIFY(!menubar.isVisible());
}
+void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions()
+{
+ QMenuBar menubar;
+ menubar.setNativeMenuBar(false); //we can't check the geometry of native menubars
+
+ QAction * m = menubar.addAction( "&m" );
+ QAction * a = menubar.addAction( "&a" );
+
+ menubar.show();
+ QApplication::setActiveWindow(&menubar);
+ QTest::qWaitForWindowShown(&menubar);
+ menubar.setActiveAction(m);
+ QCOMPARE(menubar.activeAction(), m);
+ QTest::keyClick(0, Qt::Key_Right);
+ QCOMPARE(menubar.activeAction(), a);
+ QTest::keyClick(0, Qt::Key_Right);
+ QCOMPARE(menubar.activeAction(), m);
+ a->setVisible(false);
+
+ menubar.setActiveAction(m);
+ QCOMPARE(menubar.activeAction(), m); //the active action shouldn't have changed
+
+ //it used to crash here because the action is invisible
+ QTest::keyClick(0, Qt::Key_Right);
+ QCOMPARE(menubar.activeAction(), m); //the active action shouldn't have changed
+}
+
+
#if defined(QT3_SUPPORT)
void tst_QMenuBar::indexBasedInsertion_data()
{
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp
index b6d4558..62416b1 100644
--- a/tests/auto/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp
@@ -740,6 +740,8 @@ void tst_QMetaObject::normalizedType_data()
QTest::newRow("template5") << "QList< ::Foo::Bar>" << "QList< ::Foo::Bar>";
QTest::newRow("template6") << "QList<::Foo::Bar>" << "QList<::Foo::Bar>";
QTest::newRow("template7") << "QList<QList<int> >" << "QList<QList<int> >";
+ QTest::newRow("template8") << "QMap<const int, const short*>" << "QMap<const int,const short*>";
+ QTest::newRow("template9") << "QPair<const QPair<int, int const *> , QPair<QHash<int, const char*> > >" << "QPair<const QPair<int,const int*>,QPair<QHash<int,const char*> > >";
QTest::newRow("value1") << "const QString &" << "QString";
QTest::newRow("value2") << "QString const &" << "QString";
QTest::newRow("constInName1") << "constconst" << "constconst";
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 701dc2e..27ee6e7 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -2648,12 +2648,16 @@ void tst_QPainter::setOpacity()
p.drawImage(imageRect, src, imageRect);
p.end();
- QImage expected(imageSize, destFormat);
- p.begin(&expected);
- p.fillRect(imageRect, QColor(127, 127, 127));
- p.end();
-
- QCOMPARE(dest, expected);
+ QImage actual = dest.convertToFormat(QImage::Format_RGB32);
+
+ for (int y = 0; y < actual.height(); ++y) {
+ QRgb *p = (QRgb *)actual.scanLine(y);
+ for (int x = 0; x < actual.width(); ++x) {
+ QVERIFY(qAbs(qRed(p[x]) - 127) <= 0xf);
+ QVERIFY(qAbs(qGreen(p[x]) - 127) <= 0xf);
+ QVERIFY(qAbs(qBlue(p[x]) - 127) <= 0xf);
+ }
+ }
}
void tst_QPainter::drawhelper_blend_untransformed_data()
diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif
new file mode 100644
index 0000000..f813c05
--- /dev/null
+++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif
Binary files differ
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 179f068..f22edf6 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -44,6 +44,7 @@
#include <qpixmap.h>
#include <qbitmap.h>
#include <qimage.h>
+#include <qimagereader.h>
#include <qmatrix.h>
#include <qdesktopwidget.h>
#include <qpaintengine.h>
@@ -175,6 +176,11 @@ private slots:
void loadFromDataImage_data();
void loadFromDataImage();
+ void fromImageReader_data();
+ void fromImageReader();
+
+ void fromImageReaderAnimatedGif();
+
void preserveDepth();
void splash_crash();
@@ -1577,6 +1583,61 @@ void tst_QPixmap::loadFromDataImage()
QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap));
}
+void tst_QPixmap::fromImageReader_data()
+{
+ QTest::addColumn<QString>("imagePath");
+#ifdef Q_OS_SYMBIAN
+ const QString prefix = QLatin1String(SRCDIR) + "loadFromData";
+#else
+ const QString prefix = QLatin1String(SRCDIR) + "/loadFromData";
+#endif
+ QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png";
+ QTest::newRow("designer_indexed8_no_alpha.png") << prefix + "/designer_indexed8_no_alpha.png";
+ QTest::newRow("designer_indexed8_with_alpha.png") << prefix + "/designer_indexed8_with_alpha.png";
+ QTest::newRow("designer_rgb32.png") << prefix + "/designer_rgb32.png";
+ QTest::newRow("designer_indexed8_no_alpha.gif") << prefix + "/designer_indexed8_no_alpha.gif";
+ QTest::newRow("designer_indexed8_with_alpha.gif") << prefix + "/designer_indexed8_with_alpha.gif";
+ QTest::newRow("designer_rgb32.jpg") << prefix + "/designer_rgb32.jpg";
+}
+
+void tst_QPixmap::fromImageReader()
+{
+ QFETCH(QString, imagePath);
+
+ QImage imageRef(imagePath);
+ QPixmap pixmapWithCopy = QPixmap::fromImage(imageRef);
+
+ QImageReader imageReader(imagePath);
+
+ QPixmap directLoadingPixmap = QPixmap::fromImageReader(&imageReader);
+
+ QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap));
+}
+
+void tst_QPixmap::fromImageReaderAnimatedGif()
+{
+#ifdef Q_OS_SYMBIAN
+ const QString prefix = QLatin1String(SRCDIR) + "loadFromData";
+#else
+ const QString prefix = QLatin1String(SRCDIR) + "/loadFromData";
+#endif
+ const QString path = prefix + QString::fromLatin1("/designer_indexed8_with_alpha_animated.gif");
+
+ QImageReader referenceReader(path);
+ QImageReader pixmapReader(path);
+
+ Q_ASSERT(referenceReader.canRead());
+ Q_ASSERT(referenceReader.imageCount() > 1);
+
+ for (int i = 0; i < referenceReader.imageCount(); ++i) {
+ QImage refImage = referenceReader.read();
+ QPixmap refPixmap = QPixmap::fromImage(refImage);
+
+ QPixmap directLoadingPixmap = QPixmap::fromImageReader(&pixmapReader);
+ QVERIFY(pixmapsAreEqual(&refPixmap, &directLoadingPixmap));
+ }
+}
+
void tst_QPixmap::task_246446()
{
// This crashed without the bugfix in 246446
diff --git a/tests/benchmarks/gui/text/qtext/main.cpp b/tests/benchmarks/gui/text/qtext/main.cpp
index eaa23e9..63daae0 100644
--- a/tests/benchmarks/gui/text/qtext/main.cpp
+++ b/tests/benchmarks/gui/text/qtext/main.cpp
@@ -84,9 +84,11 @@ private slots:
void newLineReplacement();
void formatManipulation();
+ void fontResolution();
void layout_data();
void layout();
+ void formattedLayout();
void paintLayoutToPixmap();
void paintLayoutToPixmap_painterFill();
@@ -306,6 +308,18 @@ void tst_QText::formatManipulation()
}
}
+void tst_QText::fontResolution()
+{
+ QFont font;
+ QFont font2;
+ font.setFamily("DejaVu");
+ font2.setBold(true);
+
+ QBENCHMARK {
+ QFont res = font.resolve(font2);
+ }
+}
+
void tst_QText::layout_data()
{
QTest::addColumn<bool>("wrap");
@@ -339,6 +353,33 @@ void tst_QText::layout()
}
}*/
+void tst_QText::formattedLayout()
+{
+ //set up formatting
+ QList<QTextLayout::FormatRange> ranges;
+ {
+ QTextCharFormat format;
+ format.setForeground(QColor("steelblue"));
+
+ QTextLayout::FormatRange formatRange;
+ formatRange.format = format;
+ formatRange.start = 0;
+ formatRange.length = 50;
+
+ ranges.append(formatRange);
+ }
+
+ QTextLayout layout(m_shortLorem);
+ layout.setAdditionalFormats(ranges);
+ setupTextLayout(&layout);
+
+ QBENCHMARK {
+ QTextLayout layout(m_shortLorem);
+ layout.setAdditionalFormats(ranges);
+ setupTextLayout(&layout);
+ }
+}
+
void tst_QText::paintLayoutToPixmap()
{
QTextLayout layout(m_shortLorem);
diff --git a/tests/benchmarks/opengl/main.cpp b/tests/benchmarks/opengl/main.cpp
index beb4d43..c042fce 100644
--- a/tests/benchmarks/opengl/main.cpp
+++ b/tests/benchmarks/opengl/main.cpp
@@ -75,6 +75,10 @@ private slots:
void gradients_data();
void gradients();
+ void textureUpload_data();
+ void textureUpload();
+
+
private:
QGLPixelBuffer *pb;
};
@@ -374,6 +378,53 @@ void OpenGLBench::gradients()
}
}
+void OpenGLBench::textureUpload_data()
+{
+ QTest::addColumn<int>("size");
+ QTest::addColumn<int>("flags");
+ QTest::addColumn<int>("format");
+
+ int sizes[] = { 8, 10, 16, 20, 32, 50, 64, 100, 128, 200, 256, 500, 512, 1000, 1024, 2000, 2048, -1 };
+ int flags[] = { QGLContext::InternalBindOption,
+ QGLContext::DefaultBindOption,
+ -1 };
+ int formats[] = { GL_RGB, GL_RGBA, -1 };
+
+ for (int s = 0; sizes[s] != -1; ++s) {
+ for (int f = 0; flags[f] != -1; ++f) {
+ for (int a = 0; formats[a] != -1; ++a) {
+ QByteArray name;
+ name.append("size=").append(QByteArray::number(sizes[s]));
+ name.append(", flags=").append(f == 0 ? "internal" : "default");
+ name.append(", format=").append(a == 0 ? "RGB" : "RGBA");
+ QTest::newRow(name.constData()) << sizes[s] << flags[f] << formats[a];
+ }
+ }
+ }
+}
+
+void OpenGLBench::textureUpload()
+{
+ QFETCH(int, size);
+ QFETCH(int, flags);
+ QFETCH(int, format);
+
+ QPixmap pixmap(size, size);
+
+ if (format == GL_RGB)
+ pixmap.fill(Qt::red);
+ else
+ pixmap.fill(Qt::transparent);
+
+ pb->makeCurrent();
+ QGLContext *context = const_cast<QGLContext *>(QGLContext::currentContext());
+ QTime time;
+
+ time.start();
+ context->bindTexture(pixmap, GL_TEXTURE_2D, format, (QGLContext::BindOptions) flags);
+ QTest::setBenchmarkResult(time.elapsed(), QTest::WalltimeMilliseconds);
+}
+
QTEST_MAIN(OpenGLBench)
#include "main.moc"
diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp
new file mode 100644
index 0000000..a39e094
--- /dev/null
+++ b/tests/manual/qtabletevent/regular_widgets/main.cpp
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the FOO module 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QDebug>
+#include <QMouseEvent>
+#include <QTabletEvent>
+#include <QWidget>
+
+class EventReportWidget : public QWidget
+{
+public:
+ EventReportWidget();
+protected:
+ void mouseDoubleClickEvent(QMouseEvent *event) { outputMouseEvent(event); }
+ void mouseMoveEvent(QMouseEvent *event) { outputMouseEvent(event); }
+ void mousePressEvent(QMouseEvent *event) { outputMouseEvent(event); }
+ void mouseReleaseEvent(QMouseEvent *event) { outputMouseEvent(event); }
+
+ void tabletEvent(QTabletEvent *);
+
+private:
+ void outputMouseEvent(QMouseEvent *event);
+
+ bool m_lastIsMouseMove;
+ bool m_lastIsTabletMove;
+};
+
+EventReportWidget::EventReportWidget()
+ : m_lastIsMouseMove(false)
+ , m_lastIsTabletMove(false)
+{ }
+
+void EventReportWidget::tabletEvent(QTabletEvent *event)
+{
+ QWidget::tabletEvent(event);
+
+ QString type;
+ switch (event->type()) {
+ case QEvent::TabletEnterProximity:
+ m_lastIsTabletMove = false;
+ type = QString::fromLatin1("TabletEnterProximity");
+ break;
+ case QEvent::TabletLeaveProximity:
+ m_lastIsTabletMove = false;
+ type = QString::fromLatin1("TabletLeaveProximity");
+ break;
+ case QEvent::TabletMove:
+ if (m_lastIsTabletMove)
+ return;
+
+ m_lastIsTabletMove = true;
+ type = QString::fromLatin1("TabletMove");
+ break;
+ case QEvent::TabletPress:
+ m_lastIsTabletMove = false;
+ type = QString::fromLatin1("TabletPress");
+ break;
+ case QEvent::TabletRelease:
+ m_lastIsTabletMove = false;
+ type = QString::fromLatin1("TabletRelease");
+ break;
+ default:
+ Q_ASSERT(false);
+ break;
+ }
+
+ qDebug() << "Tablet event, type = " << type
+ << " position = " << event->pos()
+ << " global position = " << event->globalPos();
+}
+
+void EventReportWidget::outputMouseEvent(QMouseEvent *event)
+{
+ QString type;
+ switch (event->type()) {
+ case QEvent::MouseButtonDblClick:
+ m_lastIsMouseMove = false;
+ type = QString::fromLatin1("MouseButtonDblClick");
+ break;
+ case QEvent::MouseButtonPress:
+ m_lastIsMouseMove = false;
+ type = QString::fromLatin1("MouseButtonPress");
+ break;
+ case QEvent::MouseButtonRelease:
+ m_lastIsMouseMove = false;
+ type = QString::fromLatin1("MouseButtonRelease");
+ break;
+ case QEvent::MouseMove:
+ if (m_lastIsMouseMove)
+ return; // only show one move to keep things readable
+
+ m_lastIsMouseMove = true;
+ type = QString::fromLatin1("MouseMove");
+ break;
+ default:
+ Q_ASSERT(false);
+ break;
+ }
+
+ qDebug() << "Mouse event, type = " << type
+ << " position = " << event->pos()
+ << " global position = " << event->globalPos();
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ EventReportWidget widget;
+ widget.show();
+ return app.exec();
+}
diff --git a/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro b/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro
new file mode 100644
index 0000000..9f0da76
--- /dev/null
+++ b/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro
@@ -0,0 +1,3 @@
+TEMPLATE = app
+
+SOURCES += main.cpp