summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2009-08-31 08:40:12 (GMT)
committerMartin Smith <msmith@trolltech.com>2009-08-31 08:40:12 (GMT)
commit734badac98a81b6a1937dc94ac52839c52eee8a9 (patch)
tree12419f5ce18c593a843c76ad57f1f3bce9526cf1 /tests/auto
parent68dc7ed9338eb555eb78d9993490434284bdc223 (diff)
parent174bef24f10242b042dad626f8b68a95bdfb7ac7 (diff)
downloadQt-734badac98a81b6a1937dc94ac52839c52eee8a9.zip
Qt-734badac98a81b6a1937dc94ac52839c52eee8a9.tar.gz
Qt-734badac98a81b6a1937dc94ac52839c52eee8a9.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qdbusmarshall/common.h35
-rw-r--r--tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp18
-rw-r--r--tests/auto/qmake/testdata/findDeps/findDeps.pro7
-rw-r--r--tests/auto/qmake/testdata/findMocs/findMocs.pro7
-rw-r--r--tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp44
-rw-r--r--tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp41
6 files changed, 87 insertions, 65 deletions
diff --git a/tests/auto/qdbusmarshall/common.h b/tests/auto/qdbusmarshall/common.h
index 9df1e01..bdc9f09 100644
--- a/tests/auto/qdbusmarshall/common.h
+++ b/tests/auto/qdbusmarshall/common.h
@@ -103,6 +103,34 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, MyStruct &ms)
return arg;
}
+struct MyVariantMapStruct
+{
+ QString s;
+ QVariantMap map;
+
+ inline bool operator==(const MyVariantMapStruct &other) const
+ { return s == other.s && map == other.map; }
+};
+Q_DECLARE_METATYPE(MyVariantMapStruct)
+Q_DECLARE_METATYPE(QList<MyVariantMapStruct>)
+
+QDBusArgument &operator<<(QDBusArgument &arg, const MyVariantMapStruct &ms)
+{
+ arg.beginStructure();
+ arg << ms.s << ms.map;
+ arg.endStructure();
+ return arg;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &arg, MyVariantMapStruct &ms)
+{
+ arg.beginStructure();
+ arg >> ms.s >> ms.map;
+ arg.endStructure();
+ return arg;
+}
+
+
void commonInit()
{
qDBusRegisterMetaType<QList<QDateTime> >();
@@ -127,6 +155,8 @@ void commonInit()
qDBusRegisterMetaType<QHash<QDBusSignature, QString> >();
qDBusRegisterMetaType<MyStruct>();
+ qDBusRegisterMetaType<MyVariantMapStruct>();
+ qDBusRegisterMetaType<QList<MyVariantMapStruct> >();
}
#ifdef USE_PRIVATE_CODE
#include "private/qdbusintrospection_p.h"
@@ -476,6 +506,11 @@ bool compareToArgument(const QDBusArgument &arg, const QVariant &v2)
else if (id == qMetaTypeId<MyStruct>())
return compare<MyStruct>(arg, v2);
+
+ else if (id == qMetaTypeId<MyVariantMapStruct>())
+ return compare<MyVariantMapStruct>(arg, v2);
+ else if (id == qMetaTypeId<QList<MyVariantMapStruct> >())
+ return compare<QList<MyVariantMapStruct> >(arg, v2);
}
qWarning() << "Unexpected QVariant type" << v2.userType()
diff --git a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
index 7a851b5..238e0c9 100644
--- a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
+++ b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
@@ -497,6 +497,24 @@ void tst_QDBusMarshall::sendStructs_data()
QTest::newRow("time") << QVariant(time) << "(iiii)" << "[Argument: (iiii) 12, 25, 0, 0]";
QTest::newRow("datetime") << QVariant(QDateTime(date, time)) << "((iii)(iiii)i)"
<< "[Argument: ((iii)(iiii)i) [Argument: (iii) 2006, 6, 18], [Argument: (iiii) 12, 25, 0, 0], 0]";
+
+ MyStruct ms = { 1, "Hello, World" };
+ QTest::newRow("int-string") << qVariantFromValue(ms) << "(is)" << "[Argument: (is) 1, \"Hello, World\"]";
+
+ MyVariantMapStruct mvms = { "Hello, World", QVariantMap() };
+ QTest::newRow("string-variantmap") << qVariantFromValue(mvms) << "(sa{sv})" << "[Argument: (sa{sv}) \"Hello, World\", [Argument: a{sv} {}]]";
+
+ // use only basic types, otherwise comparison will fail
+ mvms.map["int"] = 42;
+ mvms.map["uint"] = 42u;
+ mvms.map["short"] = qVariantFromValue<short>(-47);
+ mvms.map["bytearray"] = QByteArray("Hello, world");
+ QTest::newRow("string-variantmap2") << qVariantFromValue(mvms) << "(sa{sv})" << "[Argument: (sa{sv}) \"Hello, World\", [Argument: a{sv} {\"bytearray\" = [Variant(QByteArray): {72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100}], \"int\" = [Variant(int): 42], \"short\" = [Variant(short): -47], \"uint\" = [Variant(uint): 42]}]]";
+
+ QList<MyVariantMapStruct> list;
+ QTest::newRow("empty-list-of-string-variantmap") << qVariantFromValue(list) << "a(sa{sv})" << "[Argument: a(sa{sv}) {}]";
+ list << mvms;
+ QTest::newRow("list-of-string-variantmap") << qVariantFromValue(list) << "a(sa{sv})" << "[Argument: a(sa{sv}) {[Argument: (sa{sv}) \"Hello, World\", [Argument: a{sv} {\"bytearray\" = [Variant(QByteArray): {72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100}], \"int\" = [Variant(int): 42], \"short\" = [Variant(short): -47], \"uint\" = [Variant(uint): 42]}]]}]";
}
void tst_QDBusMarshall::sendComplex_data()
diff --git a/tests/auto/qmake/testdata/findDeps/findDeps.pro b/tests/auto/qmake/testdata/findDeps/findDeps.pro
index e0a2b86..43577b5 100644
--- a/tests/auto/qmake/testdata/findDeps/findDeps.pro
+++ b/tests/auto/qmake/testdata/findDeps/findDeps.pro
@@ -1,11 +1,8 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Thu Mar 12 11:08:20 2009
-######################################################################
-
TEMPLATE = app
-TARGET =
+TARGET = findDeps
DEPENDPATH += .
INCLUDEPATH += .
+DESTDIR = ./
# Input
HEADERS += object1.h \
diff --git a/tests/auto/qmake/testdata/findMocs/findMocs.pro b/tests/auto/qmake/testdata/findMocs/findMocs.pro
index daa3c7f..1469b4c 100644
--- a/tests/auto/qmake/testdata/findMocs/findMocs.pro
+++ b/tests/auto/qmake/testdata/findMocs/findMocs.pro
@@ -1,11 +1,8 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Mar 11 16:11:09 2009
-######################################################################
-
TEMPLATE = app
-TARGET =
+TARGET = findMocs
DEPENDPATH += .
INCLUDEPATH += .
+DESTDIR = ./
# Input
HEADERS += object1.h object2.h object3.h object4.h object5.h object6.h object7.h
diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
index f515304..2504951 100644
--- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
+++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
@@ -561,8 +561,6 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCall()
spy->clear();
QVERIFY(eng.evaluate("(function() { return 123; } )()").toNumber()==123);
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort);
QCOMPARE(spy->count(), 4);
// evaluate() entry
@@ -576,7 +574,11 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCall()
// anonymous function exit
QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(2).value.isNumber());
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QCOMPARE(spy->at(2).value.toNumber(), qsreal(123));
// evaluate() exit
@@ -598,8 +600,6 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCallWithoutReturn()
spy->clear();
eng.evaluate("(function() { var a = 123; } )()");
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort);
QCOMPARE(spy->count(), 4);
// evaluate() entry
@@ -642,8 +642,6 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionDefinition()
QVERIFY(spy->at(1).value.isUndefined());
eng.evaluate("foo()");
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort);
QCOMPARE(spy->count(), 6);
// evaluate() entry
@@ -657,7 +655,11 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionDefinition()
// foo() exit
QCOMPARE(spy->at(4).type, ScriptEngineEvent::FunctionExit);
QCOMPARE(spy->at(4).scriptId, spy->at(0).scriptId);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(4).value.isNumber());
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QCOMPARE(spy->at(4).value.toNumber(), qsreal(456));
// evaluate() exit
@@ -719,8 +721,6 @@ void tst_QScriptEngineAgent::functionEntryAndExit_native2()
spy->clear();
eng.evaluate("nativeFunctionCallingArg(function() { return 123; })");
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort);
QCOMPARE(spy->count(), 6);
// evaluate() entry
@@ -1035,8 +1035,6 @@ void tst_QScriptEngineAgent::functionEntryAndExit_call()
spy->clear();
fun.call();
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "functionExit() is not called for JS functions when JIT is enabled", Abort);
QCOMPARE(spy->count(), 2);
// entry
@@ -1046,7 +1044,11 @@ void tst_QScriptEngineAgent::functionEntryAndExit_call()
// exit
QCOMPARE(spy->at(1).type, ScriptEngineEvent::FunctionExit);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(1).value.isNumber());
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QCOMPARE(spy->at(1).value.toNumber(), qsreal(123));
}
delete spy;
@@ -1650,8 +1652,6 @@ void tst_QScriptEngineAgent::eventOrder_functionDefinition()
QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit);
eng.evaluate("foo(123)");
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort);
QCOMPARE(spy->count(), 13);
// load
QCOMPARE(spy->at(3).type, ScriptEngineEvent::ScriptLoad);
@@ -1774,8 +1774,6 @@ void tst_QScriptEngineAgent::eventOrder_functions()
QCOMPARE(spy->count(), 6);
eng.evaluate("foo(123)");
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort);
QCOMPARE(spy->count(), 21);
// load
@@ -1803,12 +1801,16 @@ void tst_QScriptEngineAgent::eventOrder_functions()
// bar() exit
QCOMPARE(spy->at(15).type, ScriptEngineEvent::FunctionExit);
QCOMPARE(spy->at(15).scriptId, spy->at(3).scriptId);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(15).value.isNumber());
// restore context
QCOMPARE(spy->at(16).type, ScriptEngineEvent::ContextPop);
// foo() exit
QCOMPARE(spy->at(17).type, ScriptEngineEvent::FunctionExit);
QCOMPARE(spy->at(17).scriptId, spy->at(0).scriptId);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(17).value.isNumber());
// restore context
QCOMPARE(spy->at(18).type, ScriptEngineEvent::ContextPop);
@@ -1873,21 +1875,33 @@ void tst_QScriptEngineAgent::eventOrder_functions()
// bar() exit
QCOMPARE(spy->at(39).type, ScriptEngineEvent::FunctionExit);
QCOMPARE(spy->at(39).scriptId, spy->at(21).scriptId);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(39).value.isError());
// restore context
QCOMPARE(spy->at(40).type, ScriptEngineEvent::ContextPop);
// foo() exit
QCOMPARE(spy->at(41).type, ScriptEngineEvent::FunctionExit);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "script ID for function exit is not correct when JIT is enabled", Continue);
QCOMPARE(spy->at(41).scriptId, spy->at(0).scriptId);
QVERIFY(spy->at(41).value.isError());
// restore context
QCOMPARE(spy->at(42).type, ScriptEngineEvent::ContextPop);
// evaluate() exit
QCOMPARE(spy->at(43).type, ScriptEngineEvent::FunctionExit);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "script ID for function exit is not correct when JIT is enabled", Continue);
QCOMPARE(spy->at(43).scriptId, spy->at(26).scriptId);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(43).value.isError());
// unload
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "wrong event type when JIT is enabled", Continue);
QCOMPARE(spy->at(44).type, ScriptEngineEvent::ScriptUnload);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "wrong script ID when JIT is enabled", Continue);
QCOMPARE(spy->at(44).scriptId, spy->at(25).scriptId);
}
delete spy;
@@ -1946,6 +1960,8 @@ void tst_QScriptEngineAgent::eventOrder_signalsHandling()
emit testSignal(123);
+ if (qt_script_isJITEnabled())
+ QEXPECT_FAIL("", "too many events reported when JIT is enabled", Abort);
QCOMPARE(spy->count(), 14);
// new context
QCOMPARE(spy->at(4).type, ScriptEngineEvent::ContextPush);
diff --git a/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp b/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp
index a8c1648..15b7e0b 100644
--- a/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp
+++ b/tests/auto/xmlpatternsxqts/lib/tests/XMLWriterTest.cpp
@@ -38,47 +38,6 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Patternist project on Qt Labs.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
-**
-***************************************************************************
- */
#include <QtTest/QtTest>