summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2020-11-19 17:37:24 +0100
committerIvan Solovev <ivan.solovev@qt.io>2020-11-20 15:02:11 +0100
commit1a0ae4e32d9bbcd152c953dd672e90cfe93c01bc (patch)
treef8ce8df1ca82263c9f275cfa57f46a22994afb0c /tests/auto/corelib/tools
parentfb6b7869e8bdda94f7e791db7f281f3bb6e0e004 (diff)
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 <alexander.blasche@qt.io>
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r--tests/auto/corelib/tools/qmargins/tst_qmargins.cpp38
1 files changed, 38 insertions, 0 deletions
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"