diff options
author | Christopher Ham <christopher.ham@nokia.com> | 2011-02-15 06:22:46 (GMT) |
---|---|---|
committer | Christopher Ham <christopher.ham@nokia.com> | 2011-02-15 06:22:46 (GMT) |
commit | 0b0358732cafc34d4b6794200752ac9cb99de569 (patch) | |
tree | e302c95daf4dceec6946034b419e4609fc130a53 /tests/auto/declarative/qdeclarativelistview | |
parent | 5eb9edbd51df63fe3329e8ddc1325ed3024211ad (diff) | |
download | Qt-0b0358732cafc34d4b6794200752ac9cb99de569.zip Qt-0b0358732cafc34d4b6794200752ac9cb99de569.tar.gz Qt-0b0358732cafc34d4b6794200752ac9cb99de569.tar.bz2 |
Righ-to-left support for GridView and ListView
GridView and ListView can now be laid out right-to-left. The
behaviour should be identical and mirrored to the oridinary behaviour.
Change-Id: I8e55c5f88358042caa5201712ef239cd67628172
Task-number: QTBUG-15877
Reviewed-by: Joona Petrell
Diffstat (limited to 'tests/auto/declarative/qdeclarativelistview')
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index f358625..26219fe 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -115,6 +115,7 @@ private slots: void onRemove_data(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); + void rightToLeft(); private: template <class T> void items(); @@ -2299,6 +2300,47 @@ void tst_QDeclarativeListView::testQtQuick11Attributes_data() << ""; } +void tst_QDeclarativeListView::rightToLeft() +{ + QDeclarativeView *canvas = createView(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "view"); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + QDeclarativeVisualItemModel *model = canvas->rootObject()->findChild<QDeclarativeVisualItemModel*>("itemModel"); + QTRY_VERIFY(model != 0); + + QTRY_VERIFY(model->count() == 3); + QTRY_COMPARE(listview->currentIndex(), 0); + + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "item1"); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), -100.0); + QCOMPARE(item->height(), listview->height()); + + QDeclarativeText *text = findItem<QDeclarativeText>(contentItem, "text1"); + QTRY_VERIFY(text); + QTRY_COMPARE(text->text(), QLatin1String("index: 0")); + + listview->setCurrentIndex(2); + + item = findItem<QDeclarativeItem>(contentItem, "item3"); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), -600.0); + + text = findItem<QDeclarativeText>(contentItem, "text3"); + QTRY_VERIFY(text); + QTRY_COMPARE(text->text(), QLatin1String("index: 2")); + + delete canvas; +} + void tst_QDeclarativeListView::qListModelInterface_items() { items<TestModel>(); |