summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-02-23 03:43:11 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-02-23 03:43:11 (GMT)
commit7828b564d6d857307aa13e273045ac7b82fec046 (patch)
tree654a7ee91bff0b08d710066c07cf1220e57b23de /tests
parentc48ce6292d52b6f0a2a0ba54109a426d33eb7842 (diff)
parent23316b14f28eb1b135b6e8e90fa6fdb34dc39b59 (diff)
downloadQt-7828b564d6d857307aa13e273045ac7b82fec046.zip
Qt-7828b564d6d857307aa13e273045ac7b82fec046.tar.gz
Qt-7828b564d6d857307aa13e273045ac7b82fec046.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/declarative.pro2
-rw-r--r--tests/auto/declarative/qmllistreference/data/MyType.qml (renamed from tests/auto/declarative/qmllist/data/MyType.qml)0
-rw-r--r--tests/auto/declarative/qmllistreference/data/engineTypes.qml (renamed from tests/auto/declarative/qmllist/data/engineTypes.qml)0
-rw-r--r--tests/auto/declarative/qmllistreference/data/variantToList.qml (renamed from tests/auto/declarative/qmllist/data/variantToList.qml)0
-rw-r--r--tests/auto/declarative/qmllistreference/qmllistreference.pro (renamed from tests/auto/declarative/qmllist/qmllist.pro)2
-rw-r--r--tests/auto/declarative/qmllistreference/tst_qmllistreference.cpp (renamed from tests/auto/declarative/qmllist/tst_qmllist.cpp)42
-rw-r--r--tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp65
7 files changed, 77 insertions, 34 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 645f794..870c92b 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -39,7 +39,7 @@ SUBDIRS += \
qmlinfo \ # Cover
qmlinstruction \ # Cover
qmllanguage \ # Cover
- qmllist \ # Cover
+ qmllistreference \ # Cover
qmllistmodel \ # Cover
qmlmetaproperty \ # Cover
qmlmetatype \ # Cover
diff --git a/tests/auto/declarative/qmllist/data/MyType.qml b/tests/auto/declarative/qmllistreference/data/MyType.qml
index d08f35b..d08f35b 100644
--- a/tests/auto/declarative/qmllist/data/MyType.qml
+++ b/tests/auto/declarative/qmllistreference/data/MyType.qml
diff --git a/tests/auto/declarative/qmllist/data/engineTypes.qml b/tests/auto/declarative/qmllistreference/data/engineTypes.qml
index 670aee4..670aee4 100644
--- a/tests/auto/declarative/qmllist/data/engineTypes.qml
+++ b/tests/auto/declarative/qmllistreference/data/engineTypes.qml
diff --git a/tests/auto/declarative/qmllist/data/variantToList.qml b/tests/auto/declarative/qmllistreference/data/variantToList.qml
index 0c2d0aa..0c2d0aa 100644
--- a/tests/auto/declarative/qmllist/data/variantToList.qml
+++ b/tests/auto/declarative/qmllistreference/data/variantToList.qml
diff --git a/tests/auto/declarative/qmllist/qmllist.pro b/tests/auto/declarative/qmllistreference/qmllistreference.pro
index b2145ed..fa49d5a 100644
--- a/tests/auto/declarative/qmllist/qmllist.pro
+++ b/tests/auto/declarative/qmllistreference/qmllistreference.pro
@@ -2,4 +2,4 @@ load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
macx:CONFIG -= app_bundle
-SOURCES += tst_qmllist.cpp
+SOURCES += tst_qmllistreference.cpp
diff --git a/tests/auto/declarative/qmllist/tst_qmllist.cpp b/tests/auto/declarative/qmllistreference/tst_qmllistreference.cpp
index 76def1c..6122f1e 100644
--- a/tests/auto/declarative/qmllist/tst_qmllist.cpp
+++ b/tests/auto/declarative/qmllistreference/tst_qmllistreference.cpp
@@ -60,11 +60,11 @@ inline QUrl TEST_FILE(const char *filename)
return TEST_FILE(QLatin1String(filename));
}
-class tst_QmlList : public QObject
+class tst_qmllistreference : public QObject
{
Q_OBJECT
public:
- tst_QmlList() {}
+ tst_qmllistreference() {}
private slots:
void qmllistreference();
@@ -103,7 +103,7 @@ public:
QML_DECLARE_TYPE(TestType);
QML_DEFINE_NOCREATE_TYPE(TestType);
-void tst_QmlList::qmllistreference()
+void tst_qmllistreference::qmllistreference()
{
TestType tt;
@@ -115,7 +115,7 @@ void tst_QmlList::qmllistreference()
QCOMPARE(r.count(), 1);
}
-void tst_QmlList::qmllistreference_invalid()
+void tst_qmllistreference::qmllistreference_invalid()
{
TestType tt;
@@ -165,7 +165,7 @@ void tst_QmlList::qmllistreference_invalid()
}
}
-void tst_QmlList::isValid()
+void tst_qmllistreference::isValid()
{
TestType *tt = new TestType;
@@ -187,7 +187,7 @@ void tst_QmlList::isValid()
}
}
-void tst_QmlList::object()
+void tst_qmllistreference::object()
{
TestType *tt = new TestType;
@@ -209,7 +209,7 @@ void tst_QmlList::object()
}
}
-void tst_QmlList::listElementType()
+void tst_qmllistreference::listElementType()
{
TestType *tt = new TestType;
@@ -231,7 +231,7 @@ void tst_QmlList::listElementType()
}
}
-void tst_QmlList::canAppend()
+void tst_qmllistreference::canAppend()
{
TestType *tt = new TestType;
@@ -260,7 +260,7 @@ void tst_QmlList::canAppend()
}
}
-void tst_QmlList::canAt()
+void tst_qmllistreference::canAt()
{
TestType *tt = new TestType;
@@ -289,7 +289,7 @@ void tst_QmlList::canAt()
}
}
-void tst_QmlList::canClear()
+void tst_qmllistreference::canClear()
{
TestType *tt = new TestType;
@@ -318,7 +318,7 @@ void tst_QmlList::canClear()
}
}
-void tst_QmlList::canCount()
+void tst_qmllistreference::canCount()
{
TestType *tt = new TestType;
@@ -347,7 +347,7 @@ void tst_QmlList::canCount()
}
}
-void tst_QmlList::append()
+void tst_qmllistreference::append()
{
TestType *tt = new TestType;
QObject object;
@@ -386,7 +386,7 @@ void tst_QmlList::append()
}
}
-void tst_QmlList::at()
+void tst_qmllistreference::at()
{
TestType *tt = new TestType;
tt->data.append(tt);
@@ -421,7 +421,7 @@ void tst_QmlList::at()
}
}
-void tst_QmlList::clear()
+void tst_qmllistreference::clear()
{
TestType *tt = new TestType;
tt->data.append(tt);
@@ -454,7 +454,7 @@ void tst_QmlList::clear()
}
}
-void tst_QmlList::count()
+void tst_qmllistreference::count()
{
TestType *tt = new TestType;
tt->data.append(tt);
@@ -489,7 +489,7 @@ void tst_QmlList::count()
}
}
-void tst_QmlList::copy()
+void tst_qmllistreference::copy()
{
TestType tt;
tt.data.append(&tt);
@@ -517,7 +517,7 @@ void tst_QmlList::copy()
QVERIFY(r3.count() == 2);
}
-void tst_QmlList::qmlmetaproperty()
+void tst_qmllistreference::qmlmetaproperty()
{
TestType tt;
tt.data.append(&tt);
@@ -532,7 +532,7 @@ void tst_QmlList::qmlmetaproperty()
QVERIFY(ref.listElementType() == &TestType::staticMetaObject);
}
-void tst_QmlList::engineTypes()
+void tst_qmllistreference::engineTypes()
{
QmlEngine engine;
QmlComponent component(&engine, TEST_FILE("engineTypes.qml"));
@@ -555,7 +555,7 @@ void tst_QmlList::engineTypes()
delete o;
}
-void tst_QmlList::variantToList()
+void tst_qmllistreference::variantToList()
{
QmlEngine engine;
QmlComponent component(&engine, TEST_FILE("variantToList.qml"));
@@ -569,6 +569,6 @@ void tst_QmlList::variantToList()
delete o;
}
-QTEST_MAIN(tst_QmlList)
+QTEST_MAIN(tst_qmllistreference)
-#include "tst_qmllist.moc"
+#include "tst_qmllistreference.moc"
diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
index 050cd3f..c289641 100644
--- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
+++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
@@ -121,6 +121,7 @@ private slots:
// Bugs
void crashOnValueProperty();
+ void copy();
private:
QmlEngine engine;
};
@@ -129,7 +130,7 @@ void tst_qmlmetaproperty::qmlmetaproperty()
{
QmlMetaProperty prop;
- QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0));
+ QGuard<QmlBinding> binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext()));
QVERIFY(binding != 0);
QGuard<QmlExpression> expression(new QmlExpression());
QVERIFY(expression != 0);
@@ -218,7 +219,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object()
{
QmlMetaProperty prop(&object);
- QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0));
+ QGuard<QmlBinding> binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext()));
QVERIFY(binding != 0);
QGuard<QmlExpression> expression(new QmlExpression());
QVERIFY(expression != 0);
@@ -264,7 +265,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object()
{
QmlMetaProperty prop(&dobject);
- QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0));
+ QGuard<QmlBinding> binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext()));
binding->setTarget(prop);
QVERIFY(binding != 0);
QGuard<QmlExpression> expression(new QmlExpression());
@@ -319,7 +320,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string()
{
QmlMetaProperty prop(&object, QString("defaultProperty"));
- QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0));
+ QGuard<QmlBinding> binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext()));
QVERIFY(binding != 0);
QGuard<QmlExpression> expression(new QmlExpression());
QVERIFY(expression != 0);
@@ -365,7 +366,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string()
{
QmlMetaProperty prop(&dobject, QString("defaultProperty"));
- QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0));
+ QGuard<QmlBinding> binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext()));
binding->setTarget(prop);
QVERIFY(binding != 0);
QGuard<QmlExpression> expression(new QmlExpression());
@@ -414,7 +415,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string()
{
QmlMetaProperty prop(&dobject, QString("onClicked"));
- QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0));
+ QGuard<QmlBinding> binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext()));
binding->setTarget(prop);
QVERIFY(binding != 0);
QGuard<QmlExpression> expression(new QmlExpression());
@@ -468,7 +469,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_context()
{
QmlMetaProperty prop(&object, engine.rootContext());
- QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0));
+ QGuard<QmlBinding> binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext()));
QVERIFY(binding != 0);
QGuard<QmlExpression> expression(new QmlExpression());
QVERIFY(expression != 0);
@@ -514,7 +515,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_context()
{
QmlMetaProperty prop(&dobject, engine.rootContext());
- QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0));
+ QGuard<QmlBinding> binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext()));
binding->setTarget(prop);
QVERIFY(binding != 0);
QGuard<QmlExpression> expression(new QmlExpression());
@@ -569,7 +570,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string_context()
{
QmlMetaProperty prop(&object, QString("defaultProperty"), engine.rootContext());
- QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0));
+ QGuard<QmlBinding> binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext()));
QVERIFY(binding != 0);
QGuard<QmlExpression> expression(new QmlExpression());
QVERIFY(expression != 0);
@@ -615,7 +616,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string_context()
{
QmlMetaProperty prop(&dobject, QString("defaultProperty"), engine.rootContext());
- QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0));
+ QGuard<QmlBinding> binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext()));
binding->setTarget(prop);
QVERIFY(binding != 0);
QGuard<QmlExpression> expression(new QmlExpression());
@@ -664,7 +665,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string_context()
{
QmlMetaProperty prop(&dobject, QString("onClicked"), engine.rootContext());
- QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0));
+ QGuard<QmlBinding> binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext()));
binding->setTarget(prop);
QVERIFY(binding != 0);
QGuard<QmlExpression> expression(new QmlExpression());
@@ -1131,6 +1132,48 @@ void tst_qmlmetaproperty::crashOnValueProperty()
QCOMPARE(p.read(), QVariant(20));
}
+void tst_qmlmetaproperty::copy()
+{
+ PropertyObject object;
+
+ QmlMetaProperty *property = new QmlMetaProperty(&object, QLatin1String("defaultProperty"));
+ QCOMPARE(property->name(), QString("defaultProperty"));
+ QCOMPARE(property->read(), QVariant(10));
+ QCOMPARE(property->type(), QmlMetaProperty::Property);
+ QCOMPARE(property->propertyCategory(), QmlMetaProperty::Normal);
+ QCOMPARE(property->propertyType(), (int)QVariant::Int);
+
+ QmlMetaProperty p1(*property);
+ QCOMPARE(p1.name(), QString("defaultProperty"));
+ QCOMPARE(p1.read(), QVariant(10));
+ QCOMPARE(p1.type(), QmlMetaProperty::Property);
+ QCOMPARE(p1.propertyCategory(), QmlMetaProperty::Normal);
+ QCOMPARE(p1.propertyType(), (int)QVariant::Int);
+
+ QmlMetaProperty p2(&object, QLatin1String("url"));
+ QCOMPARE(p2.name(), QString("url"));
+ p2 = *property;
+ QCOMPARE(p2.name(), QString("defaultProperty"));
+ QCOMPARE(p2.read(), QVariant(10));
+ QCOMPARE(p2.type(), QmlMetaProperty::Property);
+ QCOMPARE(p2.propertyCategory(), QmlMetaProperty::Normal);
+ QCOMPARE(p2.propertyType(), (int)QVariant::Int);
+
+ delete property; property = 0;
+
+ QCOMPARE(p1.name(), QString("defaultProperty"));
+ QCOMPARE(p1.read(), QVariant(10));
+ QCOMPARE(p1.type(), QmlMetaProperty::Property);
+ QCOMPARE(p1.propertyCategory(), QmlMetaProperty::Normal);
+ QCOMPARE(p1.propertyType(), (int)QVariant::Int);
+
+ QCOMPARE(p2.name(), QString("defaultProperty"));
+ QCOMPARE(p2.read(), QVariant(10));
+ QCOMPARE(p2.type(), QmlMetaProperty::Property);
+ QCOMPARE(p2.propertyCategory(), QmlMetaProperty::Normal);
+ QCOMPARE(p2.propertyType(), (int)QVariant::Int);
+}
+
QTEST_MAIN(tst_qmlmetaproperty)
#include "tst_qmlmetaproperty.moc"