diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-04-22 04:58:56 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-04-22 23:46:03 (GMT) |
commit | 64d384e4ec8d9cac98dba3feaab96658b1e27e87 (patch) | |
tree | 4aa703b8d94c69d58b7cc5f1edac1c07274432a7 /tests/auto/declarative | |
parent | 02a7574f213901d98766f717d0135685da139d38 (diff) | |
download | Qt-64d384e4ec8d9cac98dba3feaab96658b1e27e87.zip Qt-64d384e4ec8d9cac98dba3feaab96658b1e27e87.tar.gz Qt-64d384e4ec8d9cac98dba3feaab96658b1e27e87.tar.bz2 |
Rename QDeclarativeExpression::value() to evaluate().
QDeclarativeExpression can be used to evaluate any sort of expression,
not just those returning a value.
Diffstat (limited to 'tests/auto/declarative')
5 files changed, 25 insertions, 25 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 6939290..97fced4 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -381,7 +381,7 @@ void tst_qdeclarativeecmascript::basicExpressions() nestedContext.setContextProperty("millipedeLegs", QVariant(100)); MyExpression expr(nest?&nestedContext:&context, expression); - QCOMPARE(expr.value(), result); + QCOMPARE(expr.evaluate(), result); } void tst_qdeclarativeecmascript::arrayExpressions() @@ -396,7 +396,7 @@ void tst_qdeclarativeecmascript::arrayExpressions() context.setContextProperty("c", &obj3); MyExpression expr(&context, "[a, b, c, 10]"); - QVariant result = expr.value(); + QVariant result = expr.evaluate(); QCOMPARE(result.userType(), qMetaTypeId<QList<QObject *> >()); QList<QObject *> list = qvariant_cast<QList<QObject *> >(result); QCOMPARE(list.count(), 4); @@ -424,47 +424,47 @@ void tst_qdeclarativeecmascript::contextPropertiesTriggerReeval() { MyExpression expr(&context, "testProp + 1"); QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant(2)); + QCOMPARE(expr.evaluate(), QVariant(2)); context.setContextProperty("testProp", QVariant(2)); QCOMPARE(expr.changed, true); - QCOMPARE(expr.value(), QVariant(3)); + QCOMPARE(expr.evaluate(), QVariant(3)); } { MyExpression expr(&context, "testProp + testProp + testProp"); QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant(6)); + QCOMPARE(expr.evaluate(), QVariant(6)); context.setContextProperty("testProp", QVariant(4)); QCOMPARE(expr.changed, true); - QCOMPARE(expr.value(), QVariant(12)); + QCOMPARE(expr.evaluate(), QVariant(12)); } { MyExpression expr(&context, "testObj.stringProperty"); QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant("Hello")); + QCOMPARE(expr.evaluate(), QVariant("Hello")); context.setContextProperty("testObj", &object2); QCOMPARE(expr.changed, true); - QCOMPARE(expr.value(), QVariant("World")); + QCOMPARE(expr.evaluate(), QVariant("World")); } { MyExpression expr(&context, "testObj.stringProperty /**/"); QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant("World")); + QCOMPARE(expr.evaluate(), QVariant("World")); context.setContextProperty("testObj", &object1); QCOMPARE(expr.changed, true); - QCOMPARE(expr.value(), QVariant("Hello")); + QCOMPARE(expr.evaluate(), QVariant("Hello")); } { MyExpression expr(&context, "testObj2"); QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant::fromValue((QObject *)object3)); + QCOMPARE(expr.evaluate(), QVariant::fromValue((QObject *)object3)); } } @@ -484,42 +484,42 @@ void tst_qdeclarativeecmascript::objectPropertiesTriggerReeval() { MyExpression expr(&context, "testObj.stringProperty"); QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant("Hello")); + QCOMPARE(expr.evaluate(), QVariant("Hello")); object1.setStringProperty(QLatin1String("World")); QCOMPARE(expr.changed, true); - QCOMPARE(expr.value(), QVariant("World")); + QCOMPARE(expr.evaluate(), QVariant("World")); } { MyExpression expr(&context, "testObj.objectProperty.stringProperty"); QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant()); + QCOMPARE(expr.evaluate(), QVariant()); object1.setObjectProperty(&object2); QCOMPARE(expr.changed, true); expr.changed = false; - QCOMPARE(expr.value(), QVariant("Dog")); + QCOMPARE(expr.evaluate(), QVariant("Dog")); object1.setObjectProperty(&object3); QCOMPARE(expr.changed, true); expr.changed = false; - QCOMPARE(expr.value(), QVariant("Cat")); + QCOMPARE(expr.evaluate(), QVariant("Cat")); object1.setObjectProperty(0); QCOMPARE(expr.changed, true); expr.changed = false; - QCOMPARE(expr.value(), QVariant()); + QCOMPARE(expr.evaluate(), QVariant()); object1.setObjectProperty(&object3); QCOMPARE(expr.changed, true); expr.changed = false; - QCOMPARE(expr.value(), QVariant("Cat")); + QCOMPARE(expr.evaluate(), QVariant("Cat")); object3.setStringProperty("Donkey"); QCOMPARE(expr.changed, true); expr.changed = false; - QCOMPARE(expr.value(), QVariant("Donkey")); + QCOMPARE(expr.evaluate(), QVariant("Donkey")); } } diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 73aefaf..e0143a6 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -401,7 +401,7 @@ T *tst_qdeclarativeimage::findItem(QGraphicsObject *parent, const QString &objec if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { if (index != -1) { QDeclarativeExpression e(qmlContext(item), "index", item); - if (e.value().toInt() == index) + if (e.evaluate().toInt() == index) return static_cast<T*>(item); } else { return static_cast<T*>(item); diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index e4c296f..ec97461 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -279,7 +279,7 @@ void tst_qdeclarativelistmodel::dynamic() if (!warning.isEmpty()) QTest::ignoreMessage(QtWarningMsg, warning.toLatin1()); - int actual = e.value().toInt(); + int actual = e.evaluate().toInt(); if (e.hasError()) qDebug() << e.error(); // errors not expected QVERIFY(!e.hasError()); @@ -338,9 +338,9 @@ void tst_qdeclarativelistmodel::dynamic_worker() QDeclarativeExpression e(eng.rootContext(), operations.last().toString(), &model); if (QByteArray(QTest::currentDataTag()).startsWith("nested")) - QVERIFY(e.value().toInt() != result); + QVERIFY(e.evaluate().toInt() != result); else - QCOMPARE(e.value().toInt(), result); + QCOMPARE(e.evaluate().toInt(), result); } delete item; diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 6b7a361..cab4d52 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1551,7 +1551,7 @@ T *tst_QDeclarativeListView::findItem(QGraphicsObject *parent, const QString &ob if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { if (index != -1) { QDeclarativeExpression e(qmlContext(item), "index", item); - if (e.value().toInt() == index) + if (e.evaluate().toInt() == index) return static_cast<T*>(item); } else { return static_cast<T*>(item); diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index df7c511..0e3a74d 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -697,7 +697,7 @@ T *tst_QDeclarativePathView::findItem(QGraphicsObject *parent, const QString &ob if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { if (index != -1) { QDeclarativeExpression e(qmlContext(item), "index", item); - if (e.value().toInt() == index) + if (e.evaluate().toInt() == index) return static_cast<T*>(item); } else { return static_cast<T*>(item); |