summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-07 04:16:46 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-07 04:16:46 (GMT)
commite429284e7d6f6639d5e07c113c45f400a02a8fa1 (patch)
tree36949f3ebf25dbdd93e68fd4be706c2f5effcc94 /tests/auto
parent19f55bfa5bf15b5593f3021071374dbe2f71f8c8 (diff)
parentb4b1b118015d1dcef63b065a609234a18f332ba4 (diff)
downloadQt-e429284e7d6f6639d5e07c113c45f400a02a8fa1.zip
Qt-e429284e7d6f6639d5e07c113c45f400a02a8fa1.tar.gz
Qt-e429284e7d6f6639d5e07c113c45f400a02a8fa1.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (35 commits) Make Text, TextInput, and TextEdit all have the same size for the same text. More generated images in anticipation of QT-3574 Remove deprecated Flickable.flickDirection Revert "Fix exponential behavior of QTextCursor::removeSelectedText" Prevent a recursive debug output loop when writing to the logger widget. Fix performance of QTextDocumentPrivate::adjustDocumentChangesAndCursors Convert QtDeclarative def files to use LF line endings Update QtDeclarative def files doc improvements Changing currentIndex shouldn't cancel a flick unnecessarily. Fix input methods for TextInput elements with key handlers Document the QML enumeration basic type Fix TextEdit with no color property defined is drawn with wrong color Export QDeclarativePixmap doc Fix inconsistent reporting of module import errors when using versions. Make declarative pixmap cache easier to use Prepare for QTest persistent store for visual tests. Loosen font-sensitive test. Set correct license header. ...
Diffstat (limited to 'tests/auto')
-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/lib/com/nokia/installedtest/qmldir1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/qmldir2
-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.cpp10
-rw-r--r--tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp99
-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.cpp73
-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/data/inputmethods.qml (renamed from tests/auto/declarative/qdeclarativetextinput/data/inputmethodhints.qml)1
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp94
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp16
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp2
31 files changed, 275 insertions, 143 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/lib/com/nokia/installedtest/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir
index 0adb0f6..d15720a 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir
@@ -2,4 +2,3 @@ Rectangle 1.5 InstalledTest2.qml
LocalLast 1.0 LocalLast.qml
InstalledTest 1.4 InstalledTest2.qml
InstalledTest 1.0 InstalledTest.qml
-InstalledTestTP 0.0 InstalledTest.qml
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml
new file mode 100644
index 0000000..303b5a5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml
@@ -0,0 +1,2 @@
+import Qt 4.7 as Qt47
+Qt47.Rectangle {}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml
new file mode 100644
index 0000000..8c953cb
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml
@@ -0,0 +1,2 @@
+import Qt 4.7
+Text {}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/qmldir
new file mode 100644
index 0000000..b301226
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/qmldir
@@ -0,0 +1,2 @@
+InstalledTest 1.4 InstalledTest2.qml
+InstalledTestTP 0.0 InstalledTest.qml
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..fcdf926 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;
@@ -1476,12 +1477,12 @@ void tst_qdeclarativelanguage::importsInstalled_data()
// import installed
QTest::newRow("installed import 0")
- << "import com.nokia.installedtest 0.0\n"
+ << "import com.nokia.installedtest0 0.0\n"
"InstalledTestTP {}"
<< "QDeclarativeRectangle"
<< "";
QTest::newRow("installed import 0 as TP")
- << "import com.nokia.installedtest 0.0 as TP\n"
+ << "import com.nokia.installedtest0 0.0 as TP\n"
"TP.InstalledTestTP {}"
<< "QDeclarativeRectangle"
<< "";
@@ -1500,6 +1501,11 @@ void tst_qdeclarativelanguage::importsInstalled_data()
"InstalledTest {}"
<< "QDeclarativeText"
<< "";
+ QTest::newRow("installed import minor version not available") // QTBUG-11936
+ << "import com.nokia.installedtest 0.1\n"
+ "InstalledTest {}"
+ << ""
+ << "module \"com.nokia.installedtest\" version 0.1 is not installed";
QTest::newRow("installed import minor version not available") // QTBUG-9627
<< "import com.nokia.installedtest 1.10\n"
"InstalledTest {}"
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/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
index f1018b2..0c7780c 100644
--- a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
+++ b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
@@ -138,42 +138,37 @@ void tst_qdeclarativepixmapcache::single()
expectedError = "Cannot open: " + target.toString();
}
- QPixmap pixmap;
+ QDeclarativePixmap pixmap;
QVERIFY(pixmap.width() <= 0); // Check Qt assumption
- QString errorString;
- QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap, &errorString);
+
+ pixmap.load(&engine, target);
if (incache) {
- QCOMPARE(errorString, expectedError);
+ QCOMPARE(pixmap.error(), expectedError);
if (exists) {
- QVERIFY(status == QDeclarativePixmapReply::Ready);
+ QVERIFY(pixmap.status() == QDeclarativePixmap::Ready);
QVERIFY(pixmap.width() > 0);
} else {
- QVERIFY(status == QDeclarativePixmapReply::Error);
+ QVERIFY(pixmap.status() == QDeclarativePixmap::Error);
QVERIFY(pixmap.width() <= 0);
}
} else {
- QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(&engine, target);
- QVERIFY(reply);
QVERIFY(pixmap.width() <= 0);
Slotter getter;
- connect(reply, SIGNAL(finished()), &getter, SLOT(got()));
+ pixmap.connectFinished(&getter, SLOT(got()));
QTestEventLoop::instance().enterLoop(10);
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(getter.gotslot);
- QString errorString;
if (exists) {
- QVERIFY(QDeclarativePixmapCache::get(target, &pixmap, &errorString) == QDeclarativePixmapReply::Ready);
+ QVERIFY(pixmap.status() == QDeclarativePixmap::Ready);
QVERIFY(pixmap.width() > 0);
} else {
- QVERIFY(QDeclarativePixmapCache::get(target, &pixmap, &errorString) == QDeclarativePixmapReply::Error);
+ QVERIFY(pixmap.status() == QDeclarativePixmap::Error);
QVERIFY(pixmap.width() <= 0);
}
- QCOMPARE(errorString, expectedError);
+ QCOMPARE(pixmap.error(), expectedError);
}
-
- QCOMPARE(QDeclarativePixmapCache::pendingRequests(), 0);
}
void tst_qdeclarativepixmapcache::parallel_data()
@@ -185,47 +180,36 @@ void tst_qdeclarativepixmapcache::parallel_data()
QTest::addColumn<QUrl>("target2");
QTest::addColumn<int>("incache");
QTest::addColumn<int>("cancel"); // which one to cancel
- QTest::addColumn<int>("requests");
QTest::newRow("local")
<< thisfile.resolved(QUrl("data/exists1.png"))
<< thisfile.resolved(QUrl("data/exists2.png"))
<< (localfile_optimized ? 2 : 0)
- << -1
- << (localfile_optimized ? 0 : 2)
- ;
+ << -1;
QTest::newRow("remote")
<< QUrl("http://127.0.0.1:14452/exists2.png")
<< QUrl("http://127.0.0.1:14452/exists3.png")
<< 0
- << -1
- << 2
- ;
+ << -1;
QTest::newRow("remoteagain")
<< QUrl("http://127.0.0.1:14452/exists2.png")
<< QUrl("http://127.0.0.1:14452/exists3.png")
<< 2
- << -1
- << 0
- ;
+ << -1;
QTest::newRow("remotecopy")
<< QUrl("http://127.0.0.1:14452/exists4.png")
<< QUrl("http://127.0.0.1:14452/exists4.png")
<< 0
- << -1
- << 1
- ;
+ << -1;
QTest::newRow("remotecopycancel")
<< QUrl("http://127.0.0.1:14452/exists5.png")
<< QUrl("http://127.0.0.1:14452/exists5.png")
<< 0
- << 0
- << 1
- ;
+ << 0;
}
void tst_qdeclarativepixmapcache::parallel()
@@ -234,38 +218,38 @@ void tst_qdeclarativepixmapcache::parallel()
QFETCH(QUrl, target2);
QFETCH(int, incache);
QFETCH(int, cancel);
- QFETCH(int, requests);
QList<QUrl> targets;
targets << target1 << target2;
- QList<QDeclarativePixmapReply*> replies;
+ QList<QDeclarativePixmap *> pixmaps;
+ QList<bool> pending;
QList<Slotter*> getters;
+
for (int i=0; i<targets.count(); ++i) {
QUrl target = targets.at(i);
- QPixmap pixmap;
- QString errorString;
- QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap, &errorString);
- QDeclarativePixmapReply *reply = 0;
- QVERIFY(status != QDeclarativePixmapReply::Error);
- if (status != QDeclarativePixmapReply::Error && status != QDeclarativePixmapReply::Ready)
- reply = QDeclarativePixmapCache::request(&engine, target);
- replies.append(reply);
- if (!reply) {
- QVERIFY(pixmap.width() > 0);
+ QDeclarativePixmap *pixmap = new QDeclarativePixmap;
+
+ pixmap->load(&engine, target);
+
+ QVERIFY(pixmap->status() != QDeclarativePixmap::Error);
+ pixmaps.append(pixmap);
+ if (pixmap->isReady()) {
+ QVERIFY(pixmap->width() > 0);
getters.append(0);
+ pending.append(false);
} else {
- QVERIFY(pixmap.width() <= 0);
+ QVERIFY(pixmap->width() <= 0);
getters.append(new Slotter);
- connect(reply, SIGNAL(finished()), getters[i], SLOT(got()));
+ pixmap->connectFinished(getters[i], SLOT(got()));
+ pending.append(true);
}
}
QCOMPARE(incache+slotters, targets.count());
- QCOMPARE(QDeclarativePixmapCache::pendingRequests(), requests);
if (cancel >= 0) {
- QDeclarativePixmapCache::cancel(targets.at(cancel), getters[cancel]);
+ pixmaps.at(cancel)->clear(getters[cancel]);
slotters--;
}
@@ -275,22 +259,21 @@ void tst_qdeclarativepixmapcache::parallel()
}
for (int i=0; i<targets.count(); ++i) {
- QDeclarativePixmapReply *reply = replies[i];
- if (reply) {
- if (i == cancel) {
- QVERIFY(!getters[i]->gotslot);
- } else {
+ QDeclarativePixmap *pixmap = pixmaps[i];
+
+ if (i == cancel) {
+ QVERIFY(!getters[i]->gotslot);
+ } else {
+ if (pending[i])
QVERIFY(getters[i]->gotslot);
- QPixmap pixmap;
- QString errorString;
- QVERIFY(QDeclarativePixmapCache::get(targets[i], &pixmap, &errorString) == QDeclarativePixmapReply::Ready);
- QVERIFY(pixmap.width() > 0);
- }
+
+ QVERIFY(pixmap->isReady());
+ QVERIFY(pixmap->width() > 0);
delete getters[i];
}
}
- QCOMPARE(QDeclarativePixmapCache::pendingRequests(), 0);
+ qDeleteAll(pixmaps);
}
QTEST_MAIN(tst_qdeclarativepixmapcache)
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..5a81881 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -53,14 +53,34 @@
#include <private/qdeclarativetextedit_p_p.h>
#include <QFontMetrics>
#include <QDeclarativeView>
+#include <QDir>
#include <QStyle>
#include <QInputContext>
+#include <private/qapplication_p.h>
+#include <private/qtextcontrol_p.h>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
#define SRCDIR "."
#endif
+QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual)
+{
+ // 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.
+
+ QString expectfile = persistent_dir + QDir::separator() + filebasename + "-" + arch + ".png";
+
+ if (!QFile::exists(expectfile)) {
+ actual.save(expectfile);
+ qWarning() << "created" << expectfile;
+ }
+
+ return expectfile;
+}
+
+
class tst_qdeclarativetextedit : public QObject
{
@@ -206,7 +226,7 @@ void tst_qdeclarativetextedit::width()
QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->width(), 1.);//+1 for cursor
+ QCOMPARE(textEditObject->width(), 0.0);
}
for (int i = 0; i < standard.size(); i++)
@@ -222,7 +242,7 @@ void tst_qdeclarativetextedit::width()
QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->width(), qreal(metricWidth + 1 + 3));//+3 is the current way of accounting for space between cursor and last character.
+ QCOMPARE(textEditObject->width(), qreal(metricWidth));
}
for (int i = 0; i < richText.size(); i++)
@@ -239,7 +259,7 @@ void tst_qdeclarativetextedit::width()
QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create());
QVERIFY(textEditObject != 0);
- QCOMPARE(textEditObject->width(), qreal(documentWidth + 1 + 3));
+ QCOMPARE(textEditObject->width(), qreal(documentWidth));
}
}
@@ -305,17 +325,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 +345,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 +362,11 @@ void tst_qdeclarativetextedit::alignments()
QPainter p(&actual);
canvas->render(&p);
+ expectfile = createExpectedFileIfNotFound(expectfile, actual);
+
QImage expect(expectfile);
-#ifdef Q_WS_X11
- // Font-specific, but not likely platform-specific, so only test on one platform
QCOMPARE(actual,expect);
-#endif
}
@@ -489,6 +501,23 @@ void tst_qdeclarativetextedit::font()
void tst_qdeclarativetextedit::color()
{
+ //test initial color
+ {
+ QString componentStr = "import Qt 4.7\nTextEdit { text: \"Hello World\" }";
+ QDeclarativeComponent texteditComponent(&engine);
+ texteditComponent.setData(componentStr.toLatin1(), QUrl());
+ QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create());
+
+ QDeclarativeTextEditPrivate *textEditPrivate = static_cast<QDeclarativeTextEditPrivate*>(QDeclarativeItemPrivate::get(textEditObject));
+
+ QVERIFY(textEditObject);
+ QVERIFY(textEditPrivate);
+ QVERIFY(textEditPrivate->control);
+
+ QPalette pal = textEditPrivate->control->palette();
+ QCOMPARE(textEditPrivate->color, QColor("black"));
+ QCOMPARE(textEditPrivate->color, pal.color(QPalette::Text));
+ }
//test normal
for (int i = 0; i < colorStrings.size(); i++)
{
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/data/inputmethodhints.qml b/tests/auto/declarative/qdeclarativetextinput/data/inputmethods.qml
index da6b81f..405ee22 100644
--- a/tests/auto/declarative/qdeclarativetextinput/data/inputmethodhints.qml
+++ b/tests/auto/declarative/qdeclarativetextinput/data/inputmethods.qml
@@ -3,4 +3,5 @@ import Qt 4.7
TextInput {
text: "Hello world!"
inputMethodHints: Qt.ImhNoPredictiveText
+ Keys.onLeftPressed: {}
}
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index a55b42e..9ae7c99 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -47,14 +47,32 @@
#include <private/qdeclarativetextinput_p.h>
#include <private/qdeclarativetextinput_p_p.h>
#include <QDebug>
+#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
#define SRCDIR "."
#endif
+QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual)
+{
+ // 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.
+
+ QString expectfile = persistent_dir + QDir::separator() + filebasename + "-" + arch + ".png";
+
+ if (!QFile::exists(expectfile)) {
+ actual.save(expectfile);
+ qWarning() << "created" << expectfile;
+ }
+
+ return expectfile;
+}
+
class tst_qdeclarativetextinput : public QObject
{
@@ -63,18 +81,22 @@ public:
tst_qdeclarativetextinput();
private slots:
+
void text();
void width();
void font();
void color();
void selection();
+ void horizontalAlignment_data();
+ void horizontalAlignment();
+
void positionAt();
void maxLength();
void masks();
void validators();
- void inputMethodHints();
+ void inputMethods();
void cursorDelegate();
void navigation();
@@ -153,7 +175,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(), 0.0);
delete textinputObject;
}
@@ -170,7 +192,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 +393,44 @@ 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) << "halign_left";
+ QTest::newRow("R") << int(Qt::AlignRight) << "halign_right";
+ QTest::newRow("C") << int(Qt::AlignHCenter) << "halign_center";
+}
+
+void tst_qdeclarativetextinput::horizontalAlignment()
+{
+ QFETCH(int, hAlign);
+ QFETCH(QString, expectfile);
+
+ 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);
+ }
+
+ expectfile = createExpectedFileIfNotFound(expectfile, actual);
+
+ QImage expect(expectfile);
+
+ QCOMPARE(actual,expect);
+}
+
void tst_qdeclarativetextinput::positionAt()
{
QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml");
@@ -557,18 +618,31 @@ void tst_qdeclarativetextinput::validators()
delete canvas;
}
-void tst_qdeclarativetextinput::inputMethodHints()
+void tst_qdeclarativetextinput::inputMethods()
{
- QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethodhints.qml");
+ QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethods.qml");
canvas->show();
canvas->setFocus();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ // test input method hints
QVERIFY(canvas->rootObject() != 0);
- QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject());
- QVERIFY(textinputObject != 0);
- QVERIFY(textinputObject->inputMethodHints() & Qt::ImhNoPredictiveText);
- textinputObject->setInputMethodHints(Qt::ImhUppercaseOnly);
- QVERIFY(textinputObject->inputMethodHints() & Qt::ImhUppercaseOnly);
+ QDeclarativeTextInput *input = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject());
+ QVERIFY(input != 0);
+ QVERIFY(input->inputMethodHints() & Qt::ImhNoPredictiveText);
+ input->setInputMethodHints(Qt::ImhUppercaseOnly);
+ QVERIFY(input->inputMethodHints() & Qt::ImhUppercaseOnly);
+
+ QVERIFY(canvas->rootObject() != 0);
+
+ input->setFocus(true);
+ QVERIFY(input->hasFocus() == true);
+ // test that input method event is committed
+ QInputMethodEvent event;
+ event.setCommitString( "My ", -12, 0);
+ QApplication::sendEvent(canvas, &event);
+ QCOMPARE(input->text(), QString("My Hello world!"));
delete canvas;
}
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/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"));
}