summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/graphicsview
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/graphicsview')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp37
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp60
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp268
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp59
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp99
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp59
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp57
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp57
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp86
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro3
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc32
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp299
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp31
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp58
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp54
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp29
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro1
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp197
37 files changed, 693 insertions, 954 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index f71308cdaf..67e1f9ce30 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.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$
**
diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro
index 6e8717c86d..a1064d1c73 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro
@@ -3,4 +3,3 @@ TARGET = tst_qgraphicsanchorlayout1
QT += widgets widgets-private testlib
QT += core-private gui-private
SOURCES += tst_qgraphicsanchorlayout1.cpp
-CONFIG += parallel_test
diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
index a58f295575..9124ff0070 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.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$
**
@@ -159,7 +154,7 @@ public:
{
setContentsMargins( 0,0,0,0 );
if (name.isEmpty())
- setData(0, QString::fromLatin1("w%1").arg(quintptr(this)));
+ setData(0, QLatin1Char('w') + QString::number(quintptr(this)));
else
setData(0, name);
}
@@ -1702,10 +1697,8 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout()
// Create dummy widgets
QList<QGraphicsWidget *> widgets;
- for (int i = 0; i < widgetCount; ++i) {
- TestWidget *w = new TestWidget(0, QString::fromLatin1("W%1").arg(i));
- widgets << w;
- }
+ for (int i = 0; i < widgetCount; ++i)
+ widgets << new TestWidget(0, QLatin1Char('W') + QString::number(i));
// Setup anchor layout
TheAnchorLayout *layout = new TheAnchorLayout;
diff --git a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index 9b1e1e173b..e7d26622c9 100644
--- a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.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$
**
diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 8c27bebf3a..90ea2cb58b 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.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$
**
@@ -42,13 +37,8 @@ class tst_QGraphicsGridLayout : public QObject
{
Q_OBJECT
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
private slots:
+ void initTestCase();
void qgraphicsgridlayout_data();
void qgraphicsgridlayout();
void addItem_data();
@@ -309,27 +299,11 @@ typedef QList<QSizeF> SizeList;
// It is only called once.
void tst_QGraphicsGridLayout::initTestCase()
{
-}
-
-// This will be called after the last test function is executed.
-// It is only called once.
-void tst_QGraphicsGridLayout::cleanupTestCase()
-{
-}
-
-// This will be called before each test function is executed.
-void tst_QGraphicsGridLayout::init()
-{
#ifdef Q_OS_WINCE //disable magic for WindowsCE
qApp->setAutoMaximizeThreshold(-1);
#endif
}
-// This will be called after every test function.
-void tst_QGraphicsGridLayout::cleanup()
-{
-}
-
void tst_QGraphicsGridLayout::qgraphicsgridlayout_data()
{
}
@@ -451,9 +425,10 @@ void tst_QGraphicsGridLayout::addItem_data()
int column = b;
int rowSpan = c;
int columnSpan = d;
- QString name = QString::fromLatin1("(%1,%2,%3,%4").arg(a).arg(b).arg(c).arg(d);
+ const QByteArray name = '(' + QByteArray::number(a) + ',' + QByteArray::number(b)
+ + ',' + QByteArray::number(c) + ',' + QByteArray::number(d);
Qt::Alignment alignment = Qt::AlignLeft;
- QTest::newRow(name.toLatin1()) << row << column << rowSpan << columnSpan << alignment;
+ QTest::newRow(name.constData()) << row << column << rowSpan << columnSpan << alignment;
}}}}
}
@@ -1107,7 +1082,8 @@ void tst_QGraphicsGridLayout::itemAt()
if (i >= 0 && i < layout->count()) {
QVERIFY(layout->itemAt(i));
} else {
- QTest::ignoreMessage(QtWarningMsg, QString::fromLatin1("QGraphicsGridLayout::itemAt: invalid index %1").arg(i).toLatin1().constData());
+ const QByteArray message = "QGraphicsGridLayout::itemAt: invalid index " + QByteArray::number(i);
+ QTest::ignoreMessage(QtWarningMsg, message.constData());
QCOMPARE(layout->itemAt(i), static_cast<QGraphicsLayoutItem*>(0));
}
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
index 66e39869bb..5bfa15db16 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
@@ -6,4 +6,3 @@ SOURCES += tst_qgraphicsitem.cpp
DEFINES += QT_NO_CAST_TO_ASCII
win32:!wince:!winrt: LIBS += -luser32
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 835aeaa4df..fc192560b4 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.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$
**
@@ -310,7 +305,7 @@ private slots:
void selected_textItem();
void selected_multi();
void acceptedMouseButtons();
- void acceptsHoverEvents();
+ void acceptHoverEvents();
void childAcceptsHoverEvents();
void hasFocus();
void pos();
@@ -385,7 +380,9 @@ private slots:
void itemContainsChildrenInShape2();
void ancestorFlags();
void untransformable();
+#ifndef QT_NO_CONTEXTMENU
void contextMenuEventPropagation();
+#endif // QT_NO_CONTEXTMENU
void itemIsMovable();
void boundingRegion_data();
void boundingRegion();
@@ -564,9 +561,9 @@ void tst_QGraphicsItem::construction()
QVERIFY(!item->isSelected());
QCOMPARE(item->acceptedMouseButtons(), Qt::MouseButtons(0x1f));
if (item->type() == QGraphicsTextItem::Type)
- QVERIFY(item->acceptsHoverEvents());
+ QVERIFY(item->acceptHoverEvents());
else
- QVERIFY(!item->acceptsHoverEvents());
+ QVERIFY(!item->acceptHoverEvents());
QVERIFY(!item->hasFocus());
QCOMPARE(item->pos(), QPointF());
QCOMPARE(item->matrix(), QMatrix());
@@ -1125,11 +1122,11 @@ void tst_QGraphicsItem::visible()
scene.addItem(item);
QVERIFY(item->isVisible());
- QCOMPARE(scene.itemAt(0, 0), item);
+ QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item);
item->setVisible(false);
- QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)0);
+ QVERIFY(scene.items(QPointF(0, 0)).isEmpty());
item->setVisible(true);
- QCOMPARE(scene.itemAt(0, 0), item);
+ QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item);
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress);
event.setButton(Qt::LeftButton);
@@ -1930,7 +1927,7 @@ protected:
{ ++hoverOutCount; }
};
-void tst_QGraphicsItem::acceptsHoverEvents()
+void tst_QGraphicsItem::acceptHoverEvents()
{
QGraphicsScene scene;
HoverItem *item1 = new HoverItem(QRectF(-10, -10, 20, 20));
@@ -1939,10 +1936,10 @@ void tst_QGraphicsItem::acceptsHoverEvents()
scene.addItem(item2);
item2->setZValue(1);
- QVERIFY(!item1->acceptsHoverEvents());
- QVERIFY(!item2->acceptsHoverEvents());
- item1->setAcceptsHoverEvents(true);
- item2->setAcceptsHoverEvents(true);
+ QVERIFY(!item1->acceptHoverEvents());
+ QVERIFY(!item2->acceptHoverEvents());
+ item1->setAcceptHoverEvents(true);
+ item2->setAcceptHoverEvents(true);
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseMove);
event.setScenePos(QPointF(-100, -100));
@@ -1953,8 +1950,8 @@ void tst_QGraphicsItem::acceptsHoverEvents()
QCOMPARE(item1->hoverInCount, 0);
QCOMPARE(item2->hoverInCount, 1);
- item1->setAcceptsHoverEvents(false);
- item2->setAcceptsHoverEvents(false);
+ item1->setAcceptHoverEvents(false);
+ item2->setAcceptHoverEvents(false);
event.setScenePos(QPointF(-100, -100));
QApplication::sendEvent(&scene, &event);
@@ -1964,8 +1961,8 @@ void tst_QGraphicsItem::acceptsHoverEvents()
QCOMPARE(item1->hoverInCount, 0);
QCOMPARE(item2->hoverInCount, 1);
- item1->setAcceptsHoverEvents(true);
- item2->setAcceptsHoverEvents(false);
+ item1->setAcceptHoverEvents(true);
+ item2->setAcceptHoverEvents(false);
event.setScenePos(QPointF(-100, -100));
QApplication::sendEvent(&scene, &event);
@@ -2168,27 +2165,27 @@ void tst_QGraphicsItem::matrix()
line.resetMatrix();
QCOMPARE(line.matrix(), QMatrix());
- line.rotate(90);
+ line.setTransform(QTransform().rotate(90), true);
QCOMPARE(line.matrix(), QMatrix().rotate(90));
- line.rotate(90);
+ line.setTransform(QTransform().rotate(90), true);
QCOMPARE(line.matrix(), QMatrix().rotate(90).rotate(90));
line.resetMatrix();
- line.scale(2, 4);
+ line.setTransform(QTransform::fromScale(2, 4), true);
QCOMPARE(line.matrix(), QMatrix().scale(2, 4));
- line.scale(2, 4);
+ line.setTransform(QTransform::fromScale(2, 4), true);
QCOMPARE(line.matrix(), QMatrix().scale(2, 4).scale(2, 4));
line.resetMatrix();
- line.shear(2, 4);
+ line.setTransform(QTransform().shear(2, 4), true);
QCOMPARE(line.matrix(), QMatrix().shear(2, 4));
- line.shear(2, 4);
+ line.setTransform(QTransform().shear(2, 4), true);
QCOMPARE(line.matrix(), QMatrix().shear(2, 4).shear(2, 4));
line.resetMatrix();
- line.translate(10, 10);
+ line.setTransform(QTransform::fromTranslate(10, 10), true);
QCOMPARE(line.matrix(), QMatrix().translate(10, 10));
- line.translate(10, 10);
+ line.setTransform(QTransform::fromTranslate(10, 10), true);
QCOMPARE(line.matrix(), QMatrix().translate(10, 10).translate(10, 10));
line.resetMatrix();
}
@@ -2201,15 +2198,15 @@ void tst_QGraphicsItem::sceneMatrix()
QCOMPARE(parent->sceneMatrix(), QMatrix());
QCOMPARE(child->sceneMatrix(), QMatrix());
- parent->translate(10, 10);
+ parent->setTransform(QTransform::fromTranslate(10, 10), true);
QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10));
QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10));
- child->translate(10, 10);
+ child->setTransform(QTransform::fromTranslate(10, 10), true);
QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10));
QCOMPARE(child->sceneMatrix(), QMatrix().translate(20, 20));
- parent->rotate(90);
+ parent->setTransform(QTransform().rotate(90), true);
QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10).rotate(90));
QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10).rotate(90).translate(10, 10));
@@ -2645,7 +2642,7 @@ void tst_QGraphicsItem::isObscuredBy()
MyItem myitem1, myitem2;
myitem1.setRect(QRectF(50, 50, 40, 200));
- myitem1.rotate(67);
+ myitem1.setTransform(QTransform().rotate(67), true);
myitem2.setRect(QRectF(25, 25, 20, 20));
myitem2.setZValue(-1.0);
@@ -3271,7 +3268,7 @@ void tst_QGraphicsItem::hoverEventsGenerateRepaints()
EventTester *tester = new EventTester;
scene.addItem(tester);
- tester->setAcceptsHoverEvents(true);
+ tester->setAcceptHoverEvents(true);
QTRY_COMPARE(tester->repaints, 1);
@@ -3363,7 +3360,7 @@ void tst_QGraphicsItem::sceneBoundingRect()
QCOMPARE(item->boundingRect(), QRectF(0, 0, 100, 100));
QCOMPARE(item->sceneBoundingRect(), QRectF(100, 100, 100, 100));
- item->rotate(90);
+ item->setTransform(QTransform().rotate(90), true);
QCOMPARE(item->boundingRect(), QRectF(0, 0, 100, 100));
QCOMPARE(item->sceneBoundingRect(), QRectF(0, 100, 100, 100));
@@ -3391,7 +3388,7 @@ void tst_QGraphicsItem::childrenBoundingRect()
QGraphicsRectItem *childChild = scene.addRect(QRectF(0, 0, 100, 100), QPen(Qt::black, 0));
childChild->setParentItem(child);
childChild->setPos(500, 500);
- child->rotate(90);
+ child->setTransform(QTransform().rotate(90), true);
scene.addPolygon(parent->mapToScene(parent->boundingRect() | parent->childrenBoundingRect()))->setPen(QPen(Qt::red));;
@@ -3439,11 +3436,11 @@ void tst_QGraphicsItem::childrenBoundingRectTransformed()
QCOMPARE(subTreeRect.width(), qreal(351.7766952966369));
QCOMPARE(subTreeRect.height(), qreal(251.7766952966369));
- rect->rotate(45);
- rect2->rotate(-45);
- rect3->rotate(45);
- rect4->rotate(-45);
- rect5->rotate(45);
+ rect->setTransform(QTransform().rotate(45), true);
+ rect2->setTransform(QTransform().rotate(-45), true);
+ rect3->setTransform(QTransform().rotate(45), true);
+ rect4->setTransform(QTransform().rotate(-45), true);
+ rect5->setTransform(QTransform().rotate(45), true);
subTreeRect = rect->childrenBoundingRect();
QCOMPARE(rect->childrenBoundingRect(), QRectF(-100, 75, 275, 250));
@@ -3565,7 +3562,7 @@ void tst_QGraphicsItem::group()
QGraphicsRectItem *child = scene.addRect(QRectF(0, 0, 50, 50), QPen(Qt::black, 0), QBrush(Qt::blue));
QGraphicsRectItem *parent2 = scene.addRect(QRectF(0, 0, 50, 50), QPen(Qt::black, 0), QBrush(Qt::red));
parent2->setPos(-50, 50);
- child->rotate(45);
+ child->setTransform(QTransform().rotate(45), true);
child->setParentItem(parent);
parent->setPos(25, 25);
child->setPos(25, 25);
@@ -3614,7 +3611,7 @@ void tst_QGraphicsItem::group()
newItems << item;
item->setPos(-1000 + rand() % 2000,
-1000 + rand() % 2000);
- item->rotate(rand() % 90);
+ item->setTransform(QTransform().rotate(rand() % 90), true);
}
view.fitInView(scene.itemsBoundingRect());
@@ -3657,8 +3654,8 @@ void tst_QGraphicsItem::setGroup2()
rect->setTransformOriginPoint(50,50);
rect->setRotation(45);
rect->setScale(1.5);
- rect->translate(20,20);
- group.translate(-30,-40);
+ rect->setTransform(QTransform::fromTranslate(20,20), true);
+ group.setTransform(QTransform::fromTranslate(-30, -40), true);
group.setRotation(180);
group.setScale(0.5);
@@ -3711,7 +3708,7 @@ void tst_QGraphicsItem::warpChildrenIntoGroup()
QGraphicsScene scene;
QGraphicsRectItem *parentRectItem = scene.addRect(QRectF(0, 0, 100, 100));
QGraphicsRectItem *childRectItem = scene.addRect(QRectF(0, 0, 100, 100));
- parentRectItem->rotate(90);
+ parentRectItem->setTransform(QTransform().rotate(90), true);
childRectItem->setPos(-50, -25);
childRectItem->setParentItem(parentRectItem);
@@ -3720,7 +3717,7 @@ void tst_QGraphicsItem::warpChildrenIntoGroup()
QGraphicsRectItem *parentOfGroup = scene.addRect(QRectF(0, 0, 100, 100));
parentOfGroup->setPos(-200, -200);
- parentOfGroup->scale(2, 2);
+ parentOfGroup->setTransform(QTransform::fromScale(2, 2), true);
QGraphicsItemGroup *group = new QGraphicsItemGroup;
group->setPos(50, 50);
@@ -4128,9 +4125,9 @@ public:
font.setPointSize(4);
painter->setFont(font);
for (int x = -100; x < 100; x += 25) {
- for (int y = -100; y < 100; y += 25) {
- painter->drawText(QRectF(x, y, 25, 25), Qt::AlignCenter, QString("%1x%2").arg(x).arg(y));
- }
+ const QString prefix = QString::number(x) + QLatin1Char('x');
+ for (int y = -100; y < 100; y += 25)
+ painter->drawText(QRectF(x, y, 25, 25), Qt::AlignCenter, prefix + QString::number(y));
}
}
};
@@ -4633,7 +4630,7 @@ void tst_QGraphicsItem::itemChange()
// ItemTransformChange / ItemTransformHasChanged
tester.itemChangeReturnValue.setValue<QTransform>(QTransform().rotate(90));
- tester.translate(50, 0);
+ tester.setTransform(QTransform::fromTranslate(50, 0), true);
++changeCount; // notification sent too
++changeCount;
QCOMPARE(tester.changes.size(), changeCount);
@@ -5193,6 +5190,7 @@ public:
}
protected:
+#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QGraphicsSceneContextMenuEvent *)
{
if (harakiri == 3) {
@@ -5200,6 +5198,7 @@ protected:
delete this;
}
}
+#endif // QT_NO_CONTEXTMENU
void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
@@ -5362,7 +5361,7 @@ void tst_QGraphicsItem::deleteItemInEventHandlers()
for (int i = 0; i < 17; ++i) {
QGraphicsScene scene;
HarakiriItem *item = new HarakiriItem(i);
- item->setAcceptsHoverEvents(true);
+ item->setAcceptHoverEvents(true);
item->setFlag(QGraphicsItem::ItemIsFocusable);
scene.addItem(item);
@@ -5378,11 +5377,13 @@ void tst_QGraphicsItem::deleteItemInEventHandlers()
if (!item->dead)
scene.advance();
+#ifndef QT_NO_CONTEXTMENU
if (!item->dead) {
QContextMenuEvent event(QContextMenuEvent::Other,
view.mapFromScene(item->scenePos()));
QCoreApplication::sendEvent(view.viewport(), &event);
}
+#endif // QT_NO_CONTEXTMENU
if (!item->dead)
QTest::mouseMove(view.viewport(), view.mapFromScene(item->scenePos()));
if (!item->dead)
@@ -5514,16 +5515,16 @@ void tst_QGraphicsItem::itemClipsChildrenToShape2()
QGraphicsScene scene;
scene.addItem(parent);
- QCOMPARE(scene.itemAt(5, 5), (QGraphicsItem *)parent);
- QCOMPARE(scene.itemAt(15, 5), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(5, 15), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(60, 60), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(140, 60), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(60, 140), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(140, 140), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(75, 75), (QGraphicsItem *)child2);
- QCOMPARE(scene.itemAt(75, 100), (QGraphicsItem *)child1);
- QCOMPARE(scene.itemAt(100, 75), (QGraphicsItem *)child1);
+ QCOMPARE(scene.items(QPointF(5, 5)).value(0, Q_NULLPTR), (QGraphicsItem *)parent);
+ QVERIFY(scene.items(QPointF(15, 5)).isEmpty());
+ QVERIFY(scene.items(QPointF(5, 15)).isEmpty());
+ QVERIFY(scene.items(QPointF(60, 60)).isEmpty());
+ QVERIFY(scene.items(QPointF(140, 60)).isEmpty());
+ QVERIFY(scene.items(QPointF(60, 140)).isEmpty());
+ QVERIFY(scene.items(QPointF(140, 140)).isEmpty());
+ QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child2);
+ QCOMPARE(scene.items(QPointF(75, 100)).value(0, Q_NULLPTR), (QGraphicsItem *)child1);
+ QCOMPARE(scene.items(QPointF(100, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child1);
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
image.fill(0);
@@ -5558,20 +5559,20 @@ void tst_QGraphicsItem::itemClipsChildrenToShape3()
grandchild->setPos( 50, 50 );
parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
- QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)parent);
- QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)child);
- QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild);
- QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0);
+ QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)parent);
+ QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child);
+ QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
+ QVERIFY(scene.items(QPointF(175, 175)).isEmpty());
// Move child to fully overlap the parent. The grandchild should
// now occupy two-thirds of the scene
child->prepareGeometryChange();
child->setPos( 0, 0 );
- QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)child);
- QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)grandchild);
- QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild);
- QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0);
+ QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)child);
+ QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
+ QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
+ QVERIFY(scene.items(QPointF(175, 175)).isEmpty());
}
class MyProxyWidget : public QGraphicsProxyWidget
@@ -5843,17 +5844,17 @@ void tst_QGraphicsItem::itemClippingDiscovery()
rightRectItem->setParentItem(clipItem);
// The rects item are both visible at these points.
- QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)leftRectItem);
- QCOMPARE(scene.itemAt(90, 90), (QGraphicsItem *)rightRectItem);
+ QCOMPARE(scene.items(QPointF(10, 10)).value(0, Q_NULLPTR), (QGraphicsItem *)leftRectItem);
+ QCOMPARE(scene.items(QPointF(90, 90)).value(0, Q_NULLPTR), (QGraphicsItem *)rightRectItem);
// The ellipse clips the rects now.
clipItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
// The rect items are no longer visible at these points.
- QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
+ QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
if (sizeof(qreal) != sizeof(double))
QSKIP("This fails due to internal rounding errors");
- QCOMPARE(scene.itemAt(90, 90), (QGraphicsItem *)0);
+ QVERIFY(scene.items(QPointF(90, 90)).isEmpty());
}
class ItemCountsBoundingRectCalls : public QGraphicsRectItem
@@ -5884,7 +5885,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
int oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
// First test that both items are searched if no optimization flags are set
- QGraphicsItem* item = scene.itemAt(25,5);
+ QGraphicsItem* item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
QCOMPARE(item, childOutsideShape);
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
@@ -5895,7 +5896,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
// Repeat the test to make sure that no caching/indexing is in effect
- item = scene.itemAt(25,5);
+ item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
QCOMPARE(item, childOutsideShape);
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
@@ -5908,7 +5909,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
// Set the optimization flag and make sure that the child is not returned
// and that the child's boundingRect() method is never called.
parent->setFlag(QGraphicsItem::ItemContainsChildrenInShape);
- item = scene.itemAt(25,5);
+ item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
QVERIFY(!(item));
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
@@ -6216,12 +6217,12 @@ void tst_QGraphicsItem::untransformable()
QGraphicsItem *item1 = new QGraphicsEllipseItem(QRectF(-50, -50, 100, 100));
item1->setZValue(1);
item1->setFlag(QGraphicsItem::ItemIgnoresTransformations);
- item1->rotate(45);
+ item1->setTransform(QTransform().rotate(45), true);
((QGraphicsEllipseItem *)item1)->setBrush(Qt::red);
QGraphicsItem *item2 = new QGraphicsEllipseItem(QRectF(-50, -50, 100, 100));
item2->setParentItem(item1);
- item2->rotate(45);
+ item2->setTransform(QTransform().rotate(45), true);
item2->setPos(100, 0);
((QGraphicsEllipseItem *)item2)->setBrush(Qt::green);
@@ -6276,6 +6277,7 @@ void tst_QGraphicsItem::untransformable()
}
}
+#ifndef QT_NO_CONTEXTMENU
class ContextMenuItem : public QGraphicsRectItem
{
public:
@@ -6339,6 +6341,7 @@ void tst_QGraphicsItem::contextMenuEventPropagation()
QCOMPARE(bottomItem->gotEvent, false);
QCOMPARE(topItem->eventWasAccepted, true);
}
+#endif // QT_NO_CONTEXTMENU
void tst_QGraphicsItem::itemIsMovable()
{
@@ -6460,10 +6463,11 @@ void tst_QGraphicsItem::task177918_lineItemUndetected()
QGraphicsLineItem *line = scene.addLine(10, 10, 10, 10);
QCOMPARE(line->boundingRect(), QRectF(10, 10, 0, 0));
- QVERIFY(!scene.items(9, 9, 2, 2, Qt::IntersectsItemShape).isEmpty());
- QVERIFY(!scene.items(9, 9, 2, 2, Qt::ContainsItemShape).isEmpty());
- QVERIFY(!scene.items(9, 9, 2, 2, Qt::IntersectsItemBoundingRect).isEmpty());
- QVERIFY(!scene.items(9, 9, 2, 2, Qt::ContainsItemBoundingRect).isEmpty());
+ const QRectF rect(9, 9, 2, 2);
+ QVERIFY(!scene.items(rect, Qt::IntersectsItemShape).isEmpty());
+ QVERIFY(!scene.items(rect, Qt::ContainsItemShape).isEmpty());
+ QVERIFY(!scene.items(rect, Qt::IntersectsItemBoundingRect).isEmpty());
+ QVERIFY(!scene.items(rect, Qt::ContainsItemBoundingRect).isEmpty());
}
void tst_QGraphicsItem::task240400_clickOnTextItem_data()
@@ -6699,8 +6703,8 @@ void tst_QGraphicsItem::itemTransform_parentChild()
QGraphicsItem *child = scene.addRect(0, 0, 100, 100);
child->setParentItem(parent);
child->setPos(10, 10);
- child->scale(2, 2);
- child->rotate(90);
+ child->setTransform(QTransform::fromScale(2, 2), true);
+ child->setTransform(QTransform().rotate(90), true);
QCOMPARE(child->itemTransform(parent).map(QPointF(10, 10)), QPointF(-10, 30));
QCOMPARE(parent->itemTransform(child).map(QPointF(-10, 30)), QPointF(10, 10));
@@ -6712,19 +6716,19 @@ void tst_QGraphicsItem::itemTransform_siblings()
QGraphicsItem *parent = scene.addRect(0, 0, 100, 100);
QGraphicsItem *brother = scene.addRect(0, 0, 100, 100);
QGraphicsItem *sister = scene.addRect(0, 0, 100, 100);
- parent->scale(10, 5);
- parent->rotate(-180);
- parent->shear(2, 3);
+ parent->setTransform(QTransform::fromScale(10, 5), true);
+ parent->setTransform(QTransform().rotate(-180), true);
+ parent->setTransform(QTransform().shear(2, 3), true);
brother->setParentItem(parent);
sister->setParentItem(parent);
brother->setPos(10, 10);
- brother->scale(2, 2);
- brother->rotate(90);
+ brother->setTransform(QTransform::fromScale(2, 2), true);
+ brother->setTransform(QTransform().rotate(90), true);
sister->setPos(10, 10);
- sister->scale(2, 2);
- sister->rotate(90);
+ sister->setTransform(QTransform::fromScale(2, 2), true);
+ sister->setTransform(QTransform().rotate(90), true);
QCOMPARE(brother->itemTransform(sister).map(QPointF(10, 10)), QPointF(10, 10));
QCOMPARE(sister->itemTransform(brother).map(QPointF(10, 10)), QPointF(10, 10));
@@ -6736,11 +6740,11 @@ void tst_QGraphicsItem::itemTransform_unrelated()
QGraphicsItem *stranger1 = scene.addRect(0, 0, 100, 100);
QGraphicsItem *stranger2 = scene.addRect(0, 0, 100, 100);
stranger1->setPos(10, 10);
- stranger1->scale(2, 2);
- stranger1->rotate(90);
+ stranger1->setTransform(QTransform::fromScale(2, 2), true);
+ stranger1->setTransform(QTransform().rotate(90), true);
stranger2->setPos(10, 10);
- stranger2->scale(2, 2);
- stranger2->rotate(90);
+ stranger2->setTransform(QTransform::fromScale(2, 2), true);
+ stranger2->setTransform(QTransform().rotate(90), true);
QCOMPARE(stranger1->itemTransform(stranger2).map(QPointF(10, 10)), QPointF(10, 10));
QCOMPARE(stranger2->itemTransform(stranger1).map(QPointF(10, 10)), QPointF(10, 10));
@@ -7022,7 +7026,8 @@ void tst_QGraphicsItem::itemStacksBehindParent()
paintedItems.clear();
view.viewport()->update();
QApplication::processEvents();
- QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>()
+ QRectF rect(0, 0, 100, 100);
+ QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>()
<< grandChild111 << child11
<< grandChild121 << child12 << parent1
<< grandChild211 << child21
@@ -7038,7 +7043,7 @@ void tst_QGraphicsItem::itemStacksBehindParent()
paintedItems.clear();
QApplication::processEvents();
- QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>()
+ QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>()
<< grandChild121 << child12 << parent1
<< grandChild111 << child11
<< grandChild211 << child21
@@ -7054,7 +7059,7 @@ void tst_QGraphicsItem::itemStacksBehindParent()
scene.update();
QApplication::processEvents();
- QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>()
+ QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>()
<< parent1 << grandChild111 << child11
<< grandChild121 << child12
<< grandChild211 << child21
@@ -7221,12 +7226,12 @@ void tst_QGraphicsItem::sceneTransformCache()
QGraphicsRectItem *rect2 = scene.addRect(0, 0, 100, 100);
rect2->setPen(QPen(Qt::black, 0));
rect2->setParentItem(rect);
- rect2->rotate(90);
- rect->translate(0, 50);
+ rect2->setTransform(QTransform().rotate(90), true);
+ rect->setTransform(QTransform::fromTranslate(0, 50), true);
QGraphicsView view(&scene);
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
- rect->translate(0, 100);
+ rect->setTransform(QTransform::fromTranslate(0, 100), true);
QTransform x;
x.translate(0, 150);
x.rotate(90);
@@ -7390,14 +7395,14 @@ void tst_QGraphicsItem::cacheMode()
QCOMPARE(testerChild2->repaints, 2);
// Translating does not result in a repaint.
- tester->translate(10, 10);
+ tester->setTransform(QTransform::fromTranslate(10, 10), true);
QTest::qWait(25);
QTRY_COMPARE(tester->repaints, 2);
QCOMPARE(testerChild->repaints, 2);
QCOMPARE(testerChild2->repaints, 2);
// Rotating results in a repaint.
- tester->rotate(45);
+ tester->setTransform(QTransform().rotate(45), true);
QTest::qWait(25);
QTRY_COMPARE(tester->repaints, 3);
QCOMPARE(testerChild->repaints, 3);
@@ -7413,9 +7418,9 @@ void tst_QGraphicsItem::cacheMode()
QCOMPARE(testerChild2->repaints, 3);
// Rotating items with ItemCoordinateCache doesn't cause a repaint.
- tester->rotate(22);
- testerChild->rotate(22);
- testerChild2->rotate(22);
+ tester->setTransform(QTransform().rotate(22), true);
+ testerChild->setTransform(QTransform().rotate(22), true);
+ testerChild2->setTransform(QTransform().rotate(22), true);
QTest::qWait(25);
QTRY_COMPARE(tester->repaints, 4);
QTRY_COMPARE(testerChild->repaints, 4);
@@ -7648,7 +7653,9 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)
{
QGraphicsRectItem::paint(painter, option, widget);
- painter->drawText(boundingRect(), Qt::AlignCenter, QString("%1x%2\n%3x%4").arg(p.x()).arg(p.y()).arg(sp.x()).arg(sp.y()));
+ const QString text = QString::number(p.x()) + QLatin1Char('x') + QString::number(p.y())
+ + QLatin1Char('\n') + QString::number(sp.x()) + QLatin1Char('x') + QString::number(sp.y());
+ painter->drawText(boundingRect(), Qt::AlignCenter, text);
}
protected:
@@ -7728,9 +7735,9 @@ void tst_QGraphicsItem::deviceTransform()
rect1->setPos(100, 100);
rect2->setPos(100, 100);
rect3->setPos(100, 100);
- rect1->rotate(rotation1);
- rect2->rotate(rotation2);
- rect3->rotate(rotation3);
+ rect1->setTransform(QTransform().rotate(rotation1), true);
+ rect2->setTransform(QTransform().rotate(rotation2), true);
+ rect3->setTransform(QTransform().rotate(rotation3), true);
rect1->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable1);
rect2->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable2);
rect3->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable3);
@@ -7863,14 +7870,14 @@ void tst_QGraphicsItem::update()
expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2);
view.reset();
item->repaints = 0;
- parent->translate(-400, 0);
+ parent->setTransform(QTransform::fromTranslate(-400, 0), true);
qApp->processEvents();
QCOMPARE(item->repaints, 0);
QCOMPARE(view.repaints, 1);
QCOMPARE(view.paintedRegion, expectedRegion);
view.reset();
item->repaints = 0;
- parent->translate(400, 0);
+ parent->setTransform(QTransform::fromTranslate(400, 0), true);
qApp->processEvents();
QCOMPARE(item->repaints, 1);
QCOMPARE(view.repaints, 1);
@@ -8170,7 +8177,7 @@ void tst_QGraphicsItem::moveItem()
RESET_COUNTERS
- parent->translate(20, 20);
+ parent->setTransform(QTransform::fromTranslate(20, 20), true);
qApp->processEvents();
QCOMPARE(parent->repaints, 1);
QCOMPARE(child->repaints, 1);
@@ -8236,10 +8243,11 @@ void tst_QGraphicsItem::sorting()
QGraphicsScene scene;
QGraphicsItem *grid[100][100];
for (int x = 0; x < 100; ++x) {
+ const QString prefix = QString::number(x) + QLatin1Char('x');
for (int y = 0; y < 100; ++y) {
PainterItem *item = new PainterItem;
item->setPos(x * 25, y * 25);
- item->setData(0, QString("%1x%2").arg(x).arg(y));
+ item->setData(0, prefix + QString::number(y));
grid[x][y] = item;
scene.addItem(item);
}
@@ -11641,12 +11649,12 @@ void tst_QGraphicsItem::QTBUG_21618_untransformable_sceneTransform()
QGraphicsItem *item1 = scene.addRect(0, 0, 100, 100, QPen(), Qt::red);
item1->setPos(50, 50);
- item1->translate(50, 50);
- item1->rotate(90);
+ item1->setTransform(QTransform::fromTranslate(50, 50), true);
+ item1->setTransform(QTransform().rotate(90), true);
QGraphicsItem *item2 = scene.addRect(0, 0, 100, 100, QPen(), Qt::green);
item2->setPos(50, 50);
- item2->translate(50, 50);
- item2->rotate(90);
+ item2->setTransform(QTransform::fromTranslate(50, 50), true);
+ item2->setTransform(QTransform().rotate(90), true);
item2->setFlags(QGraphicsItem::ItemIgnoresTransformations);
QGraphicsRectItem *item1_topleft = new QGraphicsRectItem(QRectF(-2, -2, 4, 4));
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro
index 484f4ba5f8..3515d259d0 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro
@@ -3,5 +3,4 @@ TARGET = tst_qgraphicsitemanimation
QT += widgets testlib
SOURCES += tst_qgraphicsitemanimation.cpp
DEFINES += QT_NO_CAST_TO_ASCII
-CONFIG += parallel_test
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp
index df826da0c5..acdd3cff81 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.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$
**
diff --git a/tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro b/tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro
index 254a91ef6a..1be43692d5 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro
@@ -7,4 +7,3 @@ TARGET = tst_qgraphicslayout
QT += widgets testlib
SOURCES += tst_qgraphicslayout.cpp
DEFINES += QT_USE_USING_NAMESPACE
-CONFIG += parallel_test
diff --git a/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
index a2740edc54..87cd032ad0 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.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$
**
diff --git a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro
index ef5cc36d05..e4a970201a 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro
@@ -2,5 +2,4 @@ CONFIG += testcase
TARGET = tst_qgraphicslayoutitem
QT += widgets testlib
SOURCES += tst_qgraphicslayoutitem.cpp
-CONFIG += parallel_test
diff --git a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp
index c291f09def..9b52366855 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.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$
**
@@ -40,12 +35,6 @@
class tst_QGraphicsLayoutItem : public QObject {
Q_OBJECT
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
private slots:
void qgraphicslayoutitem();
@@ -96,28 +85,6 @@ public:
};
-// This will be called before the first test function is executed.
-// It is only called once.
-void tst_QGraphicsLayoutItem::initTestCase()
-{
-}
-
-// This will be called after the last test function is executed.
-// It is only called once.
-void tst_QGraphicsLayoutItem::cleanupTestCase()
-{
-}
-
-// This will be called before each test function is executed.
-void tst_QGraphicsLayoutItem::init()
-{
-}
-
-// This will be called after every test function.
-void tst_QGraphicsLayoutItem::cleanup()
-{
-}
-
void tst_QGraphicsLayoutItem::qgraphicslayoutitem()
{
SubQGraphicsLayoutItem layoutItem;
@@ -146,7 +113,7 @@ void tst_QGraphicsLayoutItem::effectiveSizeHint_data()
QTest::addColumn<Qt::SizeHint>("sizeHint");
QTest::addColumn<QSizeF>("constraint");
for (int i = 0; i < 15; ++i) {
- QTestData &data = QTest::newRow(QString("%1").arg(i).toLatin1());
+ QTestData &data = QTest::newRow(QByteArray::number(i).constData());
switch(i % 5) {
case 0: data << Qt::MinimumSize; break;
case 1: data << Qt::PreferredSize; break;
diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 7b2b301b80..5794c32803 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.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$
**
@@ -45,13 +40,8 @@
class tst_QGraphicsLinearLayout : public QObject {
Q_OBJECT
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
private slots:
+ void initTestCase();
void qgraphicslinearlayout_data();
void qgraphicslinearlayout();
@@ -150,22 +140,6 @@ void tst_QGraphicsLinearLayout::initTestCase()
QApplication::setStyle("windows");
}
-// This will be called after the last test function is executed.
-// It is only called once.
-void tst_QGraphicsLinearLayout::cleanupTestCase()
-{
-}
-
-// This will be called before each test function is executed.
-void tst_QGraphicsLinearLayout::init()
-{
-}
-
-// This will be called after every test function.
-void tst_QGraphicsLinearLayout::cleanup()
-{
-}
-
class RectWidget : public QGraphicsWidget
{
public:
@@ -424,10 +398,11 @@ void tst_QGraphicsLinearLayout::dump_data()
QTest::addColumn<int>("itemCount");
QTest::addColumn<int>("layoutCount");
for (int i = -1; i < 3; ++i) {
- QTest::newRow(QString("%1, 0, 0").arg(i).toLatin1()) << 0 << 0;
- QTest::newRow(QString("%1, 0, 5").arg(i).toLatin1()) << 5 << 5;
- QTest::newRow(QString("%1, 5, 0").arg(i).toLatin1()) << 5 << 5;
- QTest::newRow(QString("%1, 5, 5").arg(i).toLatin1()) << 5 << 5;
+ const QByteArray iB = QByteArray::number(i);
+ QTest::newRow((iB + ", 0, 0").constData()) << 0 << 0;
+ QTest::newRow((iB + ", 0, 5").constData()) << 5 << 5;
+ QTest::newRow((iB + ", 5, 0").constData()) << 5 << 5;
+ QTest::newRow((iB + ", 5, 5").constData()) << 5 << 5;
}
}
@@ -510,11 +485,13 @@ void tst_QGraphicsLinearLayout::insertItem_data()
QTest::addColumn<int>("insertItemAt");
QTest::addColumn<bool>("isWidget");
for (int i = -1; i < 4; ++i) {
+ const QByteArray iB = QByteArray::number(i);
for (int j = 0; j < 2; ++j) {
- QTest::newRow(QString("0, 0, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 0 << i << (bool)j;
- QTest::newRow(QString("1, 0, %1 %2").arg(i).arg(j).toLatin1()) << 1 << 0 << i << (bool)j;
- QTest::newRow(QString("0, 1, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 1 << i << (bool)j;
- QTest::newRow(QString("2, 2, %1 %2").arg(i).arg(j).toLatin1()) << 2 << 2 << i << (bool)j;
+ const QByteArray postFix = iB + ' ' + QByteArray::number(j);
+ QTest::newRow(("0, 0, " + postFix).constData()) << 0 << 0 << i << (bool)j;
+ QTest::newRow(("1, 0, " + postFix).constData()) << 1 << 0 << i << (bool)j;
+ QTest::newRow(("0, 1, " + postFix).constData()) << 0 << 1 << i << (bool)j;
+ QTest::newRow(("2, 2, " + postFix).constData()) << 2 << 2 << i << (bool)j;
}
}
}
@@ -564,11 +541,13 @@ void tst_QGraphicsLinearLayout::insertStretch_data()
QTest::addColumn<int>("insertItemAt");
QTest::addColumn<int>("stretch");
for (int i = -1; i < 4; ++i) {
+ const QByteArray iB = QByteArray::number(i);
for (int j = 0; j < 2; ++j) {
- QTest::newRow(QString("0, 0, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 0 << i << j;
- QTest::newRow(QString("1, 0, %1 %2").arg(i).arg(j).toLatin1()) << 1 << 0 << i << j;
- QTest::newRow(QString("0, 1, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 1 << i << j;
- QTest::newRow(QString("2, 2, %1 %2").arg(i).arg(j).toLatin1()) << 2 << 2 << i << j;
+ const QByteArray postFix = iB + ' ' + QByteArray::number(j);
+ QTest::newRow(("0, 0, " + postFix).constData()) << 0 << 0 << i << j;
+ QTest::newRow(("1, 0, " + postFix).constData()) << 1 << 0 << i << j;
+ QTest::newRow(("0, 1, " + postFix).constData()) << 0 << 1 << i << j;
+ QTest::newRow(("2, 2, " + postFix).constData()) << 2 << 2 << i << j;
}
}
}
@@ -785,12 +764,13 @@ void tst_QGraphicsLinearLayout::removeAt_data()
QTest::addColumn<int>("removeItemAt");
QTest::addColumn<Qt::Orientation>("orientation");
for (int i = -1; i < 4; ++i) {
+ const QByteArray iB = QByteArray::number(i);
for (int k = 0; k < 2; ++k) {
Qt::Orientation orientation = (k == 0) ? Qt::Vertical : Qt::Horizontal;
- QTest::newRow(QString("0, 0, %1").arg(i).toLatin1()) << 0 << 0 << i << orientation;
- QTest::newRow(QString("1, 0, %1").arg(i).toLatin1()) << 1 << 0 << i << orientation;
- QTest::newRow(QString("0, 1, %1").arg(i).toLatin1()) << 0 << 1 << i << orientation;
- QTest::newRow(QString("2, 2, %1").arg(i).toLatin1()) << 2 << 2 << i << orientation;
+ QTest::newRow(("0, 0, " + iB).constData()) << 0 << 0 << i << orientation;
+ QTest::newRow(("1, 0, " + iB).constData()) << 1 << 0 << i << orientation;
+ QTest::newRow(("0, 1, " + iB).constData()) << 0 << 1 << i << orientation;
+ QTest::newRow(("2, 2, " + iB).constData()) << 2 << 2 << i << orientation;
}
}
}
@@ -839,10 +819,11 @@ void tst_QGraphicsLinearLayout::removeItem_data()
QTest::addColumn<int>("layoutCount");
QTest::addColumn<int>("removeItemAt");
for (int i = -1; i < 4; ++i) {
- QTest::newRow(QString("0, 0, %1").arg(i).toLatin1()) << 0 << 0 << i;
- QTest::newRow(QString("1, 0, %1").arg(i).toLatin1()) << 1 << 0 << i;
- QTest::newRow(QString("0, 1, %1").arg(i).toLatin1()) << 0 << 1 << i;
- QTest::newRow(QString("2, 2, %1").arg(i).toLatin1()) << 2 << 2 << i;
+ const QByteArray iB = QByteArray::number(i);
+ QTest::newRow(("0, 0, " + iB).constData()) << 0 << 0 << i;
+ QTest::newRow(("1, 0, " + iB).constData()) << 1 << 0 << i;
+ QTest::newRow(("0, 1, " + iB).constData()) << 0 << 1 << i;
+ QTest::newRow(("2, 2, " + iB).constData()) << 2 << 2 << i;
}
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro b/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro
index 60f09c2228..483f123fa7 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro
@@ -5,4 +5,3 @@ QT += widgets testlib
QT += core-private
SOURCES += tst_qgraphicsobject.cpp
-CONFIG += parallel_test
diff --git a/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp b/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp
index 0f9e8c101e..6ef17a14af 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.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$
**
@@ -43,12 +38,6 @@
class tst_QGraphicsObject : public QObject {
Q_OBJECT
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
private slots:
void pos();
void x();
@@ -60,30 +49,6 @@ private slots:
void deleted();
};
-
-// This will be called before the first test function is executed.
-// It is only called once.
-void tst_QGraphicsObject::initTestCase()
-{
-}
-
-// This will be called after the last test function is executed.
-// It is only called once.
-void tst_QGraphicsObject::cleanupTestCase()
-{
-}
-
-// This will be called before each test function is executed.
-void tst_QGraphicsObject::init()
-{
-}
-
-// This will be called after every test function.
-void tst_QGraphicsObject::cleanup()
-{
-}
-
-
class MyGraphicsObject : public QGraphicsObject
{
public:
diff --git a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro
index 6452e39c56..123f1050ec 100644
--- a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro
@@ -2,5 +2,4 @@ CONFIG += testcase
TARGET = tst_qgraphicspixmapitem
QT += widgets testlib
SOURCES += tst_qgraphicspixmapitem.cpp
-CONFIG += parallel_test
diff --git a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
index 774a41b212..78fe448bdb 100644
--- a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.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$
**
@@ -40,12 +35,6 @@ class tst_QGraphicsPixmapItem : public QObject
{
Q_OBJECT
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
private slots:
void qgraphicspixmapitem_data();
void qgraphicspixmapitem();
@@ -102,28 +91,6 @@ public:
{ return SubQGraphicsPixmapItem::supportsExtension((QGraphicsItem::Extension)extension); }
};
-// This will be called before the first test function is executed.
-// It is only called once.
-void tst_QGraphicsPixmapItem::initTestCase()
-{
-}
-
-// This will be called after the last test function is executed.
-// It is only called once.
-void tst_QGraphicsPixmapItem::cleanupTestCase()
-{
-}
-
-// This will be called before each test function is executed.
-void tst_QGraphicsPixmapItem::init()
-{
-}
-
-// This will be called after every test function.
-void tst_QGraphicsPixmapItem::cleanup()
-{
-}
-
void tst_QGraphicsPixmapItem::qgraphicspixmapitem_data()
{
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro
index bca0ecc20c..89847e9ed2 100644
--- a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro
@@ -2,5 +2,3 @@ CONFIG += testcase
TARGET = tst_qgraphicspolygonitem
QT += widgets testlib
SOURCES += tst_qgraphicspolygonitem.cpp
-CONFIG += parallel_test
-
diff --git a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp
index 376846471b..fbdd38804d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.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$
**
@@ -41,12 +36,6 @@ class tst_QGraphicsPolygonItem : public QObject
{
Q_OBJECT
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
private slots:
void qgraphicspolygonitem_data();
void qgraphicspolygonitem();
@@ -98,28 +87,6 @@ public:
{ return SubQGraphicsPolygonItem::supportsExtension((QGraphicsItem::Extension)extension); }
};
-// This will be called before the first test function is executed.
-// It is only called once.
-void tst_QGraphicsPolygonItem::initTestCase()
-{
-}
-
-// This will be called after the last test function is executed.
-// It is only called once.
-void tst_QGraphicsPolygonItem::cleanupTestCase()
-{
-}
-
-// This will be called before each test function is executed.
-void tst_QGraphicsPolygonItem::init()
-{
-}
-
-// This will be called after every test function.
-void tst_QGraphicsPolygonItem::cleanup()
-{
-}
-
void tst_QGraphicsPolygonItem::qgraphicspolygonitem_data()
{
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST
index 373343fa22..16f3534921 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST
@@ -1,5 +1,6 @@
[hoverEnterLeaveEvent]
ubuntu-14.04
rhel-7.1
+rhel-7.2
[QTBUG_6986_sendMouseEventToAlienWidget]
rhel-7.1
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro
index 38fef51394..e7bcccb495 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro
@@ -6,4 +6,3 @@ QT += core-private gui-private
SOURCES += tst_qgraphicsproxywidget.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index d8a8ed6b4b..c93fc1288f 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.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$
**
@@ -84,13 +79,9 @@ class tst_QGraphicsProxyWidget : public QObject
{
Q_OBJECT
-public slots:
+private slots:
void initTestCase();
- void cleanupTestCase();
- void init();
void cleanup();
-
-private slots:
void qgraphicsproxywidget_data();
void qgraphicsproxywidget();
void paint();
@@ -162,7 +153,9 @@ private slots:
void fontPropagation();
void dontCrashWhenDie();
void createProxyForChildWidget();
+#ifndef QT_NO_CONTEXTMENU
void actionsContextMenu();
+#endif // QT_NO_CONTEXTMENU
void actionsContextMenu_data();
void deleteProxyForChildWidget();
void bypassGraphicsProxyWidget_data();
@@ -289,17 +282,6 @@ void tst_QGraphicsProxyWidget::initTestCase()
QApplication::setEffectEnabled(Qt::UI_AnimateCombo, false);
}
-// This will be called after the last test function is executed.
-// It is only called once.
-void tst_QGraphicsProxyWidget::cleanupTestCase()
-{
-}
-
-// This will be called before each test function is executed.
-void tst_QGraphicsProxyWidget::init()
-{
-}
-
// This will be called after every test function.
void tst_QGraphicsProxyWidget::cleanup()
{
@@ -492,7 +474,7 @@ void tst_QGraphicsProxyWidget::setWidget()
QCOMPARE(proxy->rect().toRect(), widget->rect());
QCOMPARE(proxy->focusPolicy(), Qt::WheelFocus);
QVERIFY(proxy->acceptDrops());
- QCOMPARE(proxy->acceptsHoverEvents(), true); // to get widget enter events
+ QCOMPARE(proxy->acceptHoverEvents(), true); // to get widget enter events
int left, top, right, bottom;
widget->getContentsMargins(&left, &top, &right, &bottom);
qreal rleft, rtop, rright, rbottom;
@@ -541,14 +523,15 @@ void tst_QGraphicsProxyWidget::testEventFilter_data()
QTest::newRow("none") << QEvent::None << false;
for (int i = 0; i < 2; ++i) {
bool fromObject = (i == 0);
- QTest::newRow(QString("resize %1").arg(fromObject).toLatin1()) << QEvent::Resize << fromObject;
- QTest::newRow(QString("move %1").arg(fromObject).toLatin1()) << QEvent::Move << fromObject;
- QTest::newRow(QString("hide %1").arg(fromObject).toLatin1()) << QEvent::Hide << fromObject;
- QTest::newRow(QString("show %1").arg(fromObject).toLatin1()) << QEvent::Show << fromObject;
- QTest::newRow(QString("enabled %1").arg(fromObject).toLatin1()) << QEvent::EnabledChange << fromObject;
- QTest::newRow(QString("focusIn %1").arg(fromObject).toLatin1()) << QEvent::FocusIn << fromObject;
- QTest::newRow(QString("focusOut %1").arg(fromObject).toLatin1()) << QEvent::FocusOut << fromObject;
- QTest::newRow(QString("keyPress %1").arg(fromObject).toLatin1()) << QEvent::KeyPress << fromObject;
+ const char fromObjectC = fromObject ? '1' : '0';
+ QTest::newRow((QByteArrayLiteral("resize ") + fromObjectC).constData()) << QEvent::Resize << fromObject;
+ QTest::newRow((QByteArrayLiteral("move ") + fromObjectC).constData()) << QEvent::Move << fromObject;
+ QTest::newRow((QByteArrayLiteral("hide ") + fromObjectC).constData()) << QEvent::Hide << fromObject;
+ QTest::newRow((QByteArrayLiteral("show ") + fromObjectC).constData()) << QEvent::Show << fromObject;
+ QTest::newRow((QByteArrayLiteral("enabled ") + fromObjectC).constData()) << QEvent::EnabledChange << fromObject;
+ QTest::newRow((QByteArrayLiteral("focusIn ") + fromObjectC).constData()) << QEvent::FocusIn << fromObject;
+ QTest::newRow((QByteArrayLiteral("focusOut ") + fromObjectC).constData()) << QEvent::FocusOut << fromObject;
+ QTest::newRow((QByteArrayLiteral("keyPress ") + fromObjectC).constData()) << QEvent::KeyPress << fromObject;
}
}
@@ -760,8 +743,10 @@ void tst_QGraphicsProxyWidget::focusNextPrevChild_data()
bool hasWidget = (j == 0);
bool hasScene = (k == 0);
bool result = hasScene && hasWidget;
- QString name = QString("Forward: %1, hasWidget: %2, hasScene: %3, result: %4").arg(next).arg(hasWidget).arg(hasScene).arg(result);
- QTest::newRow(name.toLatin1()) << hasWidget << hasScene << next << result;
+ QByteArray name = QByteArrayLiteral("Forward: ") + (next ? '1' : '0')
+ + ", hasWidget: " + (hasWidget ? '1' : '0') + ", hasScene: "
+ + (hasScene ? '1' : '0') + ", result: " + (result ? '1' : '0');
+ QTest::newRow(name.constData()) << hasWidget << hasScene << next << result;
}
}
}
@@ -1026,8 +1011,10 @@ void tst_QGraphicsProxyWidget::hoverMoveEvent_data()
bool hoverEnabled = (j == 0);
bool mouseTracking = (k == 0);
bool mouseDown = (l == 0);
- QString name = QString("hasWidget:%1, hover:%2, mouseTracking:%3, mouseDown: %4").arg(hasWidget).arg(hoverEnabled).arg(mouseTracking).arg(mouseDown);
- QTest::newRow(name.toLatin1()) << hasWidget << hoverEnabled << mouseTracking << mouseDown;
+ QByteArray name = QByteArrayLiteral("hasWidget:") + (hasWidget ? '1' : '0') + ", hover:"
+ + (hoverEnabled ? '1' : '0') + ", mouseTracking:"
+ + (mouseTracking ? '1' : '0') + ", mouseDown: " + (mouseDown ? '1' : '0');
+ QTest::newRow(name.constData()) << hasWidget << hoverEnabled << mouseTracking << mouseDown;
}
}
}
@@ -1309,7 +1296,7 @@ void tst_QGraphicsProxyWidget::paintEvent()
proxy.paintCount = 0;
w->update();
- QTRY_COMPARE(proxy.paintCount, 1); //the widget should have been painted now
+ QTRY_VERIFY(proxy.paintCount >= 1); //the widget should have been painted now
}
@@ -3072,6 +3059,7 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget()
delete boxProxy;
}
+#ifndef QT_NO_CONTEXTMENU
class ContextMenuWidget : public QLabel
{
Q_OBJECT
@@ -3120,6 +3108,7 @@ private:
bool m_embeddedPopupSet;
QTimer *m_timer;
};
+#endif // QT_NO_CONTEXTMENU
void tst_QGraphicsProxyWidget::actionsContextMenu_data()
{
@@ -3132,6 +3121,7 @@ void tst_QGraphicsProxyWidget::actionsContextMenu_data()
QTest::newRow("with actionsContextMenu without focus") << true << false;
}
+#ifndef QT_NO_CONTEXTMENU
void tst_QGraphicsProxyWidget::actionsContextMenu()
{
QFETCH(bool, hasFocus);
@@ -3186,7 +3176,7 @@ void tst_QGraphicsProxyWidget::actionsContextMenu()
}
}
-
+#endif // QT_NO_CONTEXTMENU
void tst_QGraphicsProxyWidget::deleteProxyForChildWidget()
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro
index 25a43d6821..986ba019b4 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro
@@ -17,4 +17,5 @@ wince* {
DEPLOYMENT += rootFiles renderFiles
DEFINES += SRCDIR=\\\".\\\"
}
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
+RESOURCES += testdata.qrc
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc b/tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc
new file mode 100644
index 0000000000..07a0579cdc
--- /dev/null
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc
@@ -0,0 +1,32 @@
+<RCC>
+ <qresource prefix="/">
+ <file>testData/render/all-all-45-deg-left.png</file>
+ <file>testData/render/all-all-45-deg-right.png</file>
+ <file>testData/render/all-all-scale-2x.png</file>
+ <file>testData/render/all-all-translate-0-50.png</file>
+ <file>testData/render/all-all-translate-50-0.png</file>
+ <file>testData/render/all-all-untransformed-clip-ellipse.png</file>
+ <file>testData/render/all-all-untransformed-clip-rect.png</file>
+ <file>testData/render/all-all-untransformed.png</file>
+ <file>testData/render/all-bottomleft-untransformed.png</file>
+ <file>testData/render/all-bottomright-untransformed.png</file>
+ <file>testData/render/all-topleft-untransformed.png</file>
+ <file>testData/render/all-topright-untransformed.png</file>
+ <file>testData/render/bottom-bottomright-untransformed.png</file>
+ <file>testData/render/bottom-topleft-untransformed.png</file>
+ <file>testData/render/bottomleft-all-untransformed.png</file>
+ <file>testData/render/bottomleft-topleft-untransformed.png</file>
+ <file>testData/render/bottomright-all-untransformed.png</file>
+ <file>testData/render/bottomright-topleft-untransformed.png</file>
+ <file>testData/render/left-bottomright-untransformed.png</file>
+ <file>testData/render/left-topleft-untransformed.png</file>
+ <file>testData/render/right-bottomright-untransformed.png</file>
+ <file>testData/render/right-topleft-untransformed.png</file>
+ <file>testData/render/top-bottomright-untransformed.png</file>
+ <file>testData/render/top-topleft-untransformed.png</file>
+ <file>testData/render/topleft-all-untransformed.png</file>
+ <file>testData/render/topleft-topleft-untransformed.png</file>
+ <file>testData/render/topright-all-untransformed.png</file>
+ <file>testData/render/topright-topleft-untransformed.png</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index ae71b0412f..a346bb9d1f 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.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$
**
@@ -108,7 +103,7 @@ class HoverItem : public QGraphicsRectItem
public:
HoverItem()
: QGraphicsRectItem(QRectF(-10, -10, 20, 20)), isHovered(false)
- { setAcceptsHoverEvents(true); }
+ { setAcceptHoverEvents(true); }
bool isHovered;
@@ -227,8 +222,10 @@ private slots:
void render_data();
void render();
void renderItemsWithNegativeWidthOrHeight();
+#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent();
void contextMenuEvent_ItemIgnoresTransformations();
+#endif
void update();
void update2();
void views();
@@ -301,11 +298,16 @@ void tst_QGraphicsScene::construction()
QVERIFY(scene.items(QPainterPath()).isEmpty());
QTest::ignoreMessage(QtWarningMsg, "QGraphicsScene::collidingItems: cannot find collisions for null item");
QVERIFY(scene.collidingItems(0).isEmpty());
- QVERIFY(!scene.itemAt(QPointF()));
+ QVERIFY(scene.items(QPointF()).isEmpty());
QVERIFY(scene.selectedItems().isEmpty());
QVERIFY(!scene.focusItem());
}
+static inline const QGraphicsItem *itemAt(const QGraphicsScene &scene, qreal x, qreal y)
+{
+ return scene.items(QPointF(x, y)).value(0, Q_NULLPTR);
+}
+
void tst_QGraphicsScene::sceneRect()
{
QGraphicsScene scene;
@@ -318,8 +320,8 @@ void tst_QGraphicsScene::sceneRect()
item->setPos(-5, -5);
QCOMPARE(sceneRectChanged.count(), 0);
- QCOMPARE(scene.itemAt(0, 0), item);
- QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
+ QCOMPARE(itemAt(scene, 0, 0), item);
+ QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
QCOMPARE(sceneRectChanged.count(), 0);
QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 10, 10));
QCOMPARE(sceneRectChanged.count(), 1);
@@ -334,8 +336,8 @@ void tst_QGraphicsScene::sceneRect()
QCOMPARE(sceneRectChanged.count(), 3);
QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect());
- QCOMPARE(scene.itemAt(0, 0), item);
- QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
+ QCOMPARE(itemAt(scene, 0, 0), item);
+ QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10));
item->setPos(10, 10);
QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10));
@@ -344,8 +346,8 @@ void tst_QGraphicsScene::sceneRect()
scene.setSceneRect(QRectF());
- QCOMPARE(scene.itemAt(10, 10), item);
- QCOMPARE(scene.itemAt(20, 20), (QGraphicsItem *)0);
+ QCOMPARE(itemAt(scene, 10, 10), item);
+ QVERIFY(scene.items(QPointF(20, 20)).isEmpty());
QCOMPARE(sceneRectChanged.count(), 4);
QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 25, 25));
QCOMPARE(sceneRectChanged.count(), 5);
@@ -374,7 +376,7 @@ void tst_QGraphicsScene::itemIndexMethod()
for (int x = minX; x < maxX; x += 100) {
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10));
item->setPos(x, y);
- QCOMPARE(scene.itemAt(x, y), item);
+ QCOMPARE(itemAt(scene, x, y), item);
items << item;
}
}
@@ -382,7 +384,7 @@ void tst_QGraphicsScene::itemIndexMethod()
int n = 0;
for (int y = minY; y < maxY; y += 100) {
for (int x = minX; x < maxX; x += 100)
- QCOMPARE(scene.itemAt(x, y), items.at(n++));
+ QCOMPARE(itemAt(scene, x, y), items.at(n++));
}
scene.setItemIndexMethod(QGraphicsScene::NoIndex);
@@ -391,7 +393,7 @@ void tst_QGraphicsScene::itemIndexMethod()
n = 0;
for (int y = minY; y < maxY; y += 100) {
for (int x = minX; x < maxX; x += 100)
- QCOMPARE(scene.itemAt(x, y), items.at(n++));
+ QCOMPARE(itemAt(scene, x, y), items.at(n++));
}
scene.setItemIndexMethod(QGraphicsScene::BspTreeIndex);
@@ -400,7 +402,7 @@ void tst_QGraphicsScene::itemIndexMethod()
n = 0;
for (int y = minY; y < maxY; y += 100) {
for (int x = minX; x < maxX; x += 100)
- QCOMPARE(scene.itemAt(x, y), items.at(n++));
+ QCOMPARE(itemAt(scene, x, y), items.at(n++));
}
}
@@ -439,7 +441,7 @@ void tst_QGraphicsScene::items()
items << scene.addRect(QRectF(0, 0, 10, 10));
}
QCOMPARE(scene.items().size(), items.size());
- scene.itemAt(0, 0); // trigger indexing
+ itemAt(scene, 0, 0); // trigger indexing
scene.removeItem(items.at(5));
delete items.at(5);
@@ -458,8 +460,8 @@ void tst_QGraphicsScene::items()
QList<QGraphicsItem *> items;
items<<l1<<l2;
QCOMPARE(scene.items().size(), items.size());
- QVERIFY(scene.items(-1, -1, 2, 2).contains(l1));
- QVERIFY(scene.items(-1, -1, 2, 2).contains(l2));
+ QVERIFY(scene.items(QRectF(-1, -1, 2, 2)).contains(l1));
+ QVERIFY(scene.items(QRectF(-1, -1, 2, 2)).contains(l2));
}
}
@@ -722,7 +724,7 @@ void tst_QGraphicsScene::items_QRectF_2()
QGraphicsItem *item = scene.addEllipse(ellipseRect);
QCOMPARE(!scene.items(sceneRect, selectionMode).isEmpty(), contained);
- item->rotate(45);
+ item->setTransform(QTransform().rotate(45), true);
QCOMPARE(!scene.items(sceneRect, selectionMode).isEmpty(), containedRotated);
}
@@ -1085,19 +1087,19 @@ void tst_QGraphicsScene::addItem()
QTRY_VERIFY(view.repaints > 0);
view.repaints = 0;
- QCOMPARE(scene.itemAt(0, 0), path);
+ QCOMPARE(itemAt(scene, 0, 0), path);
QGraphicsItem *path2 = new QGraphicsEllipseItem(QRectF(-10, -10, 20, 20));
path2->setPos(100, 100);
- QCOMPARE(scene.itemAt(0, 0), path);
- QCOMPARE(scene.itemAt(100, 100), (QGraphicsItem *)0);
+ QCOMPARE(itemAt(scene, 0, 0), path);
+ QVERIFY(scene.items(QPointF(100, 100)).isEmpty());
scene.addItem(path2);
// Adding an item should always issue a repaint.
QTRY_VERIFY(view.repaints > 0);
- QCOMPARE(scene.itemAt(100, 100), path2);
+ QCOMPARE(itemAt(scene, 100, 100), path2);
}
{
// 2) Create scene, then item, then add item
@@ -1109,8 +1111,8 @@ void tst_QGraphicsScene::addItem()
path2->setPos(100, 100);
scene.addItem(path2);
- QCOMPARE(scene.itemAt(0, 0), path);
- QCOMPARE(scene.itemAt(100, 100), path2);
+ QCOMPARE(itemAt(scene, 0, 0), path);
+ QCOMPARE(itemAt(scene, 100, 100), path2);
}
}
@@ -1123,15 +1125,15 @@ void tst_QGraphicsScene::addEllipse()
QCOMPARE(ellipse->pen(), QPen(Qt::red));
QCOMPARE(ellipse->brush(), QBrush(Qt::blue));
QCOMPARE(ellipse->rect(), QRectF(-10, -10, 20, 20));
- QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)ellipse);
- QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)ellipse);
- QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)ellipse);
- QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)ellipse);
- QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)ellipse);
- QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
+ QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)ellipse);
+ QVERIFY(scene.items(QPointF(-10, -10)).isEmpty());
+ QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)ellipse);
+ QVERIFY(scene.items(QPointF(-10, 10)).isEmpty());
+ QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)ellipse);
+ QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)ellipse);
+ QVERIFY(scene.items(QPointF(10, -10)).isEmpty());
+ QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)ellipse);
+ QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
}
void tst_QGraphicsScene::addLine()
@@ -1144,15 +1146,15 @@ void tst_QGraphicsScene::addLine()
QCOMPARE(line->pos(), QPointF());
QCOMPARE(line->pen(), pen);
QCOMPARE(line->line(), QLineF(-10, -10, 20, 20));
- QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)line);
- QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)line);
- QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)line);
+ QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)line);
+ QCOMPARE(itemAt(scene, -10, -10), (QGraphicsItem *)line);
+ QVERIFY(scene.items(QPointF(-9.9, 0)).isEmpty());
+ QVERIFY(scene.items(QPointF(-10, 10)).isEmpty());
+ QVERIFY(scene.items(QPointF(0, -9.9)).isEmpty());
+ QVERIFY(scene.items(QPointF(0, 9.9)).isEmpty());
+ QVERIFY(scene.items(QPointF(10, -10)).isEmpty());
+ QVERIFY(scene.items(QPointF(9.9, 0)).isEmpty());
+ QCOMPARE(itemAt(scene, 10, 10), (QGraphicsItem *)line);
}
void tst_QGraphicsScene::addPath()
@@ -1170,27 +1172,27 @@ void tst_QGraphicsScene::addPath()
path->setPen(QPen(Qt::red, 0));
- QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)path);
- QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)path);
- QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)path);
- QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)path);
- QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)path);
- QCOMPARE(scene.itemAt(0, 30), (QGraphicsItem *)path);
- QCOMPARE(scene.itemAt(-9.9, 30), (QGraphicsItem *)path);
- QCOMPARE(scene.itemAt(9.9, 30), (QGraphicsItem *)path);
- QCOMPARE(scene.itemAt(0, 20.1), (QGraphicsItem *)path);
- QCOMPARE(scene.itemAt(0, 39.9), (QGraphicsItem *)path);
- QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(-10, 20), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(10, 20), (QGraphicsItem *)0);
+ QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)path);
+ QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)path);
+ QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)path);
+ QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)path);
+ QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)path);
+ QCOMPARE(itemAt(scene, 0, 30), (QGraphicsItem *)path);
+ QCOMPARE(itemAt(scene, -9.9, 30), (QGraphicsItem *)path);
+ QCOMPARE(itemAt(scene, 9.9, 30), (QGraphicsItem *)path);
+ QCOMPARE(itemAt(scene, 0, 20.1), (QGraphicsItem *)path);
+ QCOMPARE(itemAt(scene, 0, 39.9), (QGraphicsItem *)path);
+ QVERIFY(scene.items(QPointF(-10, -10)).isEmpty());
+ QVERIFY(scene.items(QPointF(10, -10)).isEmpty());
+ QVERIFY(scene.items(QPointF(-10, 10)).isEmpty());
+ QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
+ QVERIFY(scene.items(QPointF(-10, 20)).isEmpty());
+ QVERIFY(scene.items(QPointF(10, 20)).isEmpty());
if (sizeof(qreal) != sizeof(double))
QWARN("Skipping test because of rounding errors when qreal != double");
else
- QCOMPARE(scene.itemAt(-10, 30), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(10.1, 30), (QGraphicsItem *)0);
+ QVERIFY(scene.items(QPointF(-10, 30)).isEmpty());
+ QVERIFY(scene.items(QPointF(10.1, 30)).isEmpty());
}
void tst_QGraphicsScene::addPixmap()
@@ -1201,16 +1203,17 @@ void tst_QGraphicsScene::addPixmap()
QCOMPARE(pixmap->pos(), QPointF());
QCOMPARE(pixmap->pixmap(), pix);
- QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)pixmap);
- QCOMPARE(scene.itemAt(pix.width() - 1, 0), (QGraphicsItem *)pixmap);
- QCOMPARE(scene.itemAt(0, pix.height() - 1), (QGraphicsItem *)pixmap);
- QCOMPARE(scene.itemAt(pix.width() - 1, pix.height() - 1), (QGraphicsItem *)pixmap);
- QCOMPARE(scene.itemAt(-1, -1), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(pix.width() - 1, -1), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(-1, pix.height() - 1), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(pix.width(), pix.height()), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(0, pix.height()), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(pix.width(), 0), (QGraphicsItem *)0);
+ QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)pixmap);
+ QCOMPARE(itemAt(scene, pix.width() - 1, 0), (QGraphicsItem *)pixmap);
+ QCOMPARE(itemAt(scene, 0, pix.height() - 1), (QGraphicsItem *)pixmap);
+ QCOMPARE(itemAt(scene, pix.width() - 1, pix.height() - 1), (QGraphicsItem *)pixmap);
+
+ QVERIFY(scene.items(QPointF(-1, -1)).isEmpty());
+ QVERIFY(scene.items(QPointF(pix.width() - 1, -1)).isEmpty());
+ QVERIFY(scene.items(QPointF(-1, pix.height() - 1)).isEmpty());
+ QVERIFY(scene.items(QPointF(pix.width(), pix.height())).isEmpty());
+ QVERIFY(scene.items(QPointF(0, pix.height())).isEmpty());
+ QVERIFY(scene.items(QPointF(pix.width(), 0)).isEmpty());
}
void tst_QGraphicsScene::addRect()
@@ -1225,15 +1228,15 @@ void tst_QGraphicsScene::addRect()
rect->setPen(QPen(Qt::red, 0));
- QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)rect);
- QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)rect);
- QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)rect);
- QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)rect);
- QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)rect);
- QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0);
- QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)rect);
- QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
+ QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)rect);
+ QCOMPARE(itemAt(scene, -10, -10), (QGraphicsItem *)rect);
+ QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)rect);
+ QVERIFY(scene.items(QPointF(-10, 10)).isEmpty());
+ QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)rect);
+ QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)rect);
+ QVERIFY(scene.items(QPointF(10, -10)).isEmpty());
+ QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)rect);
+ QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
}
void tst_QGraphicsScene::addText()
@@ -1247,19 +1250,19 @@ void tst_QGraphicsScene::addText()
void tst_QGraphicsScene::removeItem()
{
-#if defined(Q_OS_WINCE) && !defined(GWES_ICONCURS)
+#if (defined(Q_OS_WINCE) && !defined(GWES_ICONCURS)) || defined(Q_OS_ANDROID)
QSKIP("No mouse cursor support");
#endif
QGraphicsScene scene;
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10));
- QCOMPARE(scene.itemAt(0, 0), item); // forces indexing
+ QCOMPARE(itemAt(scene, 0, 0), item); // forces indexing
scene.removeItem(item);
- QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)0);
+ QVERIFY(scene.items(QPointF(0, 0)).isEmpty());
delete item;
QGraphicsItem *item2 = scene.addRect(QRectF(0, 0, 10, 10));
item2->setFlag(QGraphicsItem::ItemIsSelectable);
- QCOMPARE(scene.itemAt(0, 0), item2);
+ QCOMPARE(itemAt(scene, 0, 0), item2);
// Removing a selected item
QVERIFY(scene.selectedItems().isEmpty());
@@ -1289,7 +1292,7 @@ void tst_QGraphicsScene::removeItem()
QTRY_VERIFY(hoverItem->isHovered);
scene.removeItem(hoverItem);
- hoverItem->setAcceptsHoverEvents(false);
+ hoverItem->setAcceptHoverEvents(false);
scene.addItem(hoverItem);
QTRY_VERIFY(!hoverItem->isHovered);
}
@@ -1801,7 +1804,7 @@ void tst_QGraphicsScene::createItemGroup()
scene.destroyItemGroup(group);
QGraphicsItemGroup *emptyGroup = scene.createItemGroup(QList<QGraphicsItem *>());
- QCOMPARE(emptyGroup->children(), QList<QGraphicsItem *>());
+ QVERIFY(emptyGroup->childItems().isEmpty());
QVERIFY(!emptyGroup->parentItem());
QCOMPARE(emptyGroup->scene(), &scene);
}
@@ -2140,7 +2143,7 @@ void tst_QGraphicsScene::mouseEventPropagation_mouseMove()
{
Scene scene;
scene.addRect(QRectF(5, 0, 12, 12));
- scene.addRect(QRectF(15, 0, 12, 12))->setAcceptsHoverEvents(true);
+ scene.addRect(QRectF(15, 0, 12, 12))->setAcceptHoverEvents(true);
for (int i = 0; i < 30; ++i) {
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseMove);
event.setScenePos(QPointF(i, 5));
@@ -2621,8 +2624,7 @@ void tst_QGraphicsScene::render()
scene.render(&painter, targetRect, sourceRect, aspectRatioMode);
painter.end();
- const QString renderPath = QLatin1String(SRCDIR) + "/testData/render";
- QString fileName = renderPath + QString("/%1.png").arg(QTest::currentDataTag());
+ QString fileName = QFINDTESTDATA(QString("/testData/render/%1.png").arg(QTest::currentDataTag()));
QImage original(fileName);
QVERIFY(!original.isNull());
@@ -2673,6 +2675,10 @@ void tst_QGraphicsScene::render()
void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight()
{
+#if defined(Q_OS_ANDROID)
+ QSKIP("Test only works on platforms with resizable windows");
+#endif
+
QGraphicsScene scene(0, 0, 150, 150);
// Add item with negative width.
@@ -2706,6 +2712,7 @@ void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight()
QCOMPARE(actual, expected);
}
+#ifndef QT_NO_CONTEXTMENU
void tst_QGraphicsScene::contextMenuEvent()
{
QGraphicsScene scene;
@@ -2747,6 +2754,10 @@ protected:
void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations()
{
+#if defined(Q_OS_ANDROID)
+ QSKIP("Test fails on some Android devices (QTBUG-44430)");
+#endif
+
QGraphicsScene scene(0, 0, 200, 200);
ContextMenuItem *item = new ContextMenuItem;
item->setFlag(QGraphicsItem::ItemIgnoresTransformations);
@@ -2788,6 +2799,7 @@ void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations()
QVERIFY(!event.isAccepted());
}
}
+#endif // QT_NO_CONTEXTMENU
void tst_QGraphicsScene::update()
{
@@ -2800,7 +2812,7 @@ void tst_QGraphicsScene::update()
rect->setPos(-100, -100);
// This function forces indexing
- scene.itemAt(0, 0);
+ itemAt(scene, 0, 0);
qRegisterMetaType<QList<QRectF> >("QList<QRectF>");
QSignalSpy spy(&scene, SIGNAL(changed(QList<QRectF>)));
@@ -2809,7 +2821,7 @@ void tst_QGraphicsScene::update()
scene.update();
// This function forces a purge, which will post an update signal
- scene.itemAt(0, 0);
+ itemAt(scene, 0, 0);
// This will process the pending update
QApplication::instance()->processEvents();
@@ -3257,10 +3269,11 @@ void tst_QGraphicsScene::tabFocus_sceneWithNestedFocusWidgets()
FocusWidget *widget1_1 = new FocusWidget;
FocusWidget *widget1_2 = new FocusWidget;
widget1_1->setParentItem(widget1);
- widget1_1->scale(0.5, 0.5);
+ const QTransform scale(QTransform::fromScale(0.5, 0.5));
+ widget1_1->setTransform(scale, true);
widget1_1->setPos(0, widget1->boundingRect().height() / 2);
widget1_2->setParentItem(widget1);
- widget1_2->scale(0.5, 0.5);
+ widget1_2->setTransform(scale, true);
widget1_2->setPos(widget1->boundingRect().width() / 2, widget1->boundingRect().height() / 2);
FocusWidget *widget2 = new FocusWidget;
@@ -3520,7 +3533,7 @@ void tst_QGraphicsScene::task250680_childClip()
QVERIFY(QPathCompare::comparePaths(rect->clipPath().simplified(), path));
QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2);
- rect->rotate(45);
+ rect->setTransform(QTransform().rotate(45), true);
QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2);
}
@@ -3599,20 +3612,20 @@ void tst_QGraphicsScene::sorting()
// view.show();
qDebug() << "items: {";
- foreach (QGraphicsItem *item, scene.items(32, 31, 4, 55))
+ foreach (QGraphicsItem *item, scene.items(QRectF(32, 31, 4, 55)))
qDebug() << "\t" << item->data(0).toString();
qDebug() << "}";
- QCOMPARE(scene.items(32, 31, 4, 55),
+ QCOMPARE(scene.items(QRectF(32, 31, 4, 55)),
QList<QGraphicsItem *>()
<< c_1_2 << c_1_1_1 << c_1 << t_1);
- QCOMPARE(scene.items(-53, 47, 136, 3),
+ QCOMPARE(scene.items(QRectF(-53, 47, 136, 3)),
QList<QGraphicsItem *>()
<< c_2_2 << c_2_1 << c_2 << c_1_2 << c_1_1 << c_1 << t_1);
- QCOMPARE(scene.items(-23, 79, 104, 3),
+ QCOMPARE(scene.items(QRectF(-23, 79, 104, 3)),
QList<QGraphicsItem *>()
<< c_2_1_1 << c_1_1_1);
- QCOMPARE(scene.items(-26, -3, 92, 79),
+ QCOMPARE(scene.items(QRectF(-26, -3, 92, 79)),
QList<QGraphicsItem *>()
<< c_2_2 << c_2_1_1 << c_2_1 << c_2
<< c_1_2 << c_1_1_1 << c_1_1 << c_1
@@ -4014,6 +4027,10 @@ void tst_QGraphicsScene::polishItems2()
void tst_QGraphicsScene::isActive()
{
+#if defined(Q_OS_ANDROID)
+ QSKIP("Fails on Android (QTBUG-44430)");
+#endif
+
QGraphicsScene scene1;
QVERIFY(!scene1.isActive());
QGraphicsScene scene2;
@@ -4376,7 +4393,7 @@ void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts()
QGraphicsProxyWidget *proxy = scene->addWidget(w);
proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
- proxy->rotate(15);
+ proxy->setTransform(QTransform().rotate(15), true);
view->show();
QVERIFY(QTest::qWaitForWindowExposed(view));
@@ -4422,7 +4439,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
scene->addItem(backItem);
rectItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
- backItem->rotate(15);
+ backItem->setTransform(QTransform().rotate(15), true);
view->show();
QVERIFY(QTest::qWaitForWindowExposed(view));
@@ -4464,7 +4481,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
scene->addItem(rectItem);
rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache);
- rectItem->rotate(15);
+ rectItem->setTransform(QTransform().rotate(15), true);
view->show();
QVERIFY(QTest::qWaitForWindowExposed(view));
@@ -4505,7 +4522,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
scene->addItem(rectItem);
rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache);
- rectItem->rotate(15);
+ rectItem->setTransform(QTransform().rotate(15), true);
view->show();
QVERIFY(QTest::qWaitForWindowExposed(view));
@@ -4609,41 +4626,41 @@ void tst_QGraphicsScene::focusItemChangedSignal()
QCOMPARE(spy.count(), 1);
QList<QVariant> arguments = spy.takeFirst();
QCOMPARE(arguments.size(), 3);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
- QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
+ QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
QVERIFY(topLevelItem2->hasFocus());
scene.clearFocus();
QCOMPARE(spy.count(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.size(), 3);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)0);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
- QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)0);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
scene.setFocus(Qt::MenuBarFocusReason);
QCOMPARE(spy.count(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.size(), 3);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
- QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::MenuBarFocusReason);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
+ QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::MenuBarFocusReason);
for (int i = 0; i < 3; ++i) {
topLevelItem1->setFocus(Qt::TabFocusReason);
arguments = spy.takeFirst();
QCOMPARE(arguments.size(), 3);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem1);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
- QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem1);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason);
topLevelItem2->setFocus(Qt::TabFocusReason);
arguments = spy.takeFirst();
QCOMPARE(arguments.size(), 3);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem1);
- QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem1);
+ QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason);
}
// The following two are unexpected, but fixing this (i.e., losing and gaining focus
@@ -4664,9 +4681,9 @@ void tst_QGraphicsScene::focusItemChangedSignal()
QCOMPARE(spy.count(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.size(), 3);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
- QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
QGraphicsRectItem *panel2 = new QGraphicsRectItem;
panel2->setFlags(QGraphicsItem::ItemIsPanel | QGraphicsItem::ItemIsFocusable);
@@ -4678,17 +4695,17 @@ void tst_QGraphicsScene::focusItemChangedSignal()
QCOMPARE(spy.count(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.size(), 3);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel2);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel1);
- QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel2);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel1);
+ QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
scene.setActivePanel(panel1);
QCOMPARE(spy.count(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.size(), 3);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1);
- QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel2);
- QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel2);
+ QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
}
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro b/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro
index 3d0d73566e..3b74ab0c75 100644
--- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro
@@ -4,4 +4,3 @@ requires(contains(QT_CONFIG,private_tests))
QT += widgets widgets-private testlib
QT += core-private gui-private
SOURCES += tst_qgraphicssceneindex.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
index b2d6eef9b1..f3ac70ddb5 100644
--- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.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$
**
@@ -327,7 +322,7 @@ void tst_QGraphicsSceneIndex::removeItems()
delete widgetChild1;
//We move the parent
- scene.items(295, 295, 50, 50);
+ scene.items(QRectF(295, 295, 50, 50));
//This should not crash
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro b/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro
index a46c803e41..68ee58d0d7 100644
--- a/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro
@@ -2,5 +2,3 @@ CONFIG += testcase
TARGET = tst_qgraphicstransform
QT += widgets testlib
SOURCES += tst_qgraphicstransform.cpp
-CONFIG += parallel_test
-
diff --git a/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp
index cf1edae9ff..da3270d527 100644
--- a/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.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$
**
@@ -39,12 +34,6 @@
class tst_QGraphicsTransform : public QObject {
Q_OBJECT
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
private slots:
void scale();
void rotation();
@@ -57,29 +46,6 @@ private:
QString toString(QTransform const&);
};
-
-// This will be called before the first test function is executed.
-// It is only called once.
-void tst_QGraphicsTransform::initTestCase()
-{
-}
-
-// This will be called after the last test function is executed.
-// It is only called once.
-void tst_QGraphicsTransform::cleanupTestCase()
-{
-}
-
-// This will be called before each test function is executed.
-void tst_QGraphicsTransform::init()
-{
-}
-
-// This will be called after every test function.
-void tst_QGraphicsTransform::cleanup()
-{
-}
-
static QTransform transform2D(const QGraphicsTransform& t)
{
QMatrix4x4 m;
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro
index d1f9bede0b..258b5e0e14 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro
@@ -9,4 +9,3 @@ SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp
HEADERS += tst_qgraphicsview.h
DEFINES += QT_NO_CAST_TO_ASCII
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 98473fb5cc..10f5a9161e 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.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$
**
@@ -275,9 +270,6 @@ public slots:
void dummySlot() {}
private:
-#if defined Q_OS_BLACKBERRY
- QScopedPointer<QWidget> rootWindow;
-#endif
QString platformName;
};
@@ -286,13 +278,6 @@ void tst_QGraphicsView::initTestCase()
#ifdef Q_OS_WINCE_WM
qApp->setAutoMaximizeThreshold(-1);
#endif
-
-#if defined Q_OS_BLACKBERRY
- // On BlackBerry first window is always shown full screen. However, many tests rely on specific
- // window sizes. Create a dummy full screen window, so subsequent windows have correct size.
- rootWindow.reset(new QWidget);
- rootWindow->show();
-#endif
}
void tst_QGraphicsView::cleanup()
@@ -468,10 +453,12 @@ void tst_QGraphicsView::interactive()
QCOMPARE(item->events.size(), i * 5 + 5);
QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GraphicsSceneMouseRelease);
QCOMPARE(item->events.at(item->events.size() - 1), QEvent::UngrabMouse);
+#ifndef QT_NO_CONTEXTMENU
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint));
QApplication::sendEvent(view.viewport(), &contextEvent);
QCOMPARE(item->events.size(), i * 5 + 6);
QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu);
+#endif // QT_NO_CONTEXTMENU
}
view.setInteractive(false);
@@ -483,10 +470,12 @@ void tst_QGraphicsView::interactive()
sendMouseRelease(view.viewport(), itemPoint);
QCOMPARE(item->events.size(), 501);
QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu);
+#ifndef QT_NO_CONTEXTMENU
QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint));
QApplication::sendEvent(view.viewport(), &contextEvent);
QCOMPARE(item->events.size(), 501);
QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu);
+#endif // QT_NO_CONTEXTMENU
}
}
@@ -583,7 +572,7 @@ void tst_QGraphicsView::sceneRect_growing()
QGraphicsScene scene;
for (int i = 0; i < 100; ++i)
- scene.addText(QString("(0, %1)").arg((i - 50) * 20))->setPos(0, (i - 50) * 20);
+ scene.addText(QLatin1String("(0, ") + QString::number((i - 50) * 20))->setPos(0, (i - 50) * 20);
QGraphicsView view(&scene, &toplevel);
view.setFixedSize(200, 200);
@@ -1391,8 +1380,8 @@ void tst_QGraphicsView::fitInView()
items[2]->setPos(-100, 100);
items[3]->setPos(100, 100);
- items[0]->rotate(30);
- items[1]->rotate(-30);
+ items[0]->setTransform(QTransform().rotate(30), true);
+ items[1]->setTransform(QTransform().rotate(-30), true);
#if defined(Q_OS_WINCE)
//Is the standard scrollbar size
@@ -2888,9 +2877,6 @@ void tst_QGraphicsView::scrollBarRanges()
QFETCH(ExpectedValueDescription, vmax);
QFETCH(bool, useStyledPanel);
- if (style == QLatin1String("GTK+") && useStyledPanel)
- QSKIP("GTK + style test skipped, see QTBUG-29002");
-
if (useStyledPanel && style == QStringLiteral("Macintosh") && platformName == QStringLiteral("cocoa"))
QSKIP("Insignificant on OSX");
QGraphicsScene scene;
@@ -3506,7 +3492,7 @@ void tst_QGraphicsView::embeddedViews()
SpyItem *item = new SpyItem;
v2->scene()->addItem(item);
- proxy->translate(5, 5);
+ proxy->setTransform(QTransform::fromTranslate(5, 5), true);
QImage actual(64, 64, QImage::Format_ARGB32_Premultiplied);
actual.fill(0);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h
index e3be0a4e46..8a83ee3272 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h
@@ -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$
**
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp
index eeee3a75c7..ff621b94c5 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.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$
**
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST
index c8d93585b2..13ec840eff 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST
@@ -1,3 +1,4 @@
[initialShow2]
ubuntu-14.04
rhel-7.1
+rhel-7.2
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro b/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro
index 481bc96d96..042c42f63f 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro
@@ -6,4 +6,3 @@ QT += core-private gui-private
SOURCES += tst_qgraphicswidget.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index ec2203e615..ca9f866e81 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.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$
**
@@ -49,6 +44,8 @@
#include "../../../qtest-config.h"
+typedef QList<QGraphicsItem *> QGraphicsItemList;
+
class EventSpy : public QObject
{
Q_OBJECT
@@ -77,12 +74,6 @@ protected:
class tst_QGraphicsWidget : public QObject {
Q_OBJECT
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
private slots:
void qgraphicswidget();
@@ -262,28 +253,6 @@ protected:
}
};
-// This will be called before the first test function is executed.
-// It is only called once.
-void tst_QGraphicsWidget::initTestCase()
-{
-}
-
-// This will be called after the last test function is executed.
-// It is only called once.
-void tst_QGraphicsWidget::cleanupTestCase()
-{
-}
-
-// This will be called before each test function is executed.
-void tst_QGraphicsWidget::init()
-{
-}
-
-// This will be called after every test function.
-void tst_QGraphicsWidget::cleanup()
-{
-}
-
class SizeHinter : public QGraphicsWidget
{
public:
@@ -588,7 +557,7 @@ void tst_QGraphicsWidget::focusPolicy_data()
QTest::addColumn<Qt::FocusPolicy>("focusPolicy2");
for (int i = 0; i < 25; ++i) {
- QTestData &data = QTest::newRow(QString("%1").arg(i).toLatin1());
+ QTestData &data = QTest::newRow(QByteArray::number(i).constData());
switch(i % 5) {
case 0: data << Qt::TabFocus; break;
case 1: data << Qt::ClickFocus; break;
@@ -1108,7 +1077,7 @@ void tst_QGraphicsWidget::initStyleOption()
view.setAlignment(Qt::AlignTop | Qt::AlignLeft);
SubQGraphicsWidget *widget = new SubQGraphicsWidget;
- widget->setAcceptsHoverEvents(true);
+ widget->setAcceptHoverEvents(true);
QStyleOption option;
scene.addItem(widget);
@@ -1464,27 +1433,37 @@ void tst_QGraphicsWidget::setTabOrder()
}
}
-static bool compareFocusChain(QGraphicsView *view, const QList<QGraphicsItem*> &order)
+template <class Iterator>
+bool compareFocusChain(QGraphicsView *view,
+ Iterator i1, Iterator i2,
+ QByteArray *errorMessage)
{
QGraphicsScene *scene = view->scene();
- QStringList actual;
QGraphicsItem *oldFocusItem = scene->focusItem();
- for (int i = 0; i < order.count(); ++i) {
- QGraphicsItem *focusItem = scene->focusItem();
- actual << focusItem->data(0).toString();
- //qDebug() << "i:" << i << "expected:" << QString::number(uint(order.at(i)), 16) << QString::number(uint(focusItem), 16);
- if (focusItem != order.at(i)) {
- qDebug() << "actual:" << actual;
+ Iterator last = i2 - 1;
+ for (Iterator i = i1; i != i2; ++i) {
+ QGraphicsItem *actualFocusItem = scene->focusItem();
+ QGraphicsItem *expectedFocusItem = *i;
+ if (actualFocusItem != expectedFocusItem) {
+ *errorMessage = "Actual:" + actualFocusItem->data(0).toByteArray()
+ + " expected:" + expectedFocusItem->data(0).toByteArray();
scene->setFocusItem(oldFocusItem);
return false;
}
- if (i < order.count() - 1)
+ if (i != last)
QTest::keyPress(view, Qt::Key_Tab);
}
scene->setFocusItem(oldFocusItem);
return true;
}
+template <class Container>
+bool compareFocusChain(QGraphicsView *view, const Container &c,
+ QByteArray *errorMessage)
+{
+ return compareFocusChain(view, c.constBegin(), c.constEnd(), errorMessage);
+}
+
void tst_QGraphicsWidget::setTabOrderAndReparent()
{
QGraphicsScene scene;
@@ -1494,78 +1473,68 @@ void tst_QGraphicsWidget::setTabOrderAndReparent()
QVERIFY(QTest::qWaitForWindowActive(&view));
QCOMPARE(QApplication::activeWindow(), (QWidget*)&view);
- int i;
- QGraphicsWidget *w1, *w2, *w3, *w4;
- for (i = 1; i < 4; ++i) {
- QGraphicsWidget *wid = new QGraphicsWidget;
- wid->setFocusPolicy(Qt::StrongFocus);
- wid->setData(0, QString::fromLatin1("w%1").arg(i));
- scene.addItem(wid);
- if (i == 1)
- w1 = wid;
- else if (i == 2)
- w2 = wid;
- else if (i == 3)
- w3 = wid;
- }
-
- w1->setFocus();
- QTRY_VERIFY(w1->hasFocus());
- QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w1 << w2 << w3));
+ QGraphicsWidget *w[4];
+ for (int i = 0; i < 3; ++i) {
+ w[i] = new QGraphicsWidget;
+ w[i]->setFocusPolicy(Qt::StrongFocus);
+ w[i]->setData(0, 'w' + QByteArray::number(i + 1));
+ scene.addItem(w[i]);
+ }
+
+ w[0]->setFocus();
+ QTRY_VERIFY(w[0]->hasFocus());
+ QByteArray errorMessage;
+ QVERIFY2(compareFocusChain(&view, w, w + 3, &errorMessage), errorMessage.constData());
QGraphicsWidget *p = new QGraphicsWidget;
p->setData(0, QLatin1String("parent"));
p->setFocusPolicy(Qt::StrongFocus);
- w1->setFocus();
- QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w1 << w2 << w3));
+ w[0]->setFocus();
+ QVERIFY2(compareFocusChain(&view, w, w + 3, &errorMessage), errorMessage.constData());
- w1->setParentItem(p);
- w2->setFocus();
- QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w2 << w3));
+ w[0]->setParentItem(p);
+ w[1]->setFocus();
+ QVERIFY2(compareFocusChain(&view, w + 1, w + 3, &errorMessage), errorMessage.constData());
- w2->setParentItem(p);
- w3->setFocus();
- QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w3));
- w3->setParentItem(p);
+ w[1]->setParentItem(p);
+ w[2]->setFocus();
+ QVERIFY2(compareFocusChain(&view, w + 2, w + 3, &errorMessage), errorMessage.constData());
+ w[2]->setParentItem(p);
QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem*>(0));
scene.addItem(p);
p->setFocus();
- QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << p << w1 << w2 << w3));
+ QVERIFY2(compareFocusChain(&view, QGraphicsItemList() << p << w[0] << w[1] << w[2],
+ &errorMessage), errorMessage.constData());
delete p;
- for (i = 1; i < 5; ++i) {
- QGraphicsWidget *wid = new QGraphicsWidget;
- wid->setFocusPolicy(Qt::StrongFocus);
- wid->setData(0, QString::fromLatin1("w%1").arg(i));
- scene.addItem(wid);
- if (i == 1)
- w1 = wid;
- else if (i == 2)
- w2 = wid;
- else if (i == 3)
- w3 = wid;
- else if (i == 4)
- w4 = wid;
- }
- w4->setParentItem(w1);
- QGraphicsWidget::setTabOrder(w1, w4);
- w1->setFocus();
- QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w1 << w4 << w2 << w3));
+ for (int i = 0; i < 4; ++i) {
+ w[i] = new QGraphicsWidget;
+ w[i]->setFocusPolicy(Qt::StrongFocus);
+ w[i]->setData(0, 'w' + QByteArray::number(i + 1));
+ scene.addItem(w[i]);
+ }
+
+ w[3]->setParentItem(w[0]);
+ QGraphicsWidget::setTabOrder(w[0], w[3]);
+ w[0]->setFocus();
+ QVERIFY2(compareFocusChain(&view, QGraphicsItemList() << w[0] << w[3] << w[1] << w[2],
+ &errorMessage), errorMessage.constData());
p = new QGraphicsWidget;
p->setData(0, QLatin1String("parent"));
p->setFocusPolicy(Qt::StrongFocus);
- w1->setParentItem(p);
- w2->setFocus();
- QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w2 << w3));
+ w[0]->setParentItem(p);
+ w[1]->setFocus();
+ QVERIFY2(compareFocusChain(&view, w + 1, w + 3, &errorMessage), errorMessage.constData());
scene.addItem(p);
- w2->setFocus();
- QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w2 << w3 << p << w1 << w4));
+ w[1]->setFocus();
+ QVERIFY2(compareFocusChain(&view, QGraphicsItemList() << w[1] << w[2] << p << w[0] << w[3],
+ &errorMessage), errorMessage.constData());
}
void tst_QGraphicsWidget::topLevelWidget_data()
@@ -1756,13 +1725,15 @@ void tst_QGraphicsWidget::verifyFocusChain()
w1_4->setGeometry(75,0,25, 25);
scene.addItem(w1_4);
QTRY_VERIFY(w1_3->hasFocus());
- QTRY_VERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4));
+ QByteArray errorMessage;
+ const QGraphicsItemList expected = QGraphicsItemList() << w1_3 << w1_4;
+ QTRY_VERIFY2(compareFocusChain(view, expected, &errorMessage), errorMessage.constData());
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab);
QTRY_VERIFY(lineEdit->hasFocus());
// tabFocusFirst should now point to w1_3
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab);
QTRY_VERIFY(w1_3->hasFocus());
- QTRY_VERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4));
+ QTRY_VERIFY2(compareFocusChain(view, expected, &errorMessage), errorMessage.constData());
}
}
@@ -2090,12 +2061,12 @@ void tst_QGraphicsWidget::task236127_bspTreeIndexFails()
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
- QTRY_VERIFY(!scene.itemAt(25, 25));
+ QTRY_VERIFY(scene.items(QPointF(25, 25)).isEmpty());
widget->setGeometry(0, 112, 360, 528);
- QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget);
+ QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget);
widget2->setGeometry(0, 573, 360, 67);
- QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget);
- QTRY_COMPARE(scene.itemAt(50, 585), (QGraphicsItem *)widget2);
+ QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget);
+ QTRY_COMPARE(scene.items(QPointF(50, 585)).value(0, Q_NULLPTR), (QGraphicsItem *)widget2);
}
void tst_QGraphicsWidget::defaultSize()