aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/parserstress/tst_parserstress.cpp10
-rw-r--r--tests/auto/qml/qqmlecmascript/data/singletontype/singletonWithEnum.qml9
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.cpp7
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h10
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp13
-rw-r--r--tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp29
6 files changed, 67 insertions, 11 deletions
diff --git a/tests/auto/qml/parserstress/tst_parserstress.cpp b/tests/auto/qml/parserstress/tst_parserstress.cpp
index 15b3ff56b6..07d02055c2 100644
--- a/tests/auto/qml/parserstress/tst_parserstress.cpp
+++ b/tests/auto/qml/parserstress/tst_parserstress.cpp
@@ -93,16 +93,8 @@ void tst_parserstress::ecmascript_data()
QStringList files = findJSFiles(dir);
QTest::addColumn<QString>("file");
- foreach (const QString &file, files) {
- // Skip, QTBUG-34047
- if (file.endsWith(QStringLiteral("tests/ecma_3/Statements/regress-324650.js")))
- continue;
- if (file.endsWith(QStringLiteral("tests/ecma_3/Statements/regress-74474-002.js")))
- continue;
- if (file.endsWith(QStringLiteral("tests/ecma_3/Statements/regress-74474-003.js")))
- continue;
+ foreach (const QString &file, files)
QTest::newRow(qPrintable(file)) << file;
- }
}
void tst_parserstress::ecmascript()
diff --git a/tests/auto/qml/qqmlecmascript/data/singletontype/singletonWithEnum.qml b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonWithEnum.qml
new file mode 100644
index 0000000000..166f823667
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/singletontype/singletonWithEnum.qml
@@ -0,0 +1,9 @@
+import QtQml 2.0
+import Qt.test.singletonWithEnum 1.0
+
+QtObject {
+ property int testValue: 0
+ Component.onCompleted: {
+ testValue = SingletonWithEnum.TestValue;
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp
index 22fac2013e..eb06b9e57d 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.cpp
+++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp
@@ -295,6 +295,11 @@ bool MyInheritedQmlObject::isItYouMyInheritedQmlObject(MyInheritedQmlObject *o)
return o && o == theSingletonObject;
}
+static QObject *create_singletonWithEnum(QQmlEngine *, QJSEngine *)
+{
+ return new SingletonWithEnum;
+}
+
void registerTypes()
{
qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObjectAlias");
@@ -374,6 +379,8 @@ void registerTypes()
qmlRegisterSingletonType<testImportOrderApi>("NamespaceAndType",1,0,"NamespaceAndType",testImportOrder_api);
qmlRegisterSingletonType<testImportOrderApi>("Qt.test.importOrderApi1",1,0,"Data",testImportOrder_api1);
qmlRegisterSingletonType<testImportOrderApi>("Qt.test.importOrderApi2",1,0,"Data",testImportOrder_api2);
+
+ qmlRegisterSingletonType<SingletonWithEnum>("Qt.test.singletonWithEnum", 1, 0, "SingletonWithEnum", create_singletonWithEnum);
}
#include "testtypes.moc"
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 556cc32fd3..2aef1d644d 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -1651,6 +1651,16 @@ public:
QML_DECLARE_TYPEINFO(FallbackBindingsTypeObject, QML_HAS_ATTACHED_PROPERTIES)
QML_DECLARE_TYPEINFO(FallbackBindingsTypeDerived, QML_HAS_ATTACHED_PROPERTIES)
+class SingletonWithEnum : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(TestEnum)
+public:
+ enum TestEnum {
+ TestValue = 42
+ };
+};
+
void registerTypes();
#endif // TESTTYPES_H
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index d06266a360..ea7259c597 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -320,6 +320,7 @@ private slots:
void idsAsLValues();
void qtbug_34792();
void noCaptureWhenWritingProperty();
+ void singletonWithEnum();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -7510,6 +7511,18 @@ void tst_qqmlecmascript::noCaptureWhenWritingProperty()
QCOMPARE(obj->property("somePropertyEvaluated").toBool(), false);
}
+void tst_qqmlecmascript::singletonWithEnum()
+{
+ QQmlComponent component(&engine, testFileUrl("singletontype/singletonWithEnum.qml"));
+ QScopedPointer<QObject> obj(component.create());
+ if (obj.isNull())
+ qDebug() << component.errors().first().toString();
+ QVERIFY(!obj.isNull());
+ QVariant prop = obj->property("testValue");
+ QVERIFY(prop.type() == QVariant::Int);
+ QCOMPARE(prop.toInt(), int(SingletonWithEnum::TestValue));
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"
diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
index 28a9bce98d..669ae7d5ea 100644
--- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
+++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
@@ -72,6 +72,7 @@ private slots:
void QTBUG_29836();
void QTBUG_35233();
void disallowExtending();
+ void QTBUG_35906();
};
class LazyPropertyMap : public QQmlPropertyMap, public QQmlParserStatus
@@ -79,7 +80,7 @@ class LazyPropertyMap : public QQmlPropertyMap, public QQmlParserStatus
Q_OBJECT
Q_INTERFACES(QQmlParserStatus)
- Q_PROPERTY(int someFixedProperty READ someFixedProperty WRITE setSomeFixedProperty)
+ Q_PROPERTY(int someFixedProperty READ someFixedProperty WRITE setSomeFixedProperty NOTIFY someFixedPropertyChanged)
public:
LazyPropertyMap()
: QQmlPropertyMap(this, /*parent*/0)
@@ -92,7 +93,10 @@ public:
}
int someFixedProperty() const { return value; }
- void setSomeFixedProperty(int v) { value = v; }
+ void setSomeFixedProperty(int v) { value = v; emit someFixedPropertyChanged(); }
+
+signals:
+ void someFixedPropertyChanged();
private:
int value;
@@ -450,6 +454,27 @@ void tst_QQmlPropertyMap::disallowExtending()
QCOMPARE(component.errors().at(0).toString(), QStringLiteral("<Unknown File>: Fully dynamic types cannot declare new properties."));
}
+void tst_QQmlPropertyMap::QTBUG_35906()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQml 2.0\n"
+ "import QTBUG_35233 1.0\n"
+ "QtObject {\n"
+ " property int testValue: mapById.someFixedProperty\n"
+ "\n"
+ " property QtObject maProperty: LazyPropertyMap {\n"
+ " id: mapById\n"
+ " someFixedProperty: 42\n"
+ " }\n"
+ "}\n", QUrl());
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+ QVariant value = obj->property("testValue");
+ QVERIFY(value.type() == QVariant::Int);
+ QCOMPARE(value.toInt(), 42);
+}
+
QTEST_MAIN(tst_QQmlPropertyMap)
#include "tst_qqmlpropertymap.moc"