diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-02-25 05:51:22 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-02-25 05:51:22 (GMT) |
commit | b915bc2d710e365e7c9083ba65d08de08ea02f74 (patch) | |
tree | 8e87760b9154493372f1f8b499b52e661547e3ca /tests | |
parent | 950f3849e3bd2edd6bcc2784dbeadcb604c38e2d (diff) | |
parent | d022acd47350f61d3959b076d7bc92df86015b16 (diff) | |
download | Qt-b915bc2d710e365e7c9083ba65d08de08ea02f74.zip Qt-b915bc2d710e365e7c9083ba65d08de08ea02f74.tar.gz Qt-b915bc2d710e365e7c9083ba65d08de08ea02f74.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'tests')
8 files changed, 107 insertions, 89 deletions
diff --git a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml index 70fafd6..c00173d 100644 --- a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml +++ b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import Qt.widgets 4.6 QGraphicsView { objectName: "GView" 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/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index ae07112..2907757 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -747,7 +747,7 @@ void tst_qdeclarativelanguage::valueTypes() // ### #if 0 - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "rectProperty.x"); + QDeclarativeMetaProperty p(object, "rectProperty.x"); QCOMPARE(p.read(), QVariant(12)); p.write(13); QCOMPARE(p.read(), QVariant(13)); diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp index 5c6ceef..fdcb98a 100644 --- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp +++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp @@ -547,10 +547,10 @@ void tst_qdeclarativelistreference::engineTypes() QVERIFY(o); QDeclarativeMetaProperty p1(o, QLatin1String("myList")); - QVERIFY(p1.propertyCategory() == QDeclarativeMetaProperty::Normal); + QVERIFY(p1.propertyTypeCategory() == QDeclarativeMetaProperty::Normal); QDeclarativeMetaProperty p2(o, QLatin1String("myList"), engine.rootContext()); - QVERIFY(p2.propertyCategory() == QDeclarativeMetaProperty::List); + QVERIFY(p2.propertyTypeCategory() == QDeclarativeMetaProperty::List); QVariant v = p2.read(); QVERIFY(v.userType() == qMetaTypeId<QDeclarativeListReference>()); QDeclarativeListReference ref = qvariant_cast<QDeclarativeListReference>(v); diff --git a/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml b/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml index 627c7df..4ebf366 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import Qt.widgets 4.6 QGraphicsWidget { size: "250x250" diff --git a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp index e19bea0..4d07a19 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> @@ -156,15 +157,15 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); 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); @@ -244,15 +245,15 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); 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); @@ -291,17 +292,17 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); 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); @@ -345,15 +346,15 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); 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); @@ -392,17 +393,17 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); 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); @@ -441,17 +442,17 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); 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); @@ -494,15 +495,15 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); 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); @@ -541,17 +542,17 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); 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); @@ -595,15 +596,15 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); 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); @@ -642,17 +643,17 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); 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); @@ -691,17 +692,17 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); 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); @@ -753,19 +754,19 @@ void tst_qdeclarativemetaproperty::name() { PropertyObject o; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(&o, "rectProperty"); + QDeclarativeMetaProperty p(&o, "rectProperty"); QCOMPARE(p.name(), QString("rectProperty")); } { PropertyObject o; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(&o, "rectProperty.x"); + QDeclarativeMetaProperty p(&o, "rectProperty.x"); QCOMPARE(p.name(), QString("rectProperty.x")); } { PropertyObject o; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(&o, "rectProperty.foo"); + QDeclarativeMetaProperty p(&o, "rectProperty.foo"); QCOMPARE(p.name(), QString()); } } @@ -807,14 +808,14 @@ void tst_qdeclarativemetaproperty::read() // Value-type prop { PropertyObject o; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(&o, "rectProperty.x"); + QDeclarativeMetaProperty p(&o, "rectProperty.x"); QCOMPARE(p.read(), QVariant(10)); } // Invalid value-type prop { PropertyObject o; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(&o, "rectProperty.foo"); + QDeclarativeMetaProperty p(&o, "rectProperty.foo"); QCOMPARE(p.read(), QVariant()); } @@ -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()); } @@ -833,7 +834,7 @@ void tst_qdeclarativemetaproperty::read() // Deleted object { PropertyObject *o = new PropertyObject; - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(o, "rectProperty.x"); + QDeclarativeMetaProperty p(o, "rectProperty.x"); QCOMPARE(p.read(), QVariant(10)); delete o; QCOMPARE(p.read(), QVariant()); @@ -846,7 +847,7 @@ void tst_qdeclarativemetaproperty::read() QObject *object = component.create(); QVERIFY(object != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "MyContainer.foo", qmlContext(object)); + QDeclarativeMetaProperty p(object, "MyContainer.foo", qmlContext(object)); QCOMPARE(p.read(), QVariant(13)); delete object; } @@ -856,7 +857,7 @@ void tst_qdeclarativemetaproperty::read() QObject *object = component.create(); QVERIFY(object != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "MyContainer.foo", qmlContext(object)); + QDeclarativeMetaProperty p(object, "MyContainer.foo", qmlContext(object)); QCOMPARE(p.read(), QVariant(10)); delete object; } @@ -866,7 +867,7 @@ void tst_qdeclarativemetaproperty::read() QObject *object = component.create(); QVERIFY(object != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "Foo.MyContainer.foo", qmlContext(object)); + QDeclarativeMetaProperty p(object, "Foo.MyContainer.foo", qmlContext(object)); QCOMPARE(p.read(), QVariant(10)); delete object; } @@ -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 @@ -945,7 +946,7 @@ void tst_qdeclarativemetaproperty::write() QCOMPARE(p.write(QRect(1, 13, 99, 8)), true); QCOMPARE(o.wrectProperty(), QRect(1, 13, 99, 8)); - QDeclarativeMetaProperty p2 = QDeclarativeMetaProperty::createProperty(&o, "wrectProperty.x"); + QDeclarativeMetaProperty p2(&o, "wrectProperty.x"); QCOMPARE(p2.read(), QVariant(1)); QCOMPARE(p2.write(QVariant(6)), true); QCOMPARE(p2.read(), QVariant(6)); @@ -976,7 +977,7 @@ void tst_qdeclarativemetaproperty::write() QObject *object = component.create(); QVERIFY(object != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "MyContainer.foo", qmlContext(object)); + QDeclarativeMetaProperty p(object, "MyContainer.foo", qmlContext(object)); p.write(QVariant(99)); QCOMPARE(p.read(), QVariant(99)); delete object; @@ -987,7 +988,7 @@ void tst_qdeclarativemetaproperty::write() QObject *object = component.create(); QVERIFY(object != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(object, "Foo.MyContainer.foo", qmlContext(object)); + QDeclarativeMetaProperty p(object, "Foo.MyContainer.foo", qmlContext(object)); p.write(QVariant(99)); QCOMPARE(p.read(), QVariant(99)); delete object; @@ -1115,7 +1116,7 @@ void tst_qdeclarativemetaproperty::crashOnValueProperty() PropertyObject *obj = qobject_cast<PropertyObject*>(component.create()); QVERIFY(obj != 0); - QDeclarativeMetaProperty p = QDeclarativeMetaProperty::createProperty(obj, "wrectProperty.x", qmlContext(obj)); + QDeclarativeMetaProperty p(obj, "wrectProperty.x", qmlContext(obj)); QCOMPARE(p.name(), QString("wrectProperty.x")); QCOMPARE(p.read(), QVariant(10)); @@ -1138,14 +1139,14 @@ void tst_qdeclarativemetaproperty::copy() QCOMPARE(property->name(), QString("defaultProperty")); QCOMPARE(property->read(), QVariant(10)); QCOMPARE(property->type(), QDeclarativeMetaProperty::Property); - QCOMPARE(property->propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(property->propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(property->propertyType(), (int)QVariant::Int); QDeclarativeMetaProperty p1(*property); QCOMPARE(p1.name(), QString("defaultProperty")); QCOMPARE(p1.read(), QVariant(10)); QCOMPARE(p1.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p1.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p1.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p1.propertyType(), (int)QVariant::Int); QDeclarativeMetaProperty p2(&object, QLatin1String("url")); @@ -1154,7 +1155,7 @@ void tst_qdeclarativemetaproperty::copy() QCOMPARE(p2.name(), QString("defaultProperty")); QCOMPARE(p2.read(), QVariant(10)); QCOMPARE(p2.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p2.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p2.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p2.propertyType(), (int)QVariant::Int); delete property; property = 0; @@ -1162,13 +1163,13 @@ void tst_qdeclarativemetaproperty::copy() QCOMPARE(p1.name(), QString("defaultProperty")); QCOMPARE(p1.read(), QVariant(10)); QCOMPARE(p1.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p1.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p1.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p1.propertyType(), (int)QVariant::Int); QCOMPARE(p2.name(), QString("defaultProperty")); QCOMPARE(p2.read(), QVariant(10)); QCOMPARE(p2.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p2.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p2.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p2.propertyType(), (int)QVariant::Int); } diff --git a/tests/auto/qmediacontent/qmediacontent.pro b/tests/auto/qmediacontent/qmediacontent.pro index f7884f6..6c13c8b 100644 --- a/tests/auto/qmediacontent/qmediacontent.pro +++ b/tests/auto/qmediacontent/qmediacontent.pro @@ -2,5 +2,5 @@ load(qttest_p4) SOURCES += tst_qmediacontent.cpp -QT = core multimedia +QT = core network multimedia diff --git a/tests/auto/qmediacontent/tst_qmediacontent.cpp b/tests/auto/qmediacontent/tst_qmediacontent.cpp index 35dd0a9..8987241 100644 --- a/tests/auto/qmediacontent/tst_qmediacontent.cpp +++ b/tests/auto/qmediacontent/tst_qmediacontent.cpp @@ -51,6 +51,7 @@ class tst_QMediaContent : public QObject private slots: void testNull(); void testUrlCtor(); + void testRequestCtor(); void testResourceCtor(); void testResourceListCtor(); void testCopy(); @@ -77,6 +78,18 @@ void tst_QMediaContent::testUrlCtor() QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov")); } +void tst_QMediaContent::testRequestCtor() +{ + QNetworkRequest request(QUrl("http://example.com/movie.mov")); + request.setAttribute(QNetworkRequest::User, QVariant(1234)); + + QMediaContent media(request); + + QCOMPARE(media.canonicalUrl(), QUrl("http://example.com/movie.mov")); + QCOMPARE(media.canonicalResource().request(), request); + QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov")); +} + void tst_QMediaContent::testResourceCtor() { QMediaContent media(QMediaResource(QUrl("http://example.com/movie.mov"))); |