summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/gui/painting/qregion/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/gui/painting/qregion/main.cpp')
-rw-r--r--tests/benchmarks/gui/painting/qregion/main.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/benchmarks/gui/painting/qregion/main.cpp b/tests/benchmarks/gui/painting/qregion/main.cpp
index 3d16e41..1d19854 100644
--- a/tests/benchmarks/gui/painting/qregion/main.cpp
+++ b/tests/benchmarks/gui/painting/qregion/main.cpp
@@ -49,6 +49,9 @@ class tst_qregion : public QObject
private slots:
void map_data();
void map();
+
+ void intersects_data();
+ void intersects();
};
@@ -84,6 +87,53 @@ void tst_qregion::map()
}
}
+void tst_qregion::intersects_data()
+{
+ QTest::addColumn<QRegion>("region");
+ QTest::addColumn<QRect>("rect");
+
+ QRegion region(0, 0, 100, 100);
+ QRegion complexRegion;
+ complexRegion = complexRegion.united(QRect(0, 0, 100, 100));
+ complexRegion = complexRegion.united(QRect(120, 20, 100, 100));
+
+ {
+ QRect rect(0, 0, 100, 100);
+ QTest::newRow("same -- simple") << region << rect;
+ }
+ {
+ QRect rect(10, 10, 10, 10);
+ QTest::newRow("inside -- simple") << region << rect;
+ }
+ {
+ QRect rect(110, 110, 10, 10);
+ QTest::newRow("outside -- simple") << region << rect;
+ }
+
+ {
+ QRect rect(0, 0, 100, 100);
+ QTest::newRow("same -- complex") << complexRegion << rect;
+ }
+ {
+ QRect rect(10, 10, 10, 10);
+ QTest::newRow("inside -- complex") << complexRegion << rect;
+ }
+ {
+ QRect rect(110, 110, 10, 10);
+ QTest::newRow("outside -- complex") << complexRegion << rect;
+ }
+}
+
+void tst_qregion::intersects()
+{
+ QFETCH(QRegion, region);
+ QFETCH(QRect, rect);
+
+ QBENCHMARK {
+ region.intersects(rect);
+ }
+}
+
QTEST_MAIN(tst_qregion)
#include "main.moc"