summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-02-25 02:45:38 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-02-25 02:46:48 (GMT)
commita645ab52a7ba10018419b552b8f50ce4b7ad9cd8 (patch)
tree38b3267a4258331ffe22508949869b07f0887c33 /tests/auto
parent35f6b95744164e635fb8a03e34b2dd6177a50ccf (diff)
downloadQt-a645ab52a7ba10018419b552b8f50ce4b7ad9cd8.zip
Qt-a645ab52a7ba10018419b552b8f50ce4b7ad9cd8.tar.gz
Qt-a645ab52a7ba10018419b552b8f50ce4b7ad9cd8.tar.bz2
Move private QDeclarativeMetaProperty functions into the private class
We don't want to allow manipulation of bindings and signal properties through the public API. Equivalents of the public functions now exist in QDeclarativeMetaPropertyPrivate for internal use.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp111
2 files changed, 59 insertions, 56 deletions
diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
index 40cd737..8d5a1f6 100644
--- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
+++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
@@ -58,6 +58,7 @@
#include <private/qdeclarativedebugservice_p.h>
#include <private/qdeclarativerectangle_p.h>
#include <private/qdeclarativemetatype_p.h>
+#include <private/qdeclarativemetaproperty_p.h>
#include "../shared/debugutil_p.h"
@@ -216,7 +217,8 @@ void tst_QDeclarativeDebug::recursiveObjectTest(QObject *o, const QDeclarativeDe
else
QCOMPARE(p.valueTypeName(), QString::fromUtf8(pmeta.typeName()));
- QDeclarativeAbstractBinding *binding = QDeclarativeMetaProperty(o, p.name()).binding();
+ QDeclarativeAbstractBinding *binding =
+ QDeclarativeMetaPropertyPrivate::binding(QDeclarativeMetaProperty(o, p.name()));
if (binding)
QCOMPARE(binding->expression(), p.binding());
diff --git a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp
index e19bea0..42d77bb 100644
--- a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp
+++ b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp
@@ -42,6 +42,7 @@
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QtDeclarative/qdeclarativemetaproperty.h>
+#include <QtDeclarative/private/qdeclarativemetaproperty_p.h>
#include <private/qguard_p.h>
#include <private/qdeclarativebinding_p.h>
#include <QtGui/QLineEdit>
@@ -160,11 +161,11 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty()
QCOMPARE(prop.propertyType(), 0);
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QVERIFY(prop.property().name() == 0);
- QVERIFY(prop.binding() == 0);
- QVERIFY(prop.setBinding(binding) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0);
QVERIFY(binding == 0);
- QVERIFY(prop.signalExpression() == 0);
- QVERIFY(prop.setSignalExpression(expression) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0);
QVERIFY(expression == 0);
QCOMPARE(prop.coreIndex(), -1);
QCOMPARE(prop.valueTypeCoreIndex(), -1);
@@ -248,11 +249,11 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object()
QCOMPARE(prop.propertyType(), 0);
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QVERIFY(prop.property().name() == 0);
- QVERIFY(prop.binding() == 0);
- QVERIFY(prop.setBinding(binding) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0);
QVERIFY(binding == 0);
- QVERIFY(prop.signalExpression() == 0);
- QVERIFY(prop.setSignalExpression(expression) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0);
QVERIFY(expression == 0);
QCOMPARE(prop.coreIndex(), -1);
QCOMPARE(prop.valueTypeCoreIndex(), -1);
@@ -295,13 +296,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object()
QCOMPARE(prop.propertyType(), (int)QVariant::Int);
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
- QVERIFY(prop.binding() == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0);
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int");
- QVERIFY(prop.setBinding(binding) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0);
QVERIFY(binding != 0);
- QVERIFY(prop.binding() == binding);
- QVERIFY(prop.signalExpression() == 0);
- QVERIFY(prop.setSignalExpression(expression) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == binding);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0);
QVERIFY(expression == 0);
QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty"));
QCOMPARE(prop.valueTypeCoreIndex(), -1);
@@ -349,11 +350,11 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string()
QCOMPARE(prop.propertyType(), 0);
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QVERIFY(prop.property().name() == 0);
- QVERIFY(prop.binding() == 0);
- QVERIFY(prop.setBinding(binding) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0);
QVERIFY(binding == 0);
- QVERIFY(prop.signalExpression() == 0);
- QVERIFY(prop.setSignalExpression(expression) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0);
QVERIFY(expression == 0);
QCOMPARE(prop.coreIndex(), -1);
QCOMPARE(prop.valueTypeCoreIndex(), -1);
@@ -396,13 +397,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string()
QCOMPARE(prop.propertyType(), (int)QVariant::Int);
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
- QVERIFY(prop.binding() == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0);
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int");
- QVERIFY(prop.setBinding(binding) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0);
QVERIFY(binding != 0);
- QVERIFY(prop.binding() == binding);
- QVERIFY(prop.signalExpression() == 0);
- QVERIFY(prop.setSignalExpression(expression) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == binding);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0);
QVERIFY(expression == 0);
QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty"));
QCOMPARE(prop.valueTypeCoreIndex(), -1);
@@ -445,13 +446,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string()
QCOMPARE(prop.propertyType(), 0);
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QCOMPARE(prop.property().name(), (const char *)0);
- QVERIFY(prop.binding() == 0);
- QVERIFY(prop.setBinding(binding) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0);
QVERIFY(binding == 0);
- QVERIFY(prop.signalExpression() == 0);
- QVERIFY(prop.setSignalExpression(expression) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0);
QVERIFY(expression != 0);
- QVERIFY(prop.signalExpression() == expression);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == expression);
QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("clicked()"));
QCOMPARE(prop.valueTypeCoreIndex(), -1);
@@ -498,11 +499,11 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context()
QCOMPARE(prop.propertyType(), 0);
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QVERIFY(prop.property().name() == 0);
- QVERIFY(prop.binding() == 0);
- QVERIFY(prop.setBinding(binding) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0);
QVERIFY(binding == 0);
- QVERIFY(prop.signalExpression() == 0);
- QVERIFY(prop.setSignalExpression(expression) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0);
QVERIFY(expression == 0);
QCOMPARE(prop.coreIndex(), -1);
QCOMPARE(prop.valueTypeCoreIndex(), -1);
@@ -545,13 +546,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context()
QCOMPARE(prop.propertyType(), (int)QVariant::Int);
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
- QVERIFY(prop.binding() == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0);
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int");
- QVERIFY(prop.setBinding(binding) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0);
QVERIFY(binding != 0);
- QVERIFY(prop.binding() == binding);
- QVERIFY(prop.signalExpression() == 0);
- QVERIFY(prop.setSignalExpression(expression) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == binding);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0);
QVERIFY(expression == 0);
QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty"));
QCOMPARE(prop.valueTypeCoreIndex(), -1);
@@ -599,11 +600,11 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context()
QCOMPARE(prop.propertyType(), 0);
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QVERIFY(prop.property().name() == 0);
- QVERIFY(prop.binding() == 0);
- QVERIFY(prop.setBinding(binding) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0);
QVERIFY(binding == 0);
- QVERIFY(prop.signalExpression() == 0);
- QVERIFY(prop.setSignalExpression(expression) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0);
QVERIFY(expression == 0);
QCOMPARE(prop.coreIndex(), -1);
QCOMPARE(prop.valueTypeCoreIndex(), -1);
@@ -646,13 +647,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context()
QCOMPARE(prop.propertyType(), (int)QVariant::Int);
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
- QVERIFY(prop.binding() == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0);
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int");
- QVERIFY(prop.setBinding(binding) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0);
QVERIFY(binding != 0);
- QVERIFY(prop.binding() == binding);
- QVERIFY(prop.signalExpression() == 0);
- QVERIFY(prop.setSignalExpression(expression) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == binding);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0);
QVERIFY(expression == 0);
QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty"));
QCOMPARE(prop.valueTypeCoreIndex(), -1);
@@ -695,13 +696,13 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context()
QCOMPARE(prop.propertyType(), 0);
QCOMPARE(prop.propertyTypeName(), (const char *)0);
QCOMPARE(prop.property().name(), (const char *)0);
- QVERIFY(prop.binding() == 0);
- QVERIFY(prop.setBinding(binding) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::binding(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setBinding(prop, binding) == 0);
QVERIFY(binding == 0);
- QVERIFY(prop.signalExpression() == 0);
- QVERIFY(prop.setSignalExpression(expression) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == 0);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::setSignalExpression(prop, expression) == 0);
QVERIFY(expression != 0);
- QVERIFY(prop.signalExpression() == expression);
+ QVERIFY(QDeclarativeMetaPropertyPrivate::signalExpression(prop) == expression);
QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("clicked()"));
QCOMPARE(prop.valueTypeCoreIndex(), -1);
@@ -824,8 +825,8 @@ void tst_qdeclarativemetaproperty::read()
QDeclarativeMetaProperty p(&o, "onClicked");
QCOMPARE(p.read(), QVariant());
- QVERIFY(0 == p.setSignalExpression(new QDeclarativeExpression()));
- QVERIFY(0 != p.signalExpression());
+ QVERIFY(0 == QDeclarativeMetaPropertyPrivate::setSignalExpression(p, new QDeclarativeExpression()));
+ QVERIFY(0 != QDeclarativeMetaPropertyPrivate::signalExpression(p));
QCOMPARE(p.read(), QVariant());
}
@@ -928,12 +929,12 @@ void tst_qdeclarativemetaproperty::write()
QDeclarativeMetaProperty p(&o, "onClicked");
QCOMPARE(p.write(QVariant("console.log(1921)")), false);
- QVERIFY(0 == p.setSignalExpression(new QDeclarativeExpression()));
- QVERIFY(0 != p.signalExpression());
+ QVERIFY(0 == QDeclarativeMetaPropertyPrivate::setSignalExpression(p, new QDeclarativeExpression()));
+ QVERIFY(0 != QDeclarativeMetaPropertyPrivate::signalExpression(p));
QCOMPARE(p.write(QVariant("console.log(1921)")), false);
- QVERIFY(0 != p.signalExpression());
+ QVERIFY(0 != QDeclarativeMetaPropertyPrivate::signalExpression(p));
}
// Value-type property