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.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index 584e66a7db..4260accfd0 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -66,6 +66,7 @@ private slots:
void resetFormat() const;
void defaultMessagehandler() const;
void threadSafety() const;
+ void toString() const;
};
void tst_QDebug::assignment() const
@@ -740,6 +741,28 @@ void tst_QDebug::threadSafety() const
}
}
+void tst_QDebug::toString() const
+{
+ // By reference.
+ {
+ MyPoint point(3, 4);
+ QString expectedString;
+ QDebug stream(&expectedString);
+ stream.nospace() << point;
+ QCOMPARE(QDebug::toString(point), expectedString);
+ }
+
+ // By pointer.
+ {
+ QObject qobject;
+ qobject.setObjectName("test");
+ QString expectedString;
+ QDebug stream(&expectedString);
+ stream.nospace() << &qobject;
+ QCOMPARE(QDebug::toString(&qobject), expectedString);
+ }
+}
+
// Should compile: instentiation of unrelated operator<< should not cause cause compilation
// error in QDebug operators (QTBUG-47375)
class TestClassA {};