summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/painting/qregion/tst_qregion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/painting/qregion/tst_qregion.cpp')
-rw-r--r--tests/auto/gui/painting/qregion/tst_qregion.cpp53
1 files changed, 24 insertions, 29 deletions
diff --git a/tests/auto/gui/painting/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp
index 29179c44a0..934725844a 100644
--- a/tests/auto/gui/painting/qregion/tst_qregion.cpp
+++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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: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 https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
@@ -163,12 +138,15 @@ void tst_QRegion::rects()
QRegion region(rect);
QVERIFY(region.isEmpty());
QCOMPARE(region.begin(), region.end());
+ QVERIFY(region.rects().isEmpty());
}
{
QRect rect(10, -20, 30, 40);
QRegion region(rect);
QCOMPARE(region.end(), region.begin() + 1);
QCOMPARE(*region.begin(), rect);
+ QCOMPARE(region.rects().size(), 1);
+ QCOMPARE(region.rects()[0], rect);
}
{
QRect r(QPoint(10, 10), QPoint(40, 40));
@@ -215,6 +193,7 @@ void tst_QRegion::setRects()
QCOMPARE(region, QRegion());
QCOMPARE(region.begin(), region.end());
QVERIFY(!region.boundingRect().isValid());
+ QVERIFY(region.rects().isEmpty());
}
{
QRegion region;
@@ -222,12 +201,15 @@ void tst_QRegion::setRects()
region.setRects(&rect, 1);
QCOMPARE(region.begin(), region.end());
QVERIFY(!region.boundingRect().isValid());
+ QVERIFY(region.rects().isEmpty());
}
{
QRegion region;
QRect rect(10, -20, 30, 40);
region.setRects(&rect, 1);
QCOMPARE(region.end(), region.begin() + 1);
+ QCOMPARE(region.rects().size(), 1);
+ QCOMPARE(region.rects()[0], rect);
QCOMPARE(*region.begin(), rect);
}
}
@@ -341,10 +323,12 @@ void tst_QRegion::emptyPolygonRegion()
QRegion r(pa);
QTEST(r.isEmpty(), "isEmpty");
QTEST(int(std::distance(r.begin(), r.end())), "numRects");
- QList<QRect> rects;
- std::copy(r.begin(), r.end(), std::back_inserter(rects));
+ QList<QRect> rects{r.begin(), r.end()};
QTEST(int(rects.size()), "numRects");
QTEST(rects, "rects");
+ const auto span = r.rects();
+ rects.assign(span.begin(), span.end());
+ QTEST(rects, "rects");
}
@@ -887,6 +871,7 @@ void tst_QRegion::isEmpty()
QCOMPARE(region, QRegion());
QCOMPARE(region.rectCount(), 0);
QCOMPARE(region.boundingRect(), QRect());
+ QVERIFY(region.rects().isEmpty());
}
void tst_QRegion::regionFromPath()
@@ -902,6 +887,10 @@ void tst_QRegion::regionFromPath()
QCOMPARE(rgn.begin()[0], QRect(0, 0, 10, 10));
QCOMPARE(rgn.begin()[1], QRect(0, 100, 100, 1000));
+ QCOMPARE(rgn.rects().size(), 2);
+ QCOMPARE(rgn.rects()[0], QRect(0, 0, 10, 10));
+ QCOMPARE(rgn.rects()[1], QRect(0, 100, 100, 1000));
+
QCOMPARE(rgn.boundingRect(), QRect(0, 0, 100, 1100));
}
@@ -918,6 +907,12 @@ void tst_QRegion::regionFromPath()
QCOMPARE(rgn.begin()[2], QRect(90, 10, 10, 80));
QCOMPARE(rgn.begin()[3], QRect(0, 90, 100, 10));
+ QCOMPARE(rgn.rects().size(), 4);
+ QCOMPARE(rgn.rects()[0], QRect(0, 0, 100, 10));
+ QCOMPARE(rgn.rects()[1], QRect(0, 10, 10, 80));
+ QCOMPARE(rgn.rects()[2], QRect(90, 10, 10, 80));
+ QCOMPARE(rgn.rects()[3], QRect(0, 90, 100, 10));
+
QCOMPARE(rgn.boundingRect(), QRect(0, 0, 100, 100));
}
}