Fix qgraphicswidget::initStyleOption autotest
make sure it'll work with the new mouse handling as well. Change-Id: Ia2d567e618b77b0fa3532ee6c335cbdf5e496241 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>bb10
parent
71388c37d2
commit
73cc3db4d5
|
|
@ -3492,6 +3492,8 @@ void tst_QGraphicsScene::task160653_selectionChanged()
|
|||
|
||||
QSignalSpy spy(&scene, SIGNAL(selectionChanged()));
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
QTest::mouseClick(
|
||||
view.viewport(), Qt::LeftButton, 0, view.mapFromScene(scene.items().first()->scenePos()));
|
||||
QCOMPARE(spy.count(), 1);
|
||||
|
|
|
|||
|
|
@ -182,14 +182,6 @@ private slots:
|
|||
void QTBUG_45867_send_itemChildAddedChange_to_parent();
|
||||
};
|
||||
|
||||
|
||||
static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = 0)
|
||||
{
|
||||
QTest::mouseMove(widget, point);
|
||||
QMouseEvent event(QEvent::MouseMove, point, button, buttons, 0);
|
||||
QApplication::sendEvent(widget, &event);
|
||||
}
|
||||
|
||||
// Subclass that exposes the protected functions.
|
||||
class SubQGraphicsWidget : public QGraphicsWidget {
|
||||
public:
|
||||
|
|
@ -197,7 +189,7 @@ public:
|
|||
: QGraphicsWidget(parent, windowFlags), eventCount(0)
|
||||
{ }
|
||||
|
||||
void initStyleOption(QStyleOption *option)
|
||||
void initStyleOption(QStyleOption *option) const
|
||||
{ QGraphicsWidget::initStyleOption(option); }
|
||||
|
||||
void call_changeEvent(QEvent* event)
|
||||
|
|
@ -1110,8 +1102,8 @@ void tst_QGraphicsWidget::initStyleOption()
|
|||
{
|
||||
QGraphicsScene scene;
|
||||
QGraphicsView view(&scene);
|
||||
view.resize(300, 300);
|
||||
view.show();
|
||||
QApplication::setActiveWindow(&view);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
|
||||
view.setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
|
|
@ -1133,10 +1125,8 @@ void tst_QGraphicsWidget::initStyleOption()
|
|||
}
|
||||
QFETCH(bool, underMouse);
|
||||
if (underMouse) {
|
||||
view.resize(300, 300);
|
||||
view.show();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||
sendMouseMove(view.viewport(), view.mapFromScene(widget->mapToScene(widget->boundingRect().center())));
|
||||
QCursor::setPos(view.viewport()->mapToGlobal(view.mapFromScene(widget->mapToScene(widget->boundingRect().center()))));
|
||||
QTest::qWait(100);
|
||||
}
|
||||
|
||||
QFETCH(QPalette, palette);
|
||||
|
|
|
|||
Loading…
Reference in New Issue