diff options
author | Christopher Ham <christopher.ham@nokia.com> | 2011-01-27 06:34:07 (GMT) |
---|---|---|
committer | Christopher Ham <christopher.ham@nokia.com> | 2011-01-27 06:41:07 (GMT) |
commit | aa40f956bab22678b62f630af97f51f9e8fab9f8 (patch) | |
tree | 1c06245f0bde3c0bb9e475d4d0f80fc7765263c1 /tests | |
parent | 80f74d3801ddece4d34b4a663bf1bdc23ecc4a67 (diff) | |
download | Qt-aa40f956bab22678b62f630af97f51f9e8fab9f8.zip Qt-aa40f956bab22678b62f630af97f51f9e8fab9f8.tar.gz Qt-aa40f956bab22678b62f630af97f51f9e8fab9f8.tar.bz2 |
Fix righ-to-left support in text components.
In text, textEdit and textInput, the layout of the text should
automatically align to the right if the it is deemed to be
right-to-left text.
Task-number: QTBUG-15880
Reviewed-by: Bea Lam
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml | 21 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp | 28 |
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml b/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml new file mode 100644 index 0000000..60d4c44 --- /dev/null +++ b/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml @@ -0,0 +1,21 @@ +import QtQuick 1.0 + +Item{ + id: root + property QtObject declarativerectangle : null + property QtObject declarativeitem : null + Component{id: a; Rectangle{} } + Component{ + id: b + Item{ + property bool testBool: false + property int testInt: null + property QtObject testObject: null + } + } + + Component.onCompleted: { + root.declarativerectangle = a.createObject(root, {"x":17,"y":17, "color":"white"}); + root.declarativeitem = b.createObject(root, {"x":17,"y":17,"testBool":true,"testInt":17,"testObject":root}); + } +} diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp index 4db538e..829b762 100644 --- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp +++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp @@ -44,6 +44,8 @@ #include <QtGui/qgraphicsitem.h> #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeitem.h> +#include <qcolor.h> #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -60,6 +62,7 @@ private slots: void null(); void loadEmptyUrl(); void qmlCreateObject(); + void qmlCreatObjectWithScript(); private: QDeclarativeEngine engine; @@ -118,6 +121,31 @@ void tst_qdeclarativecomponent::qmlCreateObject() QCOMPARE(testObject3->metaObject()->className(), "QDeclarativeGraphicsWidget"); } +void tst_qdeclarativecomponent::qmlCreatObjectWithScript() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/createObjectWithScript.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QObject *testObject1 = object->property("declarativerectangle").value<QObject*>(); + QVERIFY(testObject1); + QVERIFY(testObject1->parent() == object); + QCOMPARE(testObject1->property("x").value<int>(), 17); + QCOMPARE(testObject1->property("y").value<int>(), 17); + QCOMPARE(testObject1->property("color").value<QColor>(), QColor(255,255,255)); + + QObject *testObject2 = object->property("declarativeitem").value<QObject*>(); + QVERIFY(testObject2); + QVERIFY(testObject2->parent() == object); + QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem_QML_2"); + QCOMPARE(testObject2->property("x").value<int>(), 17); + QCOMPARE(testObject2->property("y").value<int>(), 17); + QCOMPARE(testObject2->property("testBool").value<bool>(), true); + QCOMPARE(testObject2->property("testInt").value<int>(), 17); + QCOMPARE(testObject2->property("testObject").value<QObject*>(), object); +} + QTEST_MAIN(tst_qdeclarativecomponent) #include "tst_qdeclarativecomponent.moc" |