diff options
Diffstat (limited to 'tests')
7 files changed, 50 insertions, 22 deletions
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index 5dc0c9d..fa6a5ec 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -183,20 +183,20 @@ void tst_QGraphicsEffect::source() QGraphicsItem *item = new QGraphicsRectItem(0, 0, 10, 10); item->setGraphicsEffect(effect); QVERIFY(effect->source()); - QCOMPARE(effect->source()->graphicsItem(), item); + QCOMPARE(effect->source()->graphicsItem(), (const QGraphicsItem*)item); QVERIFY(effect->m_sourceChangedFlags & QGraphicsEffect::SourceAttached); effect->reset(); // Make sure disabling/enabling the effect doesn't change the source. effect->setEnabled(false); QVERIFY(effect->source()); - QCOMPARE(effect->source()->graphicsItem(), item); + QCOMPARE(effect->source()->graphicsItem(), (const QGraphicsItem*)item); QVERIFY(!effect->m_sourceChangedFlags); effect->reset(); effect->setEnabled(true); QVERIFY(effect->source()); - QCOMPARE(effect->source()->graphicsItem(), item); + QCOMPARE(effect->source()->graphicsItem(), (const QGraphicsItem*)item); QVERIFY(!effect->m_sourceChangedFlags); effect->reset(); @@ -210,7 +210,7 @@ void tst_QGraphicsEffect::source() item->setGraphicsEffect(effect); QPointer<QGraphicsEffectSource> source = effect->source(); QVERIFY(source); - QCOMPARE(source->graphicsItem(), item); + QCOMPARE(source->graphicsItem(), (const QGraphicsItem*)item); delete item; QVERIFY(!effect); QVERIFY(!source); diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index 49a76fa..af23b46 100644 --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -209,7 +209,7 @@ void tst_QGraphicsEffectSource::init() void tst_QGraphicsEffectSource::graphicsItem() { QVERIFY(effect->source()); - QCOMPARE(effect->source()->graphicsItem(), item); + QCOMPARE(effect->source()->graphicsItem(), (const QGraphicsItem*)item); } void tst_QGraphicsEffectSource::styleOption() @@ -237,7 +237,7 @@ void tst_QGraphicsEffectSource::isPixmap() CustomEffect *anotherEffect = new CustomEffect; pixmapItem->setGraphicsEffect(anotherEffect); QVERIFY(anotherEffect->source()); - QCOMPARE(anotherEffect->source()->graphicsItem(), static_cast<QGraphicsItem *>(pixmapItem)); + QCOMPARE(anotherEffect->source()->graphicsItem(), static_cast<const QGraphicsItem *>(pixmapItem)); QVERIFY(anotherEffect->source()->isPixmap()); delete pixmapItem; } diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 6cea834..411c790 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -788,7 +788,7 @@ void tst_QGraphicsProxyWidget::focusNextPrevChild() view.show(); QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); if (hasScene) { scene.addItem(proxy); proxy->show(); @@ -837,7 +837,7 @@ void tst_QGraphicsProxyWidget::focusOutEvent() view.setFocus(); QTest::qWaitForWindowShown(&view); QTRY_VERIFY(view.isVisible()); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); QWidget *widget = new QWidget; widget->setFocusPolicy(Qt::WheelFocus); @@ -1093,7 +1093,7 @@ void tst_QGraphicsProxyWidget::keyPressEvent() view.viewport()->setFocus(); QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget; proxy->setFlag(QGraphicsItem::ItemIsFocusable, true); // ### remove me!!! @@ -1134,7 +1134,7 @@ void tst_QGraphicsProxyWidget::keyReleaseEvent() view.show(); QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget; @@ -1178,7 +1178,7 @@ void tst_QGraphicsProxyWidget::mouseDoubleClickEvent() QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget; proxy->setFlag(QGraphicsItem::ItemIsFocusable, true); // ### remove me!!! @@ -3472,7 +3472,7 @@ void tst_QGraphicsProxyWidget::clickFocus() qt_x11_wait_for_window_manager(&view); #endif QApplication::setActiveWindow(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); QVERIFY(!proxy->hasFocus()); QVERIFY(!proxy->widget()->hasFocus()); diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 67a41ca..903977c 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -1491,7 +1491,7 @@ void tst_QGraphicsScene::clear() scene.setItemIndexMethod(QGraphicsScene::NoIndex); scene.addItem(firstItem); scene.addItem(secondItem); - QCOMPARE(scene.items().at(0), firstItem); + QCOMPARE(scene.items().at(0), (QGraphicsItem*)firstItem); QCOMPARE(scene.items().at(1), secondItem); ClearTestItem *thirdItem = new ClearTestItem(firstItem); diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index bda22eb..e5628d1 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -890,7 +890,7 @@ void tst_QGraphicsWidget::initStyleOption() qt_x11_wait_for_window_manager(&view); #endif QApplication::setActiveWindow(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); view.setAlignment(Qt::AlignTop | Qt::AlignLeft); SubQGraphicsWidget *widget = new SubQGraphicsWidget; @@ -1222,7 +1222,7 @@ void tst_QGraphicsWidget::setTabOrder() qt_x11_wait_for_window_manager(&view); #endif QApplication::setActiveWindow(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); QGraphicsWidget *lastItem = 0; QTest::ignoreMessage(QtWarningMsg, "QGraphicsWidget::setTabOrder(0, 0) is undefined"); @@ -1285,7 +1285,7 @@ void tst_QGraphicsWidget::setTabOrderAndReparent() view.show(); QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); int i; QGraphicsWidget *w1, *w2, *w3, *w4; @@ -1425,7 +1425,7 @@ void tst_QGraphicsWidget::verifyFocusChain() view.show(); QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); { // parent/child focus @@ -1552,7 +1552,7 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie() qt_x11_wait_for_window_manager(&view); #endif QApplication::setActiveWindow(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); // delete item in focus chain with no focus and verify chain SubQGraphicsWidget *parent = new SubQGraphicsWidget(0, Qt::Window); @@ -2503,7 +2503,7 @@ void tst_QGraphicsWidget::task250119_shortcutContext() view.setScene(&scene); view.show(); QApplication::setActiveWindow(&view); - QTRY_COMPARE(QApplication::activeWindow(), &view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view); // *** Event: *** diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp index 46bd4a2..69b1390 100644 --- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -98,6 +98,8 @@ private slots: void rangeOperatorLessThan_data(); void rangeOperatorLessThan(); + void testDifferentModels(); + private: QAbstractItemModel *model; QItemSelectionModel *selection; @@ -2561,5 +2563,31 @@ void tst_QItemSelectionModel::rangeOperatorLessThan() QVERIFY(r4 < r2); } +void tst_QItemSelectionModel::testDifferentModels() +{ + QStandardItemModel model1; + QStandardItemModel model2; + QStandardItem top11("Child1"), top12("Child2"), top13("Child3"); + QStandardItem top21("Child1"), top22("Child2"), top23("Child3"); + + model1.appendColumn(QList<QStandardItem*>() << &top11 << &top12 << &top13); + model2.appendColumn(QList<QStandardItem*>() << &top21 << &top22 << &top23); + + + QModelIndex topIndex1 = model1.index(0, 0); + QModelIndex bottomIndex1 = model1.index(2, 0); + QModelIndex topIndex2 = model2.index(0, 0); + + QItemSelectionRange range(topIndex1, bottomIndex1); + + QVERIFY(range.intersects(QItemSelectionRange(topIndex1, topIndex1))); + QVERIFY(!range.intersects(QItemSelectionRange(topIndex2, topIndex2))); + + QItemSelection newSelection; + QItemSelection::split(range, QItemSelectionRange(topIndex2, topIndex2), &newSelection); + + QVERIFY(newSelection.isEmpty()); +} + QTEST_MAIN(tst_QItemSelectionModel) #include "tst_qitemselectionmodel.moc" diff --git a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp index e473176..605cee6 100644 --- a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp +++ b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp @@ -280,7 +280,7 @@ void tst_QPauseAnimation::sequentialPauseGroup() QVERIFY(group.state() == QAbstractAnimation::Running); QVERIFY(animation1.state() == QAbstractAnimation::Stopped); - QCOMPARE(&animation2, group.currentAnimation()); + QCOMPARE((QAbstractAnimation*)&animation2, group.currentAnimation()); QVERIFY(animation2.state() == QAbstractAnimation::Running); QVERIFY(animation3.state() == QAbstractAnimation::Stopped); @@ -292,7 +292,7 @@ void tst_QPauseAnimation::sequentialPauseGroup() QVERIFY(group.state() == QAbstractAnimation::Running); QVERIFY(animation1.state() == QAbstractAnimation::Stopped); QVERIFY(animation2.state() == QAbstractAnimation::Stopped); - QCOMPARE(&animation3, group.currentAnimation()); + QCOMPARE((QAbstractAnimation*)&animation3, group.currentAnimation()); QVERIFY(animation3.state() == QAbstractAnimation::Running); group.setCurrentTime(750); @@ -329,7 +329,7 @@ void tst_QPauseAnimation::sequentialGroupWithPause() QVERIFY(group.state() == QAbstractAnimation::Running); QVERIFY(animation.state() == QAbstractAnimation::Stopped); - QCOMPARE(&pause, group.currentAnimation()); + QCOMPARE((QAbstractAnimation*)&pause, group.currentAnimation()); QVERIFY(pause.state() == QAbstractAnimation::Running); group.setCurrentTime(600); |