diff options
author | Mitch Curtis <mitch.curtis@nokia.com> | 2012-07-06 15:12:41 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-12 01:46:20 +0200 |
commit | 623bfe209371b6d35d030a66629b58f0f4f27b0d (patch) | |
tree | f4e710544947c86ad95df98101dce2411570f5f9 /tests/auto/corelib/tools | |
parent | 74b0206a714a32102a7ea5dcc6dad580bd4a600c (diff) |
Add unary operator+ to QPoint and QPointF.
As requested by Winfried Schenke:
"QPoint should have an unary operator+ (the unary operator- exists).
Classes with arithmetic operators should provide a complete set of
operators, because some template code relies on it."
Task-number: QTBUG-22913
Change-Id: Ib0c5105975f56c15f00bb48d83c8d911f5a204ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r-- | tests/auto/corelib/tools/qpoint/tst_qpoint.cpp | 15 | ||||
-rw-r--r-- | tests/auto/corelib/tools/qpointf/tst_qpointf.cpp | 15 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp b/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp index 9f30fe6e4a..cb24325765 100644 --- a/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp +++ b/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp @@ -71,6 +71,9 @@ private slots: void operator_divide_data(); void operator_divide(); + void operator_unary_plus_data(); + void operator_unary_plus(); + void operator_unary_minus_data(); void operator_unary_minus(); @@ -269,6 +272,18 @@ void tst_QPoint::operator_divide() QCOMPARE(point, expected); } +void tst_QPoint::operator_unary_plus_data() +{ + operator_unary_minus_data(); +} + +void tst_QPoint::operator_unary_plus() +{ + QFETCH(QPoint, point); + // Should be a NOOP. + QCOMPARE(+point, point); +} + void tst_QPoint::operator_unary_minus_data() { QTest::addColumn<QPoint>("point"); diff --git a/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp b/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp index 07564d60f0..df5efe88ca 100644 --- a/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp +++ b/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp @@ -76,6 +76,9 @@ private slots: void operator_divide(); void division(); + void operator_unary_plus_data(); + void operator_unary_plus(); + void operator_unary_minus_data(); void operator_unary_minus(); @@ -283,6 +286,18 @@ void tst_QPointF::division() } } +void tst_QPointF::operator_unary_plus_data() +{ + operator_unary_minus_data(); +} + +void tst_QPointF::operator_unary_plus() +{ + QFETCH(QPointF, point); + // Should be a NOOP. + QCOMPARE(+point, point); +} + void tst_QPointF::operator_unary_minus_data() { QTest::addColumn<QPointF>("point"); |