diff options
Diffstat (limited to 'tests/auto/corelib/tools/qrect/tst_qrect.cpp')
-rw-r--r-- | tests/auto/corelib/tools/qrect/tst_qrect.cpp | 67 |
1 files changed, 50 insertions, 17 deletions
diff --git a/tests/auto/corelib/tools/qrect/tst_qrect.cpp b/tests/auto/corelib/tools/qrect/tst_qrect.cpp index 1377e801a7..d3c6412b0d 100644 --- a/tests/auto/corelib/tools/qrect/tst_qrect.cpp +++ b/tests/auto/corelib/tools/qrect/tst_qrect.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -132,6 +127,9 @@ private slots: void translate_data(); void translate(); + void transposed_data(); + void transposed(); + void moveTop(); void moveBottom(); void moveLeft(); @@ -3566,6 +3564,41 @@ void tst_QRect::translate() } +void tst_QRect::transposed_data() +{ + QTest::addColumn<QRect>("r"); + + QTest::newRow("InvalidQRect") << getQRectCase(InvalidQRect); + QTest::newRow("SmallestQRect") << getQRectCase(SmallestQRect); + QTest::newRow("MiddleQRect") << getQRectCase(MiddleQRect); + QTest::newRow("LargestQRect") << getQRectCase(LargestQRect); + QTest::newRow("SmallestCoordQRect") << getQRectCase(SmallestCoordQRect); + QTest::newRow("LargestCoordQRect") << getQRectCase(LargestCoordQRect); + QTest::newRow("RandomQRect") << getQRectCase(RandomQRect); + QTest::newRow("NegativeSizeQRect") << getQRectCase(NegativeSizeQRect); + QTest::newRow("NegativePointQRect") << getQRectCase(NegativePointQRect); + QTest::newRow("NullQRect") << getQRectCase(NullQRect); + QTest::newRow("EmptyQRect") << getQRectCase(EmptyQRect); +} + +void tst_QRect::transposed() +{ + QFETCH(QRect, r); + + const QRect rt = r.transposed(); + QCOMPARE(rt.height(), r.width()); + QCOMPARE(rt.width(), r.height()); + QCOMPARE(rt.topLeft(), r.topLeft()); + + const QRectF rf = r; + + const QRectF rtf = rf.transposed(); + QCOMPARE(rtf.height(), rf.width()); + QCOMPARE(rtf.width(), rf.height()); + QCOMPARE(rtf.topLeft(), rf.topLeft()); + + QCOMPARE(rtf, QRectF(rt)); +} void tst_QRect::moveTop() { |