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/qcoreapplication/tst_qcoreapplication.cpp4
-rw-r--r--tests/auto/corelib/kernel/qeventloop/BLACKLIST1
-rw-r--r--tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp2
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp6
-rw-r--r--tests/auto/corelib/kernel/qobject/qobject.pro6
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp8
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp1
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp8
-rw-r--r--tests/auto/corelib/kernel/qvariant/qvariant.pro3
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp54
10 files changed, 68 insertions, 25 deletions
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index 22f0d8ecaa..5e9dbdd226 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -56,7 +56,7 @@ class ThreadedEventReceiver : public QObject
Q_OBJECT
public:
QList<int> recordedEvents;
- bool event(QEvent *event) Q_DECL_OVERRIDE
+ bool event(QEvent *event) override
{
if (event->type() != QEvent::Type(QEvent::User + 1))
return QObject::event(event);
@@ -70,7 +70,7 @@ public:
class Thread : public QDaemonThread
{
- void run() Q_DECL_OVERRIDE
+ void run() override
{
QThreadData *data = QThreadData::current();
QVERIFY(!data->requiresCoreApplication); // daemon thread
diff --git a/tests/auto/corelib/kernel/qeventloop/BLACKLIST b/tests/auto/corelib/kernel/qeventloop/BLACKLIST
index 9f837aa197..6ea6314b0a 100644
--- a/tests/auto/corelib/kernel/qeventloop/BLACKLIST
+++ b/tests/auto/corelib/kernel/qeventloop/BLACKLIST
@@ -1,3 +1,2 @@
[testQuitLock]
windows
-osx
diff --git a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
index 87196eaef1..4584b6ce31 100644
--- a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
+++ b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
@@ -763,7 +763,7 @@ void tst_QMetaMethod::gadget()
{
// Call with null should not crash
- MyGadget *gadget = Q_NULLPTR;
+ MyGadget *gadget = nullptr;
QString string;
QVERIFY(!setValueMethod.invokeOnGadget(gadget, Q_ARG(QString, QLatin1String("hi"))));
QVERIFY(!getValueMethod.invokeOnGadget(gadget, Q_RETURN_ARG(QString, string)));
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 076610a0c5..cc628ee26e 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -39,12 +39,6 @@
#include <algorithm>
-// At least these specific versions of MSVC2010 has a severe performance problem with this file,
-// taking about 1 hour to compile if the portion making use of variadic macros is enabled.
-#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 160030319) && (_MSC_FULL_VER <= 160040219)
-# define TST_QMETATYPE_BROKEN_COMPILER
-#endif
-
// mingw gcc 4.8 also takes way too long, letting the CI system abort the test
#if defined(__MINGW32__)
# define TST_QMETATYPE_BROKEN_COMPILER
diff --git a/tests/auto/corelib/kernel/qobject/qobject.pro b/tests/auto/corelib/kernel/qobject/qobject.pro
index bd83396ca0..978aab86c1 100644
--- a/tests/auto/corelib/kernel/qobject/qobject.pro
+++ b/tests/auto/corelib/kernel/qobject/qobject.pro
@@ -1,6 +1,8 @@
TEMPLATE = subdirs
-CONFIG += ordered
-!winrt: SUBDIRS+= signalbug
+!winrt {
+ test.depends = signalbug
+ SUBDIRS += signalbug
+}
SUBDIRS += test
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 1f98f64340..c734cfe4dd 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -6016,7 +6016,7 @@ public:
struct SlotArgFunctor
{
- SlotArgFunctor(int *s) : status(s), context(Q_NULLPTR), sender(Q_NULLPTR) {}
+ SlotArgFunctor(int *s) : status(s), context(nullptr), sender(nullptr) {}
SlotArgFunctor(ContextObject *context, QObject *sender, int *s) : status(s), context(context), sender(sender) {}
void operator()() { *status = 2; if (context) context->compareSender(sender); }
@@ -6454,7 +6454,7 @@ Q_SIGNALS:
static int countedStructObjectsCount = 0;
struct CountedStruct
{
- CountedStruct() : sender(Q_NULLPTR) { ++countedStructObjectsCount; }
+ CountedStruct() : sender(nullptr) { ++countedStructObjectsCount; }
CountedStruct(GetSenderObject *sender) : sender(sender) { ++countedStructObjectsCount; }
CountedStruct(const CountedStruct &o) : sender(o.sender) { ++countedStructObjectsCount; }
CountedStruct &operator=(const CountedStruct &) { return *this; }
@@ -6770,7 +6770,7 @@ class CountedExceptionThrower : public QObject
Q_OBJECT
public:
- explicit CountedExceptionThrower(bool throwException, QObject *parent = Q_NULLPTR)
+ explicit CountedExceptionThrower(bool throwException, QObject *parent = nullptr)
: QObject(parent)
{
if (throwException)
@@ -6856,7 +6856,7 @@ void tst_QObject::exceptions()
try {
class ParentObject : public QObject {
public:
- explicit ParentObject(QObject *parent = Q_NULLPTR)
+ explicit ParentObject(QObject *parent = nullptr)
: QObject(parent)
{
new CountedExceptionThrower(false, this);
diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
index 3b25000b22..f81324b894 100644
--- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
+++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp
@@ -815,6 +815,7 @@ void tst_QSharedMemory::uniqueKey_data()
QTest::newRow("key != key1") << QString("key") << QString("key1");
QTest::newRow("ke1y != key1") << QString("ke1y") << QString("key1");
QTest::newRow("key1 != key2") << QString("key1") << QString("key2");
+ QTest::newRow("Noël -> Nol") << QString::fromUtf8("N\xc3\xabl") << QString("Nol");
}
void tst_QSharedMemory::uniqueKey()
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index b921c0f13d..2c6d9ea7c0 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -754,7 +754,7 @@ void tst_QTimer::recurseOnTimeoutAndStopTimer()
struct CountedStruct
{
- CountedStruct(int *count, QThread *t = Q_NULLPTR) : count(count), thread(t) { }
+ CountedStruct(int *count, QThread *t = nullptr) : count(count), thread(t) { }
~CountedStruct() { }
void operator()() const { ++(*count); if (thread) QCOMPARE(QThread::currentThread(), thread); }
@@ -763,7 +763,7 @@ struct CountedStruct
};
static QScopedPointer<QEventLoop> _e;
-static QThread *_t = Q_NULLPTR;
+static QThread *_t = nullptr;
class StaticEventLoop
{
@@ -827,7 +827,7 @@ void tst_QTimer::singleShotToFunctors()
_t->quit();
_t->wait();
_t->deleteLater();
- _t = Q_NULLPTR;
+ _t = nullptr;
{
QObject c3;
@@ -865,7 +865,7 @@ void tst_QTimer::singleShotToFunctors()
QCOMPARE(count, 5);
_e.reset();
- _t = Q_NULLPTR;
+ _t = nullptr;
}
void tst_QTimer::singleShot_chrono()
diff --git a/tests/auto/corelib/kernel/qvariant/qvariant.pro b/tests/auto/corelib/kernel/qvariant/qvariant.pro
index 96071f9f73..a620be0091 100644
--- a/tests/auto/corelib/kernel/qvariant/qvariant.pro
+++ b/tests/auto/corelib/kernel/qvariant/qvariant.pro
@@ -5,7 +5,8 @@ INCLUDEPATH += $$PWD/../../../other/qvariant_common
SOURCES = tst_qvariant.cpp
RESOURCES += qvariant.qrc
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-qtConfig(c++11): CONFIG += c++11
+qtConfig(c++14): CONFIG += c++14
+qtConfig(c++1z): CONFIG += c++1z
!qtConfig(doubleconversion):!qtConfig(system-doubleconversion) {
DEFINES += QT_NO_DOUBLECONVERSION
}
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 0d45159d09..0780fb9172 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -45,7 +45,9 @@
#include <limits.h>
#include <float.h>
#include <cmath>
-
+#if QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L
+#include <variant>
+#endif
#include <QLinkedList>
#include <QRegularExpression>
#include <QDir>
@@ -281,6 +283,8 @@ private slots:
void accessSequentialContainerKey();
+ void fromStdVariant();
+
private:
void dataStream_data(QDataStream::Version version);
void loadQVariantFromDataStream(QDataStream::Version version);
@@ -1099,8 +1103,9 @@ void tst_QVariant::toString_data()
QTest::newRow( "bool" ) << QVariant( true ) << QString( "true" );
QTest::newRow( "qdate" ) << QVariant( QDate( 2002, 1, 1 ) ) << QString( "2002-01-01" );
- QTest::newRow( "qtime" ) << QVariant( QTime( 12, 34, 56 ) ) << QString( "12:34:56" );
- QTest::newRow( "qdatetime" ) << QVariant( QDateTime( QDate( 2002, 1, 1 ), QTime( 12, 34, 56 ) ) ) << QString( "2002-01-01T12:34:56" );
+ QTest::newRow( "qtime" ) << QVariant( QTime( 12, 34, 56 ) ) << QString( "12:34:56.000" );
+ QTest::newRow( "qtime-with-ms" ) << QVariant( QTime( 12, 34, 56, 789 ) ) << QString( "12:34:56.789" );
+ QTest::newRow( "qdatetime" ) << QVariant( QDateTime( QDate( 2002, 1, 1 ), QTime( 12, 34, 56, 789 ) ) ) << QString( "2002-01-01T12:34:56.789" );
QTest::newRow( "llong" ) << QVariant( (qlonglong)Q_INT64_C(123456789012) ) <<
QString( "123456789012" );
QTest::newRow("QJsonValue") << QVariant(QJsonValue(QString("hello"))) << QString("hello");
@@ -1151,6 +1156,7 @@ void tst_QVariant::toTime_data()
QTest::newRow( "qtime" ) << QVariant( QTime( 12, 34, 56 ) ) << QTime( 12, 34, 56 );
QTest::newRow( "qdatetime" ) << QVariant( QDateTime( QDate( 2002, 10, 10 ), QTime( 12, 34, 56 ) ) ) << QTime( 12, 34, 56 );
QTest::newRow( "qstring" ) << QVariant( QString( "12:34:56" ) ) << QTime( 12, 34, 56 );
+ QTest::newRow( "qstring-with-ms" ) << QVariant( QString( "12:34:56.789" ) ) << QTime( 12, 34, 56, 789 );
}
void tst_QVariant::toTime()
@@ -1171,6 +1177,10 @@ void tst_QVariant::toDateTime_data()
<< QDateTime( QDate( 2002, 10, 10 ), QTime( 12, 34, 56 ) );
QTest::newRow( "qdate" ) << QVariant( QDate( 2002, 10, 10 ) ) << QDateTime( QDate( 2002, 10, 10 ), QTime( 0, 0, 0 ) );
QTest::newRow( "qstring" ) << QVariant( QString( "2002-10-10T12:34:56" ) ) << QDateTime( QDate( 2002, 10, 10 ), QTime( 12, 34, 56 ) );
+ QTest::newRow( "qstring-utc" ) << QVariant( QString( "2002-10-10T12:34:56Z" ) )
+ << QDateTime( QDate( 2002, 10, 10 ), QTime( 12, 34, 56 ), Qt::UTC );
+ QTest::newRow( "qstring-with-ms" ) << QVariant( QString( "2002-10-10T12:34:56.789" ) )
+ << QDateTime( QDate( 2002, 10, 10 ), QTime( 12, 34, 56, 789 ) );
}
void tst_QVariant::toDateTime()
@@ -4927,7 +4937,7 @@ void tst_QVariant::accessSequentialContainerKey()
{
QMap<QString, QObject*> mapping;
QString name = QString::fromLatin1("Seven");
- mapping.insert(name, Q_NULLPTR);
+ mapping.insert(name, nullptr);
QVariant variant = QVariant::fromValue(mapping);
@@ -4944,5 +4954,41 @@ void tst_QVariant::accessSequentialContainerKey()
QCOMPARE(nameResult, QStringLiteral("Seven"));
}
+void tst_QVariant::fromStdVariant()
+{
+#if QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L
+ {
+ typedef std::variant<int, bool> intorbool_t;
+ intorbool_t stdvar = 5;
+ QVariant qvar = QVariant::fromStdVariant(stdvar);
+ QVERIFY(!qvar.isNull());
+ QCOMPARE(qvar.type(), QVariant::Int);
+ QCOMPARE(qvar.value<int>(), std::get<int>(stdvar));
+ stdvar = true;
+ qvar = QVariant::fromStdVariant(stdvar);
+ QVERIFY(!qvar.isNull());
+ QCOMPARE(qvar.type(), QVariant::Bool);
+ QCOMPARE(qvar.value<bool>(), std::get<bool>(stdvar));
+ }
+ {
+ std::variant<std::monostate, int> stdvar;
+ QVariant qvar = QVariant::fromStdVariant(stdvar);
+ QVERIFY(!qvar.isValid());
+ stdvar = -4;
+ qvar = QVariant::fromStdVariant(stdvar);
+ QVERIFY(!qvar.isNull());
+ QCOMPARE(qvar.type(), QVariant::Int);
+ QCOMPARE(qvar.value<int>(), std::get<int>(stdvar));
+ }
+ {
+ std::variant<int, bool, QChar> stdvar = QChar::fromLatin1(' ');
+ QVariant qvar = QVariant::fromStdVariant(stdvar);
+ QVERIFY(!qvar.isNull());
+ QCOMPARE(qvar.type(), QVariant::Char);
+ QCOMPARE(qvar.value<QChar>(), std::get<QChar>(stdvar));
+ }
+#endif
+}
+
QTEST_MAIN(tst_QVariant)
#include "tst_qvariant.moc"