summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp84
1 files changed, 29 insertions, 55 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
index 9645b9a7fb..b6d48b52d5 100644
--- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.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>
@@ -33,6 +8,7 @@
#include <private/qgraphicsscenebsptreeindex_p.h>
#include <private/qgraphicssceneindex_p.h>
#include <private/qgraphicsscenelinearindex_p.h>
+#include <QtWidgets/private/qapplication_p.h>
class tst_QGraphicsSceneIndex : public QObject
{
@@ -99,13 +75,13 @@ void tst_QGraphicsSceneIndex::scatteredItems()
for (int i = 0; i < 10; ++i)
scene.addRect(i*50, i*50, 40, 35);
- QCOMPARE(scene.items(QPointF(5, 5)).count(), 1);
- QCOMPARE(scene.items(QPointF(55, 55)).count(), 1);
- QCOMPARE(scene.items(QPointF(-100, -100)).count(), 0);
+ QCOMPARE(scene.items(QPointF(5, 5)).size(), 1);
+ QCOMPARE(scene.items(QPointF(55, 55)).size(), 1);
+ QCOMPARE(scene.items(QPointF(-100, -100)).size(), 0);
- QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).count(), 1);
- QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 10);
- QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).count(), 0);
+ QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).size(), 1);
+ QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).size(), 10);
+ QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).size(), 0);
}
void tst_QGraphicsSceneIndex::overlappedItems_data()
@@ -124,17 +100,17 @@ void tst_QGraphicsSceneIndex::overlappedItems()
for (int j = 0; j < 10; ++j)
scene.addRect(i*50, j*50, 200, 200)->setPen(QPen(Qt::black, 0));
- QCOMPARE(scene.items(QPointF(5, 5)).count(), 1);
- QCOMPARE(scene.items(QPointF(55, 55)).count(), 4);
- QCOMPARE(scene.items(QPointF(105, 105)).count(), 9);
- QCOMPARE(scene.items(QPointF(-100, -100)).count(), 0);
-
- QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 100);
- QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).count(), 0);
- QCOMPARE(scene.items(QRectF(0, 0, 200, 200)).count(), 16);
- QCOMPARE(scene.items(QRectF(0, 0, 100, 100)).count(), 4);
- QCOMPARE(scene.items(QRectF(0, 0, 1, 100)).count(), 2);
- QCOMPARE(scene.items(QRectF(0, 0, 1, 1000)).count(), 10);
+ QCOMPARE(scene.items(QPointF(5, 5)).size(), 1);
+ QCOMPARE(scene.items(QPointF(55, 55)).size(), 4);
+ QCOMPARE(scene.items(QPointF(105, 105)).size(), 9);
+ QCOMPARE(scene.items(QPointF(-100, -100)).size(), 0);
+
+ QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).size(), 100);
+ QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).size(), 0);
+ QCOMPARE(scene.items(QRectF(0, 0, 200, 200)).size(), 16);
+ QCOMPARE(scene.items(QRectF(0, 0, 100, 100)).size(), 4);
+ QCOMPARE(scene.items(QRectF(0, 0, 1, 100)).size(), 2);
+ QCOMPARE(scene.items(QRectF(0, 0, 1, 1000)).size(), 10);
}
void tst_QGraphicsSceneIndex::movingItems_data()
@@ -153,20 +129,20 @@ void tst_QGraphicsSceneIndex::movingItems()
scene.addRect(i*50, i*50, 40, 35);
QGraphicsRectItem *box = scene.addRect(0, 0, 10, 10);
- QCOMPARE(scene.items(QPointF(5, 5)).count(), 2);
- QCOMPARE(scene.items(QPointF(-1, -1)).count(), 0);
- QCOMPARE(scene.items(QRectF(0, 0, 5, 5)).count(), 2);
+ QCOMPARE(scene.items(QPointF(5, 5)).size(), 2);
+ QCOMPARE(scene.items(QPointF(-1, -1)).size(), 0);
+ QCOMPARE(scene.items(QRectF(0, 0, 5, 5)).size(), 2);
box->setPos(10, 10);
- QCOMPARE(scene.items(QPointF(9, 9)).count(), 1);
- QCOMPARE(scene.items(QPointF(15, 15)).count(), 2);
- QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).count(), 1);
+ QCOMPARE(scene.items(QPointF(9, 9)).size(), 1);
+ QCOMPARE(scene.items(QPointF(15, 15)).size(), 2);
+ QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).size(), 1);
box->setPos(-5, -5);
- QCOMPARE(scene.items(QPointF(-1, -1)).count(), 1);
- QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).count(), 2);
+ QCOMPARE(scene.items(QPointF(-1, -1)).size(), 1);
+ QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).size(), 2);
- QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 11);
+ QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).size(), 11);
}
void tst_QGraphicsSceneIndex::connectedToSceneRectChanged()
@@ -315,7 +291,6 @@ void tst_QGraphicsSceneIndex::removeItems()
QGraphicsView view(&scene);
view.resize(600, 600);
view.show();
- QApplication::setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
scene.removeItem(widgetChild1);
@@ -347,7 +322,6 @@ void tst_QGraphicsSceneIndex::clear()
QGraphicsView view(&scene);
view.show();
- qApp->setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
scene.clear();