summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/cmake/test_plugins/CMakeLists.txt27
-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
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp8
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp22
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp29
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp3
9 files changed, 115 insertions, 32 deletions
diff --git a/tests/auto/cmake/test_plugins/CMakeLists.txt b/tests/auto/cmake/test_plugins/CMakeLists.txt
new file mode 100644
index 0000000000..1ac098869c
--- /dev/null
+++ b/tests/auto/cmake/test_plugins/CMakeLists.txt
@@ -0,0 +1,27 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(test_plugins)
+
+find_package(Qt5Network 5.0.0 REQUIRED)
+
+include_directories(
+ ${Qt5Network_INCLUDE_DIRS}
+)
+
+add_definitions(${Qt5Netork_DEFINITIONS})
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Netork_EXECUTABLE_COMPILE_FLAGS}")
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+if(NOT Qt5Network_PLUGINS)
+ message(SEND_ERROR "Qt5 network plugins not known!")
+endif()
+
+foreach(plugin ${Qt5Network_PLUGINS})
+ get_target_property(_loc ${plugin} LOCATION)
+ if (NOT EXISTS "${_loc}")
+ message(SEND_ERROR "Plugin ${plugin} not found at ${_loc}")
+ endif()
+endforeach()
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
}
diff --git a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
index c7bd2a5dc9..07f8ddfc8e 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp
@@ -50,6 +50,13 @@ int main(int argc, char *argv[])
QCoreApplication app(argc, argv);
app.setApplicationVersion("1.0");
+ // Test for QCoreApplication::arguments()
+ const QStringList incomingArgs = QCoreApplication::arguments();
+ for (int i = 0; i < argc; ++i) {
+ if (incomingArgs.at(i) != QLatin1String(argv[i]))
+ qDebug() << "ERROR: arguments[" << i << "] was" << incomingArgs.at(i) << "expected" << argv[i];
+ }
+
QCommandLineParser parser;
parser.setApplicationDescription("Test helper");
parser.addHelpOption();
@@ -87,6 +94,7 @@ int main(int argc, char *argv[])
}
printf("Positional arguments: %s\n", qPrintable(parser.positionalArguments().join(",")));
+ printf("Macros: %s\n", qPrintable(parser.values("D").join(",")));
return 0;
}
diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
index 3ee5b3fcce..9219ff72df 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
@@ -78,6 +78,7 @@ private slots:
void testVersionOption();
void testHelpOption_data();
void testHelpOption();
+ void testQuoteEscaping();
};
static char *empty_argv[] = { const_cast<char*>("tst_qcommandlineparser") };
@@ -97,7 +98,7 @@ void tst_QCommandLineParser::testInvalidOptions()
{
QCoreApplication app(empty_argc, empty_argv);
QCommandLineParser parser;
- QTest::ignoreMessage(QtWarningMsg, "Option names cannot start with a '-'");
+ QTest::ignoreMessage(QtWarningMsg, "QCommandLineOption: Option names cannot start with a '-'");
parser.addOption(QCommandLineOption(QStringLiteral("-v"), QStringLiteral("Displays version information.")));
}
@@ -534,6 +535,25 @@ void tst_QCommandLineParser::testHelpOption()
#endif // !QT_NO_PROCESS
}
+void tst_QCommandLineParser::testQuoteEscaping()
+{
+ QCoreApplication app(empty_argc, empty_argv);
+ QProcess process;
+ process.start("testhelper/qcommandlineparser_test_helper", QStringList() <<
+ QString::number(QCommandLineParser::ParseAsCompactedShortOptions) <<
+ "-DKEY1=\"VALUE1\"" << "-DKEY2=\\\"VALUE2\\\"" <<
+ "-DQTBUG-15379=C:\\path\\'file.ext" <<
+ "-DQTBUG-30628=C:\\temp\\'file'.ext");
+ QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QString output = process.readAll();
+ QVERIFY2(!output.contains("ERROR"), qPrintable(output));
+ QVERIFY2(output.contains("KEY1=\"VALUE1\""), qPrintable(output));
+ QVERIFY2(output.contains("KEY2=\\\"VALUE2\\\""), qPrintable(output));
+ QVERIFY2(output.contains("QTBUG-15379=C:\\path\\'file.ext"), qPrintable(output));
+ QVERIFY2(output.contains("QTBUG-30628=C:\\temp\\'file'.ext"), qPrintable(output));
+}
+
QTEST_APPLESS_MAIN(tst_QCommandLineParser)
#include "tst_qcommandlineparser.moc"
diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
index de9fa41feb..dea657f842 100644
--- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp
+++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
@@ -59,6 +59,7 @@ private slots:
void count();
void clear();
void beginEnd();
+ void firstLast();
void key();
void swap();
@@ -377,6 +378,34 @@ void tst_QMap::beginEnd()
QVERIFY( map.constBegin() != map2.constBegin() );
}
+void tst_QMap::firstLast()
+{
+ // sample string->string map
+ StringMap map;
+ map.insert("0", "a");
+ map.insert("1", "b");
+ map.insert("5", "e");
+
+ QCOMPARE(map.firstKey(), QStringLiteral("0"));
+ QCOMPARE(map.lastKey(), QStringLiteral("5"));
+ QCOMPARE(map.first(), QStringLiteral("a"));
+ QCOMPARE(map.last(), QStringLiteral("e"));
+
+ // const map
+ const StringMap const_map = map;
+ QCOMPARE(map.firstKey(), const_map.firstKey());
+ QCOMPARE(map.lastKey(), const_map.lastKey());
+ QCOMPARE(map.first(), const_map.first());
+ QCOMPARE(map.last(), const_map.last());
+
+ map.take(map.firstKey());
+ QCOMPARE(map.firstKey(), QStringLiteral("1"));
+ QCOMPARE(map.lastKey(), QStringLiteral("5"));
+
+ map.take(map.lastKey());
+ QCOMPARE(map.lastKey(), map.lastKey());
+}
+
void tst_QMap::key()
{
{
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 5a1ca855a1..3a5e890076 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -4444,9 +4444,6 @@ void TextDrawerThread::run()
void tst_QPainter::drawTextOutsideGuiThread()
{
- if (!QFontDatabase::supportsThreadedFontRendering())
- QSKIP("No threaded font rendering");
-
QImage referenceRendering(100, 100, QImage::Format_ARGB32_Premultiplied);
referenceRendering.fill(0);
QPainter p(&referenceRendering);