summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/io/qdebug/tst_qdebug.cpp')
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index 3dbda13643..949882b578 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -34,6 +34,7 @@
#include <QtConcurrentRun>
#include <QFutureSynchronizer>
+#include <QVariant>
static_assert(QTypeTraits::has_ostream_operator_v<QDebug, int>);
static_assert(QTypeTraits::has_ostream_operator_v<QDebug, QList<int>>);
@@ -42,6 +43,11 @@ struct 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>>);
+struct ConvertsToQVariant {
+ operator QVariant() {return QVariant::fromValue(*this);};
+};
+static_assert(!QTypeTraits::has_ostream_operator_v<QDebug, ConvertsToQVariant>);
+
class tst_QDebug: public QObject
{
@@ -75,6 +81,7 @@ private slots:
void defaultMessagehandler() const;
void threadSafety() const;
void toString() const;
+ void noQVariantEndlessRecursion() const;
};
void tst_QDebug::assignment() const
@@ -770,6 +777,14 @@ void tst_QDebug::toString() const
}
}
+void tst_QDebug::noQVariantEndlessRecursion() const
+{
+ ConvertsToQVariant conv;
+ QVariant var = QVariant::fromValue(conv);
+ QTest::ignoreMessage(QtDebugMsg, "QVariant(ConvertsToQVariant, )");
+ qDebug() << var;
+}
+
// Should compile: instentiation of unrelated operator<< should not cause cause compilation
// error in QDebug operators (QTBUG-47375)
class TestClassA {};