From 3e9caba478695443669ff880334ea69db6f764eb Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Mon, 22 Oct 2012 17:57:05 +0200 Subject: Change qml list interface Change-Id: I185c6f4cef6105544504324c1616b5995c219fe3 Reviewed-by: Christiaan Janssen --- .../qqmllistreference/tst_qqmllistreference.cpp | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'tests/auto/qml/qqmllistreference') diff --git a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp index 028eb30f53..68f4553921 100644 --- a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp +++ b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp @@ -68,6 +68,8 @@ private slots: void canAt(); void canClear(); void canCount(); + void isReadable(); + void isManipulable(); void append(); void at(); void clear(); @@ -128,6 +130,8 @@ void tst_qqmllistreference::qmllistreference_invalid() QVERIFY(r.at(10) == 0); QVERIFY(r.clear() == false); QVERIFY(r.count() == 0); + QVERIFY(r.isReadable() == false); + QVERIFY(r.isManipulable() == false); } // Non-property @@ -143,6 +147,8 @@ void tst_qqmllistreference::qmllistreference_invalid() QVERIFY(r.at(10) == 0); QVERIFY(r.clear() == false); QVERIFY(r.count() == 0); + QVERIFY(r.isReadable() == false); + QVERIFY(r.isManipulable() == false); } // Non-list property @@ -158,6 +164,8 @@ void tst_qqmllistreference::qmllistreference_invalid() QVERIFY(r.at(10) == 0); QVERIFY(r.clear() == false); QVERIFY(r.count() == 0); + QVERIFY(r.isReadable() == false); + QVERIFY(r.isManipulable() == false); } } @@ -343,6 +351,64 @@ void tst_qqmllistreference::canCount() } } +void tst_qqmllistreference::isReadable() +{ + TestType *tt = new TestType; + + { + QQmlListReference ref; + QVERIFY(ref.isReadable() == false); + } + + { + QQmlListReference ref(tt, "blah"); + QVERIFY(ref.isReadable() == false); + } + + { + QQmlListReference ref(tt, "data"); + QVERIFY(ref.isReadable() == true); + delete tt; + QVERIFY(ref.isReadable() == false); + } + + { + TestType tt; + tt.property.count = 0; + QQmlListReference ref(&tt, "data"); + QVERIFY(ref.isReadable() == false); + } +} + +void tst_qqmllistreference::isManipulable() +{ + TestType *tt = new TestType; + + { + QQmlListReference ref; + QVERIFY(ref.isManipulable() == false); + } + + { + QQmlListReference ref(tt, "blah"); + QVERIFY(ref.isManipulable() == false); + } + + { + QQmlListReference ref(tt, "data"); + QVERIFY(ref.isManipulable() == true); + delete tt; + QVERIFY(ref.isManipulable() == false); + } + + { + TestType tt; + tt.property.count = 0; + QQmlListReference ref(&tt, "data"); + QVERIFY(ref.isManipulable() == false); + } +} + void tst_qqmllistreference::append() { TestType *tt = new TestType; -- cgit v1.2.3