| 124 | } |
| 125 | |
| 126 | void testJSValue() |
| 127 | { |
| 128 | QQmlEngine engine; |
| 129 | QQmlComponent component(&engine); |
| 130 | component.setData( |
| 131 | "import QtQuick 2.0\nRectangle { property var a1: []; property var a2: [\"hello\", \"world\"] }", |
| 132 | QUrl()); |
| 133 | auto obj = component.create(); |
| 134 | QVERIFY2(obj, qPrintable(component.errorString())); |
| 135 | |
| 136 | auto adaptor = PropertyAdaptorFactory::create(obj, this); |
| 137 | QVERIFY(adaptor); |
| 138 | |
| 139 | auto idx = indexOfProperty(adaptor, "a1"); |
| 140 | QVERIFY(idx >= 0); |
| 141 | |
| 142 | auto data = adaptor->propertyData(idx); |
| 143 | auto jsValueAdaptor = PropertyAdaptorFactory::create(data.value(), this); |
| 144 | QVERIFY(jsValueAdaptor); |
| 145 | QCOMPARE(jsValueAdaptor->count(), 0); |
| 146 | |
| 147 | idx = indexOfProperty(adaptor, "a2"); |
| 148 | QVERIFY(idx >= 0); |
| 149 | |
| 150 | data = adaptor->propertyData(idx); |
| 151 | jsValueAdaptor = PropertyAdaptorFactory::create(data.value(), this); |
| 152 | QVERIFY(jsValueAdaptor); |
| 153 | QCOMPARE(jsValueAdaptor->count(), 2); |
| 154 | data = jsValueAdaptor->propertyData(1); |
| 155 | QCOMPARE(data.name(), QStringLiteral("1")); |
| 156 | QCOMPARE(data.value(), QVariant("world")); |
| 157 | |
| 158 | delete obj; |
| 159 | } |
| 160 | |
| 161 | void testContextProperty() |
| 162 | { |
nothing calls this directly
no test coverage detected