diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-07-06 14:06:08 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-08-15 14:43:30 +0200 |
commit | 3ef8ec2ee187b949b3f6840ca03bcc0e814c00a9 (patch) | |
tree | 2d9794d1b2ec0ec1caa8f8da3bf6ddc32fb9d894 /tests/auto/corelib | |
parent | 8ad9e81694fda39fbecebb9f97491004e9ac8c41 (diff) |
Constrain the data stream operators for containers
Check that we can successfully instantiate the data
stream operator for a container before we actually try.
This is required so we can automate registration of debug
stream operators with QMetaType.
Change-Id: Ib100a5242470d7fc8067058cc4d81af2fa9354b0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/io/qdebug/tst_qdebug.cpp | 10 | ||||
-rw-r--r-- | tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp | 8 |
2 files changed, 14 insertions, 4 deletions
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index 72412aa44d..0b54f53517 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -35,11 +35,13 @@ #include <QtConcurrentRun> #include <QFutureSynchronizer> -static_assert(QTypeTraits::has_ostream_v<QDebug, int>); -static_assert(QTypeTraits::has_ostream_v<QDebug, QList<int>>); +static_assert(QTypeTraits::has_ostream_operator_v<QDebug, int>); +static_assert(QTypeTraits::has_ostream_operator_v<QDebug, QList<int>>); +static_assert(QTypeTraits::has_ostream_operator_v<QDebug, QMap<int, QString>>); struct NonStreamable {}; -static_assert(!QTypeTraits::has_ostream_v<QDebug, NonStreamable>); -static_assert(!QTypeTraits::has_ostream_v<QDebug, QList<NonStreamable>>); +static_assert(!QTypeTraits::has_ostream_operator_v<QDebug, NonStreamable>); +static_assert(!QTypeTraits::has_ostream_operator_v<QDebug, QList<NonStreamable>>); +static_assert(!QTypeTraits::has_ostream_operator_v<QDebug, QMap<int, NonStreamable>>); class tst_QDebug: public QObject { diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp index 932c4d25d2..bd7100adec 100644 --- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp @@ -36,6 +36,14 @@ #include <QtGui/QPixmap> #include <QtGui/QTextLength> +static_assert(QTypeTraits::has_ostream_operator_v<QDataStream, int>); +static_assert(QTypeTraits::has_ostream_operator_v<QDataStream, QList<int>>); +static_assert(QTypeTraits::has_ostream_operator_v<QDataStream, QMap<int, QString>>); +struct NonStreamable {}; +static_assert(!QTypeTraits::has_ostream_operator_v<QDataStream, NonStreamable>); +static_assert(!QTypeTraits::has_ostream_operator_v<QDataStream, QList<NonStreamable>>); +static_assert(!QTypeTraits::has_ostream_operator_v<QDataStream, QMap<int, NonStreamable>>); + class tst_QDataStream : public QObject { Q_OBJECT |