Remove usage of deprecated qWaitForWindowShown(QWidget *) method.

Remove usages from autotests with the exception of
widgets/kernel, widgets/widgets and widgets/graphicsview.

Change-Id: I917b2857ed0cd07a6b3dbcd69244f558086c6586
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
bb10
Friedemann Kleint 2012-07-24 14:29:01 +02:00 committed by Qt by Nokia
parent ff453fa757
commit aaaf60aeab
16 changed files with 107 additions and 119 deletions

View File

@ -1403,7 +1403,7 @@ void tst_QTouchEvent::crashInQGraphicsSceneAfterNotHandlingTouchBegin()
view.setScene(&scene);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
QPoint centerPos = view.mapFromScene(rect->boundingRect().center());
// Touch the button
@ -1429,7 +1429,7 @@ void tst_QTouchEvent::touchBeginWithGraphicsWidget()
view.resize(200, 200);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.fitInView(scene.sceneRect());
QTest::touchEvent(&view, touchScreenDevice)

View File

@ -994,7 +994,7 @@ void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding()
QTextEdit *textEdit = new QTextEdit;
textEdit->setDocument(doc);
textEdit->show();
QTest::qWaitForWindowShown(textEdit);
QVERIFY(QTest::qWaitForWindowExposed(textEdit));
table->mergeCells(0,merge.at(0), merge.at(1), merge.at(2));
//Don't crash !
table->insertColumns(insert.at(0), insert.at(1));

View File

@ -151,7 +151,7 @@ void tst_QGLThreads::swapInThread()
widget.setThread(&thread);
widget.show();
QTest::qWaitForWindowShown(&widget);
QVERIFY(QTest::qWaitForWindowExposed(&widget));
thread.start();
while (thread.isRunning()) {
@ -259,7 +259,7 @@ void tst_QGLThreads::textureUploadInThread()
connect(&thread, SIGNAL(createdAndUploaded(QImage)), &display, SLOT(receiveImage(QImage)));
display.show();
QTest::qWaitForWindowShown(&display);
QVERIFY(QTest::qWaitForWindowActive(&display));
thread.start();
@ -436,7 +436,7 @@ void tst_QGLThreads::renderInThread()
SceneRenderingThread thread(&widget);
widget.show();
QTest::qWaitForWindowShown(&widget);
QVERIFY(QTest::qWaitForWindowExposed(&widget));
widget.doneCurrent();
thread.start();
@ -470,7 +470,7 @@ public:
GLWidgetWrapper() {
widget.resize(150, 150);
widget.show();
QTest::qWaitForWindowShown(&widget);
QTest::qWaitForWindowExposed(&widget);
widget.doneCurrent();
}
QPaintDevice *realPaintDevice() { return &widget; }

View File

@ -70,7 +70,7 @@ void tst_BaselineExample::testBasicUsage()
QPushButton b("Press me!");
b.resize(100, 50);
b.show();
QTest::qWaitForWindowShown(&b);
QVERIFY(QTest::qWaitForWindowExposed(&b));
QImage img1 = b.grab().toImage();
QVERIFY(!img1.isNull());
@ -84,7 +84,7 @@ void tst_BaselineExample::testMultipleImages()
QPushButton b("Press me!");
b.resize(100, 50);
b.show();
QTest::qWaitForWindowShown(&b);
QVERIFY(QTest::qWaitForWindowExposed(&b));
QBASELINE_CHECK(b.grab().toImage(), "text1");
b.setText("Kick me!");
@ -110,7 +110,7 @@ void tst_BaselineExample::testDataDriven()
QPushButton b(label);
b.resize(100, 50);
b.show();
QTest::qWaitForWindowShown(&b);
QVERIFY(QTest::qWaitForWindowExposed(&b));
QBASELINE_TEST(b.grab().toImage());
}
@ -136,7 +136,7 @@ void tst_BaselineExample::testDataDrivenChecksum()
QPushButton b(label);
b.resize(100, 50);
b.show();
QTest::qWaitForWindowShown(&b);
QVERIFY(QTest::qWaitForWindowExposed(&b));
QBASELINE_TEST(b.grab().toImage());
}

View File

@ -394,7 +394,7 @@ void tst_Gestures::customGesture()
GestureWidget widget;
widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
widget.show();
QTest::qWaitForWindowShown(&widget);
QVERIFY(QTest::qWaitForWindowExposed(&widget));
CustomEvent event;
event.hotSpot = widget.mapToGlobal(QPoint(5,5));
@ -863,7 +863,7 @@ void tst_Gestures::graphicsItemGesture()
item->setPos(100, 100);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item->grabGesture(CustomGesture::GestureType);
@ -925,7 +925,7 @@ void tst_Gestures::graphicsView()
item->setPos(100, 100);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item->grabGesture(CustomGesture::GestureType);
@ -1001,7 +1001,7 @@ void tst_Gestures::graphicsItemTreeGesture()
item1_child2->setParentItem(item1);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->grabGesture(CustomGesture::GestureType);
@ -1058,7 +1058,7 @@ void tst_Gestures::explicitGraphicsObjectTarget()
item2_child1->setPos(10, 10);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
@ -1117,7 +1117,7 @@ void tst_Gestures::gestureOverChildGraphicsItem()
item2_child1->setPos(0, 0);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->grabGesture(CustomGesture::GestureType);
@ -1415,7 +1415,7 @@ void tst_Gestures::testMapToScene()
item0->setPos(14, 16);
view.show(); // need to show to give it a global coordinate
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
QPoint origin = view.mapToGlobal(QPoint());
@ -1541,7 +1541,7 @@ void tst_Gestures::autoCancelGestures()
parent.grabGesture(CustomGesture::GestureType);
child->grabGesture(secondGesture);
parent.show();
QTest::qWaitForWindowShown(&parent);
QVERIFY(QTest::qWaitForWindowExposed(&parent));
/*
An event is send to both the child and the parent, when the child gets it a gesture is triggered
@ -1600,7 +1600,7 @@ void tst_Gestures::autoCancelGestures2()
child->grabGesture(secondGesture);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
CustomEvent event;
@ -1646,7 +1646,7 @@ void tst_Gestures::graphicsViewParentPropagation()
item1_c1_c1->setPos(0, 0);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item0->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent);
@ -1716,7 +1716,7 @@ void tst_Gestures::panelPropagation()
item1_child1_child1->setZValue(10);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@ -1827,7 +1827,7 @@ void tst_Gestures::panelStacksBehindParent()
panel->setZValue(5);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@ -1911,7 +1911,7 @@ void tst_Gestures::deleteGestureTargetItem()
items.insert(item2->objectName(), item2);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
if (propagateUpdateGesture)
@ -1956,7 +1956,7 @@ void tst_Gestures::viewportCoordinates()
scene.addItem(item1);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
CustomEvent event;
@ -1993,7 +1993,7 @@ void tst_Gestures::partialGesturePropagation()
scene.addItem(item4);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->ignoredUpdatedGestures << CustomGesture::GestureType;
@ -2081,7 +2081,7 @@ void tst_Gestures::testQGestureRecognizerCleanup()
//QGestureRecognizer::registerRecognizer(new PanRecognizer(PanRecognizer::Custom));
w->show();
QTest::qWaitForWindowShown(w);
QVERIFY(QTest::qWaitForWindowExposed(w));
delete w;
}
@ -2202,7 +2202,7 @@ void tst_Gestures::testReuseCanceledGestures()
gv->viewport()->grabGesture(tapGestureTypeId);
mw.show();
QTest::qWaitForWindowShown(&mw);
QVERIFY(QTest::qWaitForWindowExposed(&mw));
QPoint targetPos(gv->mapFromScene(target->mapToScene(target->rect().center())));
targetPos = gv->viewport()->mapFromParent(targetPos);
@ -2268,7 +2268,7 @@ void tst_Gestures::conflictingGesturesInGraphicsView()
scene.addItem(item2);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@ -2333,7 +2333,7 @@ void tst_Gestures::bug_13501_gesture_not_accepted()
NoConsumeWidgetBug13501 w;
w.grabGesture(Qt::TapGesture);
w.show();
QTest::qWaitForWindowShown(&w);
QVERIFY(QTest::qWaitForWindowExposed(&w));
//QTest::mousePress(&ignoreEvent, Qt::LeftButton);
QTouchDevice *device = new QTouchDevice;
device->setType(QTouchDevice::TouchScreen);

View File

@ -756,7 +756,7 @@ void tst_QAccessibility::actionTest()
{
QPushButton *button = new QPushButton;
button->show();
QTest::qWaitForWindowShown(button);
QVERIFY(QTest::qWaitForWindowExposed(button));
button->clearFocus();
QCOMPARE(button->hasFocus(), false);
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(button);
@ -2959,7 +2959,7 @@ void tst_QAccessibility::bridgeTest()
lay->addWidget(te);
window->show();
QTest::qWaitForWindowShown(window);
QVERIFY(QTest::qWaitForWindowExposed(window));
/**************************************************

View File

@ -135,6 +135,7 @@ void tst_QFocusEvent::initTestCase()
//qApp->setMainWidget( testFocusWidget ); Qt4
testFocusWidget->resize( 200,100 );
testFocusWidget->show();
QVERIFY(QTest::qWaitForWindowExposed(testFocusWidget));
// Applications don't get focus when launched from the command line on Mac.
#ifdef Q_OS_MAC
testFocusWidget->raise();
@ -159,19 +160,10 @@ void tst_QFocusEvent::initWidget()
{
// On X11 we have to ensure the event was processed before doing any checking, on Windows
// this is processed straight away.
QApplication::setActiveWindow(childFocusWidgetOne);
for (int i = 0; i < 1000; ++i) {
if (childFocusWidgetOne->isActiveWindow() && childFocusWidgetOne->hasFocus())
break;
childFocusWidgetOne->activateWindow();
childFocusWidgetOne->setFocus();
qApp->processEvents();
QTest::qWait(100);
}
// The first lineedit should have focus
QVERIFY( childFocusWidgetOne->hasFocus() );
QApplication::setActiveWindow(testFocusWidget);
childFocusWidgetOne->setFocus(); // The first lineedit should have focus
QVERIFY(QTest::qWaitForWindowActive(testFocusWidget));
QTRY_VERIFY(childFocusWidgetOne->hasFocus());
childFocusWidgetOne->focusInEventRecieved = false;
childFocusWidgetOne->focusInEventGotFocus = false;
@ -362,7 +354,7 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
d->show();
d->activateWindow(); // ### CDE
QApplication::setActiveWindow(d);
QTest::qWaitForWindowShown(d);
QVERIFY(QTest::qWaitForWindowActive(d));
QTRY_VERIFY(childFocusWidgetOne->focusOutEventRecieved);
QVERIFY(childFocusWidgetOne->focusOutEventLostFocus);
@ -381,6 +373,8 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
#ifdef Q_OS_MAC
QEXPECT_FAIL("", "QTBUG-22815", Abort);
#endif
if (QGuiApplication::platformName() == QStringLiteral("xcb"))
QSKIP("QTBUG-22815 - This test is unstable on this platform");
QTRY_VERIFY(childFocusWidgetOne->focusInEventRecieved);
QVERIFY(childFocusWidgetOne->focusInEventGotFocus);

View File

@ -1040,13 +1040,12 @@ void tst_QAbstractItemView::setItemDelegate()
}
}
v.show();
QVERIFY(QTest::qWaitForWindowExposed(&v));
#ifdef Q_WS_X11
QCursor::setPos(v.geometry().center());
QApplication::syncX();
#endif
QTest::qWait(20);
QApplication::setActiveWindow(&v);
QVERIFY(QTest::qWaitForWindowActive(&v));
QModelIndex index = model.index(cellToEdit.y(), cellToEdit.x());
v.edit(index);
@ -1453,8 +1452,8 @@ void tst_QAbstractItemView::QTBUG6407_extendedSelection()
view.show();
QApplication::setActiveWindow(&view);
QTest::qWaitForWindowShown(&view);
QTRY_COMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow());
QVERIFY(QTest::qWaitForWindowActive(&view));
QCOMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow());
view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum());
QTest::qWait(20);
@ -1492,7 +1491,7 @@ void tst_QAbstractItemView::QTBUG6753_selectOnSelection()
table.show();
table.setSelectionMode(QAbstractItemView::ExtendedSelection);
table.selectAll();
QTest::qWaitForWindowShown(&table);
QVERIFY(QTest::qWaitForWindowExposed(&table));
QModelIndex item = table.model()->index(1,1);
QRect itemRect = table.visualRect(item);
QTest::mouseMove(table.viewport(), itemRect.center());

View File

@ -1492,9 +1492,9 @@ void tst_QHeaderView::focusPolicy()
widget.show();
widget.setFocus(Qt::OtherFocusReason);
QApplication::setActiveWindow(&widget);
QTest::qWaitForWindowShown(&widget);
widget.activateWindow();
QTRY_VERIFY(widget.hasFocus());
QVERIFY(QTest::qWaitForWindowActive(&widget));
QVERIFY(widget.hasFocus());
QVERIFY(!widget.header()->hasFocus());
widget.setFocusPolicy(Qt::NoFocus);
@ -2158,7 +2158,7 @@ void tst_QHeaderView::QTBUG12268_hiddenMovedSectionSorting()
view.horizontalHeader()->moveSection(0,2);
view.setColumnHidden(1, true);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
QCOMPARE(view.horizontalHeader()->hiddenSectionCount(), 1);
QTest::mouseClick(view.horizontalHeader()->viewport(), Qt::LeftButton);
QCOMPARE(view.horizontalHeader()->hiddenSectionCount(), 1);
@ -2239,7 +2239,7 @@ void tst_QHeaderView::initialSortOrderRole()
view.setSortingEnabled(true);
view.sortByColumn(0, Qt::AscendingOrder);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
const int column1Pos = view.horizontalHeader()->sectionViewportPosition(1) + 5; // +5 not to be on the handle
QTest::mouseClick(view.horizontalHeader()->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(column1Pos, 0));

View File

@ -1312,7 +1312,7 @@ void tst_QItemDelegate::QTBUG4435_keepSelectionOnCheck()
view.setItemDelegate(new TestItemDelegate);
view.show();
view.selectAll();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
QStyleOptionViewItem option;
option.rect = view.visualRect(model.index(0, 0));
// mimic QStyledItemDelegate::initStyleOption logic

View File

@ -617,7 +617,7 @@ void tst_QListView::indexAt()
view2.setWrapping(true);
// We really want to make sure it is shown, because the layout won't be known until it is shown
view2.show();
QTest::qWaitForWindowShown(&view2);
QVERIFY(QTest::qWaitForWindowExposed(&view2));
QTRY_VERIFY(view2.m_shown);
QVERIFY(view2.m_index.isValid());
@ -770,7 +770,7 @@ void tst_QListView::hideFirstRow()
view.setUniformItemSizes(true);
view.setRowHidden(0,true);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
QTest::qWait(10);
}
@ -789,7 +789,7 @@ void tst_QListView::batchedMode()
view.setBatchSize(2);
view.resize(200,400);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
QTest::qWait(100);
#if defined(Q_OS_WINCE)
@ -1150,8 +1150,7 @@ void tst_QListView::selection()
#endif
topLevel.show();
QTest::qWaitForWindowShown(&v);
QApplication::processEvents();
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
v.setSelection(selectionRect, QItemSelectionModel::ClearAndSelect);
@ -1203,7 +1202,7 @@ void tst_QListView::scrollTo()
lv.setModel(&model);
lv.setFixedSize(100, 200);
topLevel.show();
QTest::qWaitForWindowShown(&topLevel);
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
//by default, the list view scrolls per item and has no wrapping
QModelIndex index = model.index(6,0);
@ -1571,7 +1570,7 @@ void tst_QListView::task248430_crashWith0SizedItem()
QStringListModel model(QStringList() << QLatin1String("item1") << QString());
view.setModel(&model);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
QTest::qWait(20);
}
@ -1584,7 +1583,7 @@ void tst_QListView::task250446_scrollChanged()
QVERIFY(index.isValid());
view.setCurrentIndex(index);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
const int scrollValue = view.verticalScrollBar()->maximum();
view.verticalScrollBar()->setValue(scrollValue);
QCOMPARE(view.verticalScrollBar()->value(), scrollValue);
@ -1641,8 +1640,9 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates()
list.setModel(&model);
list.setViewMode(QListView::IconMode);
list.show();
QTest::qWaitForWindowShown(&list);
list.activateWindow();
QVERIFY(QTest::qWaitForWindowActive(&list));
class MyItemDelegate : public QStyledItemDelegate
{
@ -1717,7 +1717,7 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes()
view.setViewMode(QListView::IconMode);
view.setModel(&model);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
// Verfify that item sizes are non-uniform
QVERIFY(view.sizeHintForIndex(model.index(0, 0)).height() > view.sizeHintForIndex(model.index(1, 0)).height());
@ -1747,7 +1747,7 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes()
view.setViewMode(QListView::IconMode);
view.setModel(&model);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
// Verfify that item sizes are non-uniform
QVERIFY(view.sizeHintForIndex(model.index(0, 0)).width() > view.sizeHintForIndex(model.index(1, 0)).width());
@ -1806,8 +1806,8 @@ void tst_QListView::task262152_setModelColumnNavigate()
view.show();
QApplication::setActiveWindow(&view);
QTest::qWaitForWindowShown(&view);
QTRY_COMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow());
QVERIFY(QTest::qWaitForWindowActive(&view));
QCOMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow());
QTest::keyClick(&view, Qt::Key_Down);
QTest::qWait(30);
QTRY_COMPARE(view.currentIndex(), model.index(1,1));
@ -1856,7 +1856,7 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems()
//QTBUG-7929 should not crash
topLevel.show();
QTest::qWaitForWindowShown(&topLevel);
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
QScrollBar *bar = view.flow() == QListView::TopToBottom
? view.verticalScrollBar() : view.horizontalScrollBar();
@ -1884,7 +1884,7 @@ void tst_QListView::taskQTBUG_633_changeModelData()
view.setModel(&model);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
model.setData( model.index(1, 0), QLatin1String("long long text"));
QTest::qWait(100); //leave time for relayouting the items
QRect rectLongText = view.visualRect(model.index(1,0));
@ -1926,7 +1926,7 @@ void tst_QListView::taskQTBUG_2678_spacingAndWrappedText()
w.setWordWrap(true);
w.setSpacing(10);
w.show();
QTest::qWaitForWindowShown(&w);
QVERIFY(QTest::qWaitForWindowExposed(&w));
QCOMPARE(w.horizontalScrollBar()->minimum(), w.horizontalScrollBar()->maximum());
}
@ -1943,7 +1943,7 @@ void tst_QListView::taskQTBUG_5877_skippingItemInPageDownUp()
vu.setModel(&model);
vu.show();
QTest::qWaitForWindowShown(&vu);
QVERIFY(QTest::qWaitForWindowExposed(&vu));
int itemHeight = vu.visualRect(model.index(0, 0)).height();
int visibleRowCount = vu.viewport()->height() / itemHeight;
@ -1988,7 +1988,7 @@ void tst_QListView::taskQTBUG_9455_wrongScrollbarRanges()
const int spacing = 40;
w.setSpacing(spacing);
w.show();
QTest::qWaitForWindowShown(&w);
QVERIFY(QTest::qWaitForWindowExposed(&w));
QCOMPARE(w.verticalScrollBar()->maximum(), w.contentsSize().height() - w.viewport()->geometry().height());
}
@ -2034,7 +2034,7 @@ void tst_QListView::taskQTBUG_12308_artihmeticException()
item->setHidden(true);
}
lw.show();
QTest::qWaitForWindowShown(&lw);
QVERIFY(QTest::qWaitForWindowExposed(&lw));
// No crash, it's all right.
}
@ -2067,7 +2067,7 @@ void tst_QListView::taskQTBUG_12308_wrongFlowLayout()
item->setHidden(true);
}
lw.show();
QTest::qWaitForWindowShown(&lw);
QVERIFY(QTest::qWaitForWindowExposed(&lw));
}
void tst_QListView::taskQTBUG_21115_scrollToAndHiddenItems_data()
@ -2092,7 +2092,7 @@ void tst_QListView::taskQTBUG_21115_scrollToAndHiddenItems()
model.setStringList(list);
lv.setModel(&model);
lv.show();
QTest::qWaitForWindowShown(&lv);
QVERIFY(QTest::qWaitForWindowExposed(&lv));
// Save first item rect for reference
QRect firstItemRect = lv.visualRect(model.index(0, 0));

View File

@ -1628,7 +1628,7 @@ void tst_QListWidget::QTBUG8086_currentItemChangedOnClick()
QSignalSpy spy(&list, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)));
QTest::qWaitForWindowShown(&win);
QVERIFY(QTest::qWaitForWindowExposed(&win));
QCOMPARE(spy.count(), 0);

View File

@ -690,8 +690,8 @@ void tst_QTableView::keyboardNavigation()
view.setCurrentIndex(index);
view.show();
QTest::qWaitForWindowShown(&view);
qApp->setActiveWindow(&view);
QVERIFY(QTest::qWaitForWindowActive(&view));
int row = rowCount - 1;
int column = columnCount - 1;
@ -2591,8 +2591,7 @@ void tst_QTableView::scrollTo()
// resizing to this size will ensure that there can ONLY_BE_ONE_CELL inside the view.
QSize forcedSize(columnWidth * 2, rowHeight * 2);
view.resize(forcedSize);
QTest::qWaitForWindowShown(&view);
QTest::qWait(50);
QVERIFY(QTest::qWaitForWindowExposed(&toplevel));
QTRY_COMPARE(view.size(), forcedSize);
view.setModel(&model);
@ -2746,7 +2745,7 @@ void tst_QTableView::indexAt()
QtTestTableView view(&toplevel);
toplevel.show();
QTest::qWaitForWindowShown(&toplevel);
QVERIFY(QTest::qWaitForWindowExposed(&toplevel));
//some styles change the scroll mode in their polish
view.setHorizontalScrollMode(QAbstractItemView::ScrollPerItem);
@ -3350,13 +3349,12 @@ void tst_QTableView::tabFocus()
window.show();
QApplication::setActiveWindow(&window);
QTest::qWaitForWindowShown(&window);
window.setFocus();
QTest::qWait(100);
window.activateWindow();
QVERIFY(QTest::qWaitForWindowActive(&window));
// window
QTRY_VERIFY(window.hasFocus());
QVERIFY(window.hasFocus());
QVERIFY(!view->hasFocus());
QVERIFY(!edit->hasFocus());
@ -3482,7 +3480,7 @@ void tst_QTableView::selectionSignal()
view.setModel(&model);
view.resize(200, 200);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.visualRect(model.index(2, 0)).center());
}
@ -3536,7 +3534,7 @@ void tst_QTableView::task173773_updateVerticalHeader()
view.setModel(&proxyModel);
view.setSortingEnabled(true);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.sortByColumn(0, Qt::AscendingOrder);
QTest::qWait(100);
@ -3601,7 +3599,7 @@ void tst_QTableView::task240266_veryBigColumn()
table.setColumnWidth(1, 100); //normal column
table.setColumnWidth(2, 9000); //very big column
table.show();
QTest::qWaitForWindowShown(&table);
QVERIFY(QTest::qWaitForWindowExposed(&table));
//some styles change the scroll mode in their polish
table.setHorizontalScrollMode(QAbstractItemView::ScrollPerItem);
@ -3682,7 +3680,7 @@ void tst_QTableView::mouseWheel()
view.setColumnWidth(c, 100);
topLevel.show();
QTest::qWaitForWindowShown(&topLevel);
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
view.setModel(&model);
@ -3743,7 +3741,7 @@ void tst_QTableView::task259308_scrollVerticalHeaderSwappedSections()
tv.verticalHeader()->swapSections(0, model.rowCount() - 1);
tv.setCurrentIndex(model.index(model.rowCount() - 1, 0));
QTest::qWaitForWindowShown(&tv);
QVERIFY(QTest::qWaitForWindowExposed(&tv));
QTest::keyClick(&tv, Qt::Key_PageUp); // PageUp won't scroll when at top
QTRY_COMPARE(tv.rowAt(0), tv.verticalHeader()->logicalIndex(0));
@ -3949,7 +3947,7 @@ void tst_QTableView::changeHeaderData()
QStandardItemModel model(5,5);
view.setModel(&model);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
QString text = "long long long text";
const int textWidth = view.verticalHeader()->fontMetrics().width(text);
@ -3967,7 +3965,7 @@ void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader()
QStandardItemModel model(500,5);
view.setModel(&model);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
int sbValueBefore = view.verticalScrollBar()->value();
QHeaderView *header = view.verticalHeader();
@ -4013,7 +4011,7 @@ void tst_QTableView::taskQTBUG_8585_crashForNoGoodReason()
w.setModel(&model);
connect(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), &w, SLOT(onDataChanged()));
w.show();
QTest::qWaitForWindowShown(&w);
QVERIFY(QTest::qWaitForWindowExposed(&w));
for (int i = 0; i < 10; i++)
{
QTest::mouseMove(w.viewport(), QPoint(50, 20));
@ -4038,7 +4036,7 @@ void tst_QTableView::taskQTBUG_7774_RtoLVisualRegionForSelection()
view.setModel(&model);
view.setLayoutDirection(Qt::RightToLeft);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
QItemSelectionRange range(model.index(2, 0), model.index(2, model.columnCount() - 1));
QItemSelection selection;

View File

@ -916,7 +916,7 @@ void tst_QTreeView::iconSize()
view.show();
view.update();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
QTRY_VERIFY(view.repainted);
QCOMPARE(view.iconSize(), QSize());
@ -3302,7 +3302,7 @@ void tst_QTreeView::task216717_updateChildren()
bool refreshed;
} tree;
tree.show();
QTest::qWaitForWindowShown(&tree);
QVERIFY(QTest::qWaitForWindowExposed(&tree));
tree.refreshed = false;
QTreeWidgetItem *parent = new QTreeWidgetItem(QStringList() << "parent");
tree.addTopLevelItem(parent);
@ -3591,7 +3591,7 @@ void tst_QTreeView::task246536_scrollbarsNotWorking()
QStandardItemModel model;
tree.setModel(&model);
tree.show();
QTest::qWaitForWindowShown(&tree);
QVERIFY(QTest::qWaitForWindowExposed(&tree));
QList<QStandardItem *> items;
for(int i=0; i<100; ++i){
items << new QStandardItem(QString::fromLatin1("item %1").arg(i));
@ -3646,7 +3646,7 @@ void tst_QTreeView::task239271_addRowsWithFirstColumnHidden()
view.hideColumn(0);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
delegate.paintedIndexes.clear();
QStandardItem sub1("sub1"), sub11("sub11");
root0.appendRow(QList<QStandardItem*>() << &sub1 << &sub11);
@ -3748,8 +3748,8 @@ void tst_QTreeView::doubleClickedWithSpans()
view.setFirstColumnSpanned(0, QModelIndex(), true);
view.show();
QApplication::setActiveWindow(&view);
QTest::qWaitForWindowShown(&view);
QTRY_VERIFY(view.isActiveWindow());
QVERIFY(QTest::qWaitForWindowActive(&view));
QVERIFY(view.isActiveWindow());
QPoint p(10, 10);
QCOMPARE(view.indexAt(p), model.index(0, 0));
@ -3820,7 +3820,7 @@ void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint()
view.painted = 0;
view.doCompare = false;
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
QTRY_VERIFY(view.painted > 0);
QTest::qWait(100); // This one is needed to make the test fail before the patch.
@ -3980,7 +3980,7 @@ void tst_QTreeView::taskQTBUG_11466_keyboardNavigationRegression()
model.bindView(&treeView);
treeView.expandAll();
treeView.show();
QTest::qWaitForWindowShown(&treeView);
QVERIFY(QTest::qWaitForWindowExposed(&treeView));
QTest::keyPress(treeView.viewport(), Qt::Key_Down);
QTest::qWait(10);
@ -3995,7 +3995,7 @@ void tst_QTreeView::taskQTBUG_13567_removeLastItemRegression()
view.setSelectionMode(QAbstractItemView::ExtendedSelection);
view.setModel(&model);
view.show();
QTest::qWaitForWindowShown(&view);
QVERIFY(QTest::qWaitForWindowExposed(&view));
view.scrollToBottom();
QTest::qWait(10);

View File

@ -771,8 +771,8 @@ void tst_QStyleSheetStyle::focusColors()
frame.setLayout(layout);
frame.show();
QTest::qWaitForWindowShown(&frame);
QApplication::setActiveWindow(&frame);
QVERIFY(QTest::qWaitForWindowActive(&frame));
widget->setFocus();
QApplication::processEvents();
@ -831,9 +831,8 @@ void tst_QStyleSheetStyle::hoverColors()
QCursor::setPos(QPoint(0,0));
#endif
QTest::qWaitForWindowShown(&frame);
QApplication::setActiveWindow(&frame);
QTest::qWait(60);
QVERIFY(QTest::qWaitForWindowActive(&frame));
//move the mouse inside the widget, it should be colored
QTest::mouseMove ( widget, QPoint(6,6));
QTest::qWait(60);
@ -946,7 +945,7 @@ void tst_QStyleSheetStyle::background()
QWidget* widget = widgets[c];
widget->show();
QTest::qWaitForWindowShown(widget);
QVERIFY(QTest::qWaitForWindowExposed(widget));
QImage image(widget->width(), widget->height(), QImage::Format_ARGB32);
widget->render(&image);
@ -969,8 +968,7 @@ void tst_QStyleSheetStyle::tabAlignement()
tabWidget.addTab(new QLabel("tab1"),"tab1");
tabWidget.resize(QSize(400,400));
topLevel.show();
QTest::qWaitForWindowShown(&tabWidget);
QTest::qWait(50);
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
QTabBar *bar = qFindChild<QTabBar*>(&tabWidget);
QVERIFY(bar);
//check the tab is on the right
@ -1292,7 +1290,7 @@ void tst_QStyleSheetStyle::emptyStyleSheet()
layout.addWidget(new QGroupBox("some text", &w));
w.show();
QTest::qWaitForWindowShown(&w);
QVERIFY(QTest::qWaitForWindowExposed(&w));
//workaround the fact that the label sizehint is one pixel different the first time.
label.setIndent(0); //force to recompute the sizeHint:
w.setFocus();
@ -1481,8 +1479,8 @@ void tst_QStyleSheetStyle::complexWidgetFocus()
frame.setLayout(layout);
frame.show();
QTest::qWaitForWindowShown(&frame);
QApplication::setActiveWindow(&frame);
QVERIFY(QTest::qWaitForWindowActive(&frame));
foreach (QWidget *widget, widgets) {
widget->setFocus();
QApplication::processEvents();
@ -1558,10 +1556,9 @@ void tst_QStyleSheetStyle::task232085_spinBoxLineEditBg()
frame.setLayout(layout);
frame.show();
QTest::qWaitForWindowShown(&frame);
QApplication::setActiveWindow(&frame);
spinbox->setFocus();
QApplication::processEvents();
QVERIFY(QTest::qWaitForWindowActive(&frame));
QImage image(frame.width(), frame.height(), QImage::Format_ARGB32);
frame.render(&image);
@ -1633,7 +1630,7 @@ void tst_QStyleSheetStyle::QTBUG11658_cachecrash()
w = new Widget();
w->show();
QTest::qWaitForWindowShown(w);
QVERIFY(QTest::qWaitForWindowExposed(w));
delete w;
qApp->setStyleSheet(QString());
}
@ -1652,7 +1649,7 @@ void tst_QStyleSheetStyle::QTBUG15910_crashNullWidget()
} w;
w.setStyleSheet("* { background-color: white; color:black; border 3px solid yellow }");
w.show();
QTest::qWaitForWindowShown(&w);
QVERIFY(QTest::qWaitForWindowExposed(&w));
}

View File

@ -1077,8 +1077,8 @@ void tst_QCompleter::multipleWidgets()
QWidget window;
window.show();
QApplication::setActiveWindow(&window);
QTest::qWaitForWindowShown(&window);
QTRY_VERIFY(qApp->activeWindow() == &window);
QVERIFY(QTest::qWaitForWindowActive(&window));
QVERIFY(qApp->activeWindow() == &window);
QFocusEvent focusIn(QEvent::FocusIn);
QFocusEvent focusOut(QEvent::FocusOut);
@ -1494,8 +1494,8 @@ void tst_QCompleter::QTBUG_14292_filesystem()
QWidget w;
w.show();
QApplication::setActiveWindow(&w);
QTest::qWaitForWindowShown(&w);
QTRY_VERIFY(!edit.hasFocus() && !comp.popup()->hasFocus());
QVERIFY(QTest::qWaitForWindowActive(&w));
QVERIFY(!edit.hasFocus() && !comp.popup()->hasFocus());
QVERIFY(fs.createDirectory(tmpDir.filePath("hemo")));
//there is no reason creating a file should open a popup, it did in Qt 4.7.0