From 1a0ae4e32d9bbcd152c953dd672e90cfe93c01bc Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Thu, 19 Nov 2020 17:37:24 +0100 Subject: Extend tests for QMargins - Add check for QT_NO_DATASTREAM macro - Add tests for QDebug operator<< Task-number: QTBUG-88183 Change-Id: I346777a3237986f7f950f157e50cae846b077e11 Reviewed-by: Alex Blasche --- tests/auto/corelib/tools/qmargins/tst_qmargins.cpp | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp b/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp index 2a35162ef0..6b89ba0b81 100644 --- a/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp +++ b/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp @@ -36,12 +36,22 @@ class tst_QMargins : public QObject Q_OBJECT private slots: void getSetCheck(); +#ifndef QT_NO_DATASTREAM void dataStreamCheck(); +#endif void operators(); +#ifndef QT_NO_DEBUG_STREAM + void debugStreamCheck(); +#endif void getSetCheckF(); +#ifndef QT_NO_DATASTREAM void dataStreamCheckF(); +#endif void operatorsF(); +#ifndef QT_NO_DEBUG_STREAM + void debugStreamCheckF(); +#endif }; // Testing get/set functions @@ -123,6 +133,19 @@ void tst_QMargins::operators() QCOMPARE(-m3, QMargins(-10, -11, -12, -13)); } +#ifndef QT_NO_DEBUG_STREAM +// Testing QDebug operators +void tst_QMargins::debugStreamCheck() +{ + QMargins m(10, 11, 12, 13); + const QString expected = "QMargins(10, 11, 12, 13)"; + QString result; + QDebug(&result).nospace() << m; + QCOMPARE(result, expected); +} +#endif + +#ifndef QT_NO_DATASTREAM // Testing QDataStream operators void tst_QMargins::dataStreamCheck() { @@ -147,6 +170,7 @@ void tst_QMargins::dataStreamCheck() QCOMPARE(marginsIn.bottom(), 6852); } } +#endif // Testing get/set functions void tst_QMargins::getSetCheckF() @@ -220,6 +244,7 @@ void tst_QMargins::operatorsF() QCOMPARE(-m3, QMarginsF(-10.3, -11.4, -12.5, -13.6)); } +#ifndef QT_NO_DATASTREAM // Testing QDataStream operators void tst_QMargins::dataStreamCheckF() { @@ -244,6 +269,19 @@ void tst_QMargins::dataStreamCheckF() QCOMPARE(marginsIn.bottom(), 4.4); } } +#endif + +#ifndef QT_NO_DEBUG_STREAM +// Testing QDebug operators +void tst_QMargins::debugStreamCheckF() +{ + QMarginsF m(10.1, 11.2, 12.3, 13.4); + const QString expected = "QMarginsF(10.1, 11.2, 12.3, 13.4)"; + QString result; + QDebug(&result).nospace() << m; + QCOMPARE(result, expected); +} +#endif QTEST_APPLESS_MAIN(tst_QMargins) #include "tst_qmargins.moc" -- cgit v1.2.3