summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/kernel')
-rw-r--r--tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp24
-rw-r--r--tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp4
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp2
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp28
4 files changed, 30 insertions, 28 deletions
diff --git a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
index 98e90ed805..009b4fadda 100644
--- a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
+++ b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
@@ -205,7 +205,7 @@ void tst_QMetaMethod::method_data()
<< (QList<int>())
<< (QList<QByteArray>())
<< (QList<QByteArray>())
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("voidInvokable")
@@ -241,7 +241,7 @@ void tst_QMetaMethod::method_data()
<< QList<int>()
<< QList<QByteArray>()
<< QList<QByteArray>()
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("voidSignalInt")
@@ -250,7 +250,7 @@ void tst_QMetaMethod::method_data()
<< (QList<int>() << int(QMetaType::Int))
<< (QList<QByteArray>() << QByteArray("int"))
<< (QList<QByteArray>() << QByteArray("voidSignalIntArg"))
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("voidInvokableInt")
@@ -286,7 +286,7 @@ void tst_QMetaMethod::method_data()
<< (QList<int>() << qMetaTypeId<qreal>())
<< (QList<QByteArray>() << QByteArray("qreal"))
<< (QList<QByteArray>() << QByteArray("voidSignalQRealArg"))
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("voidInvokableQReal")
@@ -322,7 +322,7 @@ void tst_QMetaMethod::method_data()
<< (QList<int>() << int(QMetaType::QString))
<< (QList<QByteArray>() << QByteArray("QString"))
<< (QList<QByteArray>() << QByteArray("voidSignalQStringArg"))
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("voidInvokableQString")
@@ -358,7 +358,7 @@ void tst_QMetaMethod::method_data()
<< (QList<int>() << qMetaTypeId<CustomType>())
<< (QList<QByteArray>() << QByteArray("CustomType"))
<< (QList<QByteArray>() << QByteArray("voidSignalCustomTypeArg"))
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("voidInvokableCustomType")
@@ -394,7 +394,7 @@ void tst_QMetaMethod::method_data()
<< (QList<int>() << 0)
<< (QList<QByteArray>() << QByteArray("CustomUnregisteredType"))
<< (QList<QByteArray>() << QByteArray("voidSignalCustomUnregisteredTypeArg"))
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("voidInvokableCustomUnregisteredType")
@@ -430,7 +430,7 @@ void tst_QMetaMethod::method_data()
<< (QList<int>())
<< (QList<QByteArray>())
<< (QList<QByteArray>())
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("boolInvokable")
@@ -457,7 +457,7 @@ void tst_QMetaMethod::method_data()
<< (QList<int>())
<< (QList<QByteArray>())
<< (QList<QByteArray>())
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("qrealInvokable")
@@ -484,7 +484,7 @@ void tst_QMetaMethod::method_data()
<< (QList<int>())
<< (QList<QByteArray>())
<< (QList<QByteArray>())
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("qstringInvokable")
@@ -529,7 +529,7 @@ void tst_QMetaMethod::method_data()
"bool,int,uint,qlonglong,qulonglong,double,long,short,char,ulong,ushort,uchar,float)")
<< int(QMetaType::QVariant) << QByteArray("QVariant")
<< parameterTypes << parameterTypeNames << parameterNames
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("qvariantInvokableBoolIntUIntLonglongULonglongDoubleLongShortCharUlongUshortUcharFloat")
@@ -562,7 +562,7 @@ void tst_QMetaMethod::method_data()
<< (QList<int>() << int(QMetaType::Bool) << int(QMetaType::Int))
<< (QList<QByteArray>() << QByteArray("bool") << QByteArray("int"))
<< (QList<QByteArray>() << QByteArray("") << QByteArray(""))
- << QMetaMethod::Protected
+ << QMetaMethod::Public
<< QMetaMethod::Signal;
QTest::newRow("voidInvokableNoParameterNames")
diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
index 137ce56730..8f6bd50cca 100644
--- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
+++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
@@ -397,7 +397,7 @@ void tst_QMetaObjectBuilder::signal()
QCOMPARE(method1.parameterTypes(), QList<QByteArray>() << "QString" << "int");
QVERIFY(method1.parameterNames().isEmpty());
QVERIFY(method1.tag().isEmpty());
- QVERIFY(method1.access() == QMetaMethod::Protected);
+ QVERIFY(method1.access() == QMetaMethod::Public);
QCOMPARE(method1.attributes(), 0);
QCOMPARE(method1.index(), 0);
QCOMPARE(builder.methodCount(), 1);
@@ -410,7 +410,7 @@ void tst_QMetaObjectBuilder::signal()
QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString");
QVERIFY(method2.parameterNames().isEmpty());
QVERIFY(method2.tag().isEmpty());
- QVERIFY(method2.access() == QMetaMethod::Protected);
+ QVERIFY(method2.access() == QMetaMethod::Public);
QCOMPARE(method2.attributes(), 0);
QCOMPARE(method2.index(), 1);
QCOMPARE(builder.methodCount(), 2);
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 8d1ea3b510..ff453d767b 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -2062,7 +2062,7 @@ void tst_QObject::metamethod()
m = mobj->method(mobj->indexOfMethod("signal5()"));
QVERIFY(m.methodSignature() == "signal5()");
QVERIFY(m.methodType() == QMetaMethod::Signal);
- QVERIFY(m.access() == QMetaMethod::Protected);
+ QVERIFY(m.access() == QMetaMethod::Public);
QVERIFY(!(m.attributes() & QMetaMethod::Scriptable));
QVERIFY((m.attributes() & QMetaMethod::Compatibility));
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index eab2ba4f36..a532407ad4 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -2278,23 +2278,26 @@ public:
template<typename T>
struct SequentialContainer
{
+ typedef T value_type;
+ typedef const T* const_iterator;
T t;
+ const_iterator begin() const { return &t; }
+ const_iterator end() const { return &t + 1; }
};
template<typename T, typename U>
-struct AssociativeContainer
+struct AssociativeContainer : public std::map<T, U>
{
- T t;
- U u;
};
}
Q_DECLARE_SMART_POINTER_METATYPE(MyNS::SmartPointer)
-Q_DECLARE_METATYPE_TEMPLATE_1ARG(MyNS::SequentialContainer)
-Q_DECLARE_METATYPE_TEMPLATE_2ARG(MyNS::AssociativeContainer)
+Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE(MyNS::SequentialContainer)
+Q_DECLARE_ASSOCIATIVE_CONTAINER_METATYPE(MyNS::AssociativeContainer)
+// Test that explicit declaration does not degrade features.
Q_DECLARE_METATYPE(MyNS::SmartPointer<int>)
void tst_QVariant::qvariant_cast_QObject_wrapper()
@@ -2311,8 +2314,6 @@ void tst_QVariant::qvariant_cast_QObject_wrapper()
MyNS::SequentialContainer<int> sc;
sc.t = 47;
MyNS::AssociativeContainer<int, short> ac;
- ac.t = 42;
- ac.u = 5;
QVariant::fromValue(sc);
QVariant::fromValue(ac);
@@ -3538,9 +3539,11 @@ struct ContainerAPI<Container, QString>
#ifdef TEST_FORWARD_LIST
#include <forward_list>
+
+Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE(std::forward_list)
+
+// Test that explicit declaration does not degrade features.
Q_DECLARE_METATYPE(std::forward_list<int>)
-Q_DECLARE_METATYPE(std::forward_list<QVariant>)
-Q_DECLARE_METATYPE(std::forward_list<QString>)
template<typename Value_Type>
struct ContainerAPI<std::forward_list<Value_Type> >
@@ -3624,6 +3627,9 @@ struct KeyGetter<std::map<T, U> >
#ifdef TEST_UNORDERED_MAP
#include <unordered_map>
typedef std::unordered_map<int, bool> StdUnorderedMap_int_bool;
+
+Q_DECLARE_ASSOCIATIVE_CONTAINER_METATYPE(std::unordered_map)
+
Q_DECLARE_METATYPE(StdUnorderedMap_int_bool)
template<typename T, typename U>
@@ -3718,9 +3724,6 @@ void tst_QVariant::iterateContainerElements()
TEST_SEQUENTIAL_ITERATION(std::list, QString)
#ifdef TEST_FORWARD_LIST
- qRegisterSequentialConverter<std::forward_list<int> >();
- qRegisterSequentialConverter<std::forward_list<QVariant> >();
- qRegisterSequentialConverter<std::forward_list<QString> >();
TEST_SEQUENTIAL_ITERATION(std::forward_list, int)
TEST_SEQUENTIAL_ITERATION(std::forward_list, QVariant)
TEST_SEQUENTIAL_ITERATION(std::forward_list, QString)
@@ -3758,7 +3761,6 @@ void tst_QVariant::iterateContainerElements()
TEST_ASSOCIATIVE_ITERATION(QMap, int, bool)
TEST_ASSOCIATIVE_ITERATION(std::map, int, bool)
#ifdef TEST_UNORDERED_MAP
- qRegisterAssociativeConverter<StdUnorderedMap_int_bool>();
TEST_ASSOCIATIVE_ITERATION(std::unordered_map, int, bool)
#endif
}