diff options
Diffstat (limited to 'tests/auto/qgraphicsview')
-rw-r--r-- | tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 1cce687..7b5ac7a 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -244,6 +244,9 @@ private slots: void QTBUG_4151_clipAndIgnore(); void QTBUG_5859_exposedRect(); void QTBUG_7438_cursor(); + +public slots: + void dummySlot() {} }; void tst_QGraphicsView::initTestCase() @@ -3202,14 +3205,18 @@ void tst_QGraphicsView::scrollAfterResize() void tst_QGraphicsView::moveItemWhileScrolling_data() { QTest::addColumn<bool>("adjustForAntialiasing"); + QTest::addColumn<bool>("changedConnected"); - QTest::newRow("no adjust") << false; - QTest::newRow("adjust") << true; + QTest::newRow("no adjust") << false << false; + QTest::newRow("adjust") << true << false; + QTest::newRow("no adjust changedConnected") << false << true; + QTest::newRow("adjust changedConnected") << true << true; } void tst_QGraphicsView::moveItemWhileScrolling() { QFETCH(bool, adjustForAntialiasing); + QFETCH(bool, changedConnected); class MoveItemScrollView : public QGraphicsView { @@ -3253,6 +3260,8 @@ void tst_QGraphicsView::moveItemWhileScrolling() view.resize(200, 200); view.painted = false; view.show(); + if (changedConnected) + QObject::connect(view.scene(), SIGNAL(changed(QList<QRectF>)), this, SLOT(dummySlot())); QTest::qWaitForWindowShown(&view); QApplication::processEvents(); QTRY_VERIFY(view.painted); @@ -3691,24 +3700,32 @@ void tst_QGraphicsView::update2_data() { QTest::addColumn<qreal>("penWidth"); QTest::addColumn<bool>("antialiasing"); + QTest::addColumn<bool>("changedConnected"); // Anti-aliased. - QTest::newRow("pen width: 0.0, antialiasing: true") << 0.0 << true; - QTest::newRow("pen width: 1.5, antialiasing: true") << 1.5 << true; - QTest::newRow("pen width: 2.0, antialiasing: true") << 2.0 << true; - QTest::newRow("pen width: 3.0, antialiasing: true") << 3.0 << true; + QTest::newRow("pen width: 0.0, antialiasing: true") << 0.0 << true << false; + QTest::newRow("pen width: 1.5, antialiasing: true") << 1.5 << true << false; + QTest::newRow("pen width: 2.0, antialiasing: true") << 2.0 << true << false; + QTest::newRow("pen width: 3.0, antialiasing: true") << 3.0 << true << false; // Aliased. - QTest::newRow("pen width: 0.0, antialiasing: false") << 0.0 << false; - QTest::newRow("pen width: 1.5, antialiasing: false") << 1.5 << false; - QTest::newRow("pen width: 2.0, antialiasing: false") << 2.0 << false; - QTest::newRow("pen width: 3.0, antialiasing: false") << 3.0 << false; + QTest::newRow("pen width: 0.0, antialiasing: false") << 0.0 << false << false; + QTest::newRow("pen width: 1.5, antialiasing: false") << 1.5 << false << false; + QTest::newRow("pen width: 2.0, antialiasing: false") << 2.0 << false << false; + QTest::newRow("pen width: 3.0, antialiasing: false") << 3.0 << false << false; + + // changed() connected + QTest::newRow("pen width: 0.0, antialiasing: false, changed") << 0.0 << false << true; + QTest::newRow("pen width: 1.5, antialiasing: true, changed") << 1.5 << true << true; + QTest::newRow("pen width: 2.0, antialiasing: false, changed") << 2.0 << false << true; + QTest::newRow("pen width: 3.0, antialiasing: true, changed") << 3.0 << true << true; } void tst_QGraphicsView::update2() { QFETCH(qreal, penWidth); QFETCH(bool, antialiasing); + QFETCH(bool, changedConnected); // Create a rect item. const QRectF rawItemRect(-50.4, -50.3, 100.2, 100.1); @@ -3719,6 +3736,9 @@ void tst_QGraphicsView::update2() // Add item to a scene. QGraphicsScene scene(-100, -100, 200, 200); + if (changedConnected) + QObject::connect(&scene, SIGNAL(changed(QList<QRectF>)), this, SLOT(dummySlot())); + scene.addItem(rect); // Create a view on the scene. |