void tst_QColumnView::doubleClick() { QColumnView view; QColumnViewGrip *grip = new QColumnViewGrip(&view); QSignalSpy spy(grip, SIGNAL(gripMoved(int))); view.setCornerWidget(grip); view.resize(200, 200); QCOMPARE(view.width(), 200); QTest::mouseDClick(grip, Qt::LeftButton); QCOMPARE(view.width(), view.sizeHint().width()); QCOMPARE(spy.count(), 1); }
void tst_QColumnView::gripMoved() { QColumnView view; QColumnViewGrip *grip = new QColumnViewGrip(&view); QSignalSpy spy(grip, SIGNAL(gripMoved(int))); view.setCornerWidget(grip); view.move(300, 300); view.resize(200, 200); qApp->processEvents(); int oldWidth = view.width(); QTest::mousePress(grip, Qt::LeftButton, 0, QPoint(1,1)); //QTest::mouseMove(grip, QPoint(grip->globalX()+50, y)); QPoint posNew = QPoint(grip->mapToGlobal(QPoint(1,1)).x() + 65, 0); QMouseEvent *event = new QMouseEvent(QEvent::MouseMove, posNew, posNew, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QCoreApplication::postEvent(grip, event); QCoreApplication::processEvents(); QTest::mouseRelease(grip, Qt::LeftButton); QCOMPARE(spy.count(), 1); QCOMPARE(view.width(), oldWidth + 65); }