aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp4
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalHandlers.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp5
-rw-r--r--tests/auto/qml/qqmlerror/tst_qqmlerror.cpp2
-rw-r--r--tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp2
-rw-r--r--tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp2
-rw-r--r--tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp6
-rw-r--r--tests/auto/qml/qqmllocale/tst_qqmllocale.cpp36
-rw-r--r--tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp6
-rw-r--r--tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp4
12 files changed, 68 insertions, 18 deletions
diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
index bca40e9acd..4a8025c254 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
@@ -124,7 +124,7 @@ void tst_QQmlDebugClient::state()
QTRY_COMPARE(client.state(), QQmlDebugClient::Unavailable);
// duplicate plugin name
- QTest::ignoreMessage(QtWarningMsg, "QQmlDebugClient: Conflicting plugin name \"tst_QQmlDebugClient::state()\" ");
+ QTest::ignoreMessage(QtWarningMsg, "QQmlDebugClient: Conflicting plugin name \"tst_QQmlDebugClient::state()\"");
QQmlDebugClient client2("tst_QQmlDebugClient::state()", m_conn);
QCOMPARE(client2.state(), QQmlDebugClient::NotConnected);
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
index 1c1d84f37b..c50bb10035 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -164,7 +164,7 @@ void tst_QQmlDebugService::state()
QTRY_COMPARE(service.state(), QQmlDebugService::Unavailable);
- QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::state()\" ");
+ QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::state()\"");
QQmlDebugTestService duplicate("tst_QQmlDebugService::state()");
QCOMPARE(duplicate.state(), QQmlDebugService::NotConnected);
}
@@ -183,7 +183,7 @@ void tst_QQmlDebugService::sendMessage()
QByteArray resp = client.waitForResponse();
QCOMPARE(resp, msg);
- QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::sendMessage()\" ");
+ QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::sendMessage()\"");
QQmlDebugTestService duplicate("tst_QQmlDebugService::sendMessage()");
duplicate.sendMessage("msg");
}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml
index 7e85312692..cd68fb9b82 100644
--- a/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml
+++ b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml
@@ -91,4 +91,15 @@ QtObject {
testObjectWithAliasHandler.count++
return testObjectWithAliasHandler.testSuccess
}
+
+ signal signalWithClosureArgument(var f)
+ onSignalWithClosureArgument: f()
+
+ function testSignalWithClosureArgument() {
+ var testSuccess = false
+ signalWithClosureArgument(function() {
+ testSuccess = true
+ })
+ return testSuccess
+ }
}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index c45750caac..b11ad2dd0e 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -3910,7 +3910,7 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) {
QV4::Scope scope(v4);
QV4::ScopedArrayObject scripts(scope, ctxt->importedScripts);
QV4::ScopedValue qml(scope);
- for (quint32 i = 0; i < scripts->arrayLength(); ++i) {
+ for (quint32 i = 0; i < scripts->getLength(); ++i) {
QQmlContextData *scriptContext, *newContext;
qml = scripts->getIndexed(i);
@@ -6069,6 +6069,9 @@ void tst_qqmlecmascript::signalHandlers()
QMetaObject::invokeMethod(o, "testAliasSignalHandler", Q_RETURN_ARG(QVariant, result));
QCOMPARE(result.toBool(), true);
+ QMetaObject::invokeMethod(o, "testSignalWithClosureArgument", Q_RETURN_ARG(QVariant, result));
+ QCOMPARE(result.toBool(), true);
+
delete o;
}
diff --git a/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp b/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp
index 44fbb0a982..c3d8a1502c 100644
--- a/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp
+++ b/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp
@@ -203,7 +203,7 @@ void tst_qqmlerror::debug()
error.setLine(92);
error.setColumn(13);
- QTest::ignoreMessage(QtWarningMsg, "http://www.qt-project.org/main.qml:92:13: An Error ");
+ QTest::ignoreMessage(QtWarningMsg, "http://www.qt-project.org/main.qml:92:13: An Error");
qWarning() << error;
}
diff --git a/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp b/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp
index 793da64734..2d7e0a8594 100644
--- a/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp
+++ b/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp
@@ -63,7 +63,7 @@ void tst_qqmlglobal::initTestCase()
void tst_qqmlglobal::colorProviderWarning()
{
- const QLatin1String expected("Warning: QQml_colorProvider: no color provider has been set! ");
+ const QLatin1String expected("Warning: QQml_colorProvider: no color provider has been set!");
QTest::ignoreMessage(QtWarningMsg, expected.data());
QQml_colorProvider();
}
diff --git a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
index 0cd4360e67..9d62aa2984 100644
--- a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
+++ b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
@@ -500,7 +500,7 @@ void tst_qqmlinstruction::dump()
<< "8\t\tSTORE_INTEGER\t\t5\t9"
<< "9\t\tSTORE_BOOL\t\t6\ttrue"
<< "10\t\tSTORE_STRING\t\t7\t1\t\t\"Test String\""
- << "11\t\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.qt-project.org\") "
+ << "11\t\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.qt-project.org\")"
<< "12\t\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\""
<< "13\t\tSTORE_DATE\t\t10\t9"
<< "14\t\tSTORE_TIME\t\t11"
diff --git a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp
index d5e85f478d..143164841f 100644
--- a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp
+++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp
@@ -1725,11 +1725,11 @@ void tst_qqmllistcompositor::changeDebug()
void tst_qqmllistcompositor::groupDebug()
{
- QTest::ignoreMessage(QtDebugMsg, "Default ");
+ QTest::ignoreMessage(QtDebugMsg, "Default");
qDebug() << C::Default;
- QTest::ignoreMessage(QtDebugMsg, "Cache ");
+ QTest::ignoreMessage(QtDebugMsg, "Cache");
qDebug() << C::Cache;
- QTest::ignoreMessage(QtDebugMsg, "Group3 ");
+ QTest::ignoreMessage(QtDebugMsg, "Group3");
qDebug() << Selection;
}
diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
index d565ad557c..0eb38d92e6 100644
--- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
+++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
@@ -117,6 +117,7 @@ private slots:
void stringLocaleCompare_data();
void stringLocaleCompare();
+ void localeAsCppProperty();
private:
void addPropertyData(const QString &l);
QVariant getProperty(QObject *obj, const QString &locale, const QString &property);
@@ -1223,6 +1224,41 @@ void tst_qqmllocale::stringLocaleCompare()
QCOMPARE(obj->property("comparison").toInt(), QString::localeAwareCompare(string1, string2));
}
+class Calendar : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale)
+public:
+ Calendar() {
+ }
+
+ QLocale locale() const {
+ return mLocale;
+ }
+
+ void setLocale(const QLocale &locale) {
+ mLocale = locale;
+ }
+private:
+ QLocale mLocale;
+};
+
+void tst_qqmllocale::localeAsCppProperty()
+{
+ QQmlComponent component(&engine);
+ qmlRegisterType<Calendar>("Test", 1, 0, "Calendar");
+ component.setData("import QtQml 2.2\nimport Test 1.0\nCalendar { locale: Qt.locale('en_GB'); property var testLocale }", QUrl());
+ QVERIFY(!component.isError());
+ QTRY_VERIFY(component.isReady());
+
+ Calendar *item = qobject_cast<Calendar*>(component.create());
+ QCOMPARE(item->property("locale").toLocale().name(), QLatin1String("en_GB"));
+
+ QVariant localeVariant(QLocale("nb_NO"));
+ item->setProperty("testLocale", localeVariant);
+ QCOMPARE(item->property("testLocale").toLocale().name(), QLatin1String("nb_NO"));
+}
+
class DateFormatter : public QObject
{
Q_OBJECT
diff --git a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
index b1f83fcd6c..b0c7c5e81a 100644
--- a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
+++ b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
@@ -329,11 +329,11 @@ void tst_QQmlMetaObject::method_data()
<< (QList<QByteArray>() << "int" << "bool" << "double")
<< (QList<QByteArray>() << "foo" << "bar" << "baz");
QTest::newRow("testSignal(variant foo, var bar)") << "signal.4.qml"
- << "testSignal(QVariant,QVariant)"
+ << "testSignal(QVariant,QJSValue)"
<< QMetaMethod::Signal
<< int(QMetaType::Void) << "void"
- << (QList<int>() << QMetaType::QVariant << QMetaType::QVariant)
- << (QList<QByteArray>() << "QVariant" << "QVariant")
+ << (QList<int>() << QMetaType::QVariant << qMetaTypeId<QJSValue>())
+ << (QList<QByteArray>() << "QVariant" << "QJSValue")
<< (QList<QByteArray>() << "foo" << "bar");
QTest::newRow("testSignal(color foo, date bar, url baz)") << "signal.5.qml"
<< "testSignal(QColor,QDateTime,QUrl)"
diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
index 62b64a3ef1..669ae7d5ea 100644
--- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
+++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
@@ -123,21 +123,21 @@ void tst_QQmlPropertyMap::insert()
//inserting property names same with existing method(signal, slot, method) names is not allowed
//QQmlPropertyMap has an invokable keys() method
- QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols. ");
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols.");
map.insert(QLatin1String("keys"), 1);
QVERIFY(map.keys().count() == 2);
QVERIFY(!map.contains(QLatin1String("keys")));
QVERIFY(map.value(QLatin1String("keys")).isNull());
//QQmlPropertyMap has a deleteLater() slot
- QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols. ");
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols.");
map.insert(QLatin1String("deleteLater"), 1);
QVERIFY(map.keys().count() == 2);
QVERIFY(!map.contains(QLatin1String("deleteLater")));
QVERIFY(map.value(QLatin1String("deleteLater")).isNull());
//QQmlPropertyMap has an valueChanged() signal
- QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols. ");
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols.");
map.insert(QLatin1String("valueChanged"), 1);
QVERIFY(map.keys().count() == 2);
QVERIFY(!map.contains(QLatin1String("valueChanged")));
diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
index 7c0507dce3..5b8695f8f8 100644
--- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
+++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
@@ -804,7 +804,7 @@ void tst_qqmlvaluetypes::font()
// Test pixelSize and pointSize
{
QQmlComponent component(&engine, testFileUrl("font_write.3.qml"));
- QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. ");
+ QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size.");
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -814,7 +814,7 @@ void tst_qqmlvaluetypes::font()
}
{
QQmlComponent component(&engine, testFileUrl("font_write.4.qml"));
- QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. ");
+ QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size.");
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);