summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2011-01-04 07:25:48 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2011-01-07 05:06:47 (GMT)
commit0371e80ba76b7dcaf1809ba9345fd96610390222 (patch)
tree2d8d7c3132ee49d4eb4dd13585085681d48d36ce /tests
parentd3a6fcd9174b893aaac9db7d5e541ceb54b12402 (diff)
downloadQt-0371e80ba76b7dcaf1809ba9345fd96610390222.zip
Qt-0371e80ba76b7dcaf1809ba9345fd96610390222.tar.gz
Qt-0371e80ba76b7dcaf1809ba9345fd96610390222.tar.bz2
Add layoutDirection property to Qt.application element
Task-number: QTBUG-16424 Reviewed-by: Martin Jones
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp b/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
index 0d069dc..3011257 100644
--- a/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
+++ b/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
@@ -55,6 +55,7 @@ public:
private slots:
void active();
+ void layoutDirection();
private:
QDeclarativeEngine engine;
@@ -91,6 +92,28 @@ void tst_qdeclarativeapplication::active()
QCOMPARE(item->property("active").toBool(), QApplication::activeWindow() != 0);
}
+void tst_qdeclarativeapplication::layoutDirection()
+{
+ QDeclarativeComponent component(&engine);
+ component.setData("import QtQuick 1.0; Item { property bool layoutDirection: Qt.application.layoutDirection }", QUrl::fromLocalFile(""));
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(component.create());
+ QVERIFY(item);
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ scene.addItem(item);
+
+ // not mirrored
+ QCOMPARE(Qt::LayoutDirection(item->property("layoutDirection").toInt()), Qt::LeftToRight);
+
+ // mirrored
+ QApplication::setLayoutDirection(Qt::RightToLeft);
+ QCOMPARE(Qt::LayoutDirection(item->property("layoutDirection").toInt()), Qt::RightToLeft);
+
+ // not mirrored again
+ QApplication::setLayoutDirection(Qt::LeftToRight);
+ QCOMPARE(Qt::LayoutDirection(item->property("layoutDirection").toInt()), Qt::LeftToRight);
+}
+
QTEST_MAIN(tst_qdeclarativeapplication)
#include "tst_qdeclarativeapplication.moc"