From de9a3a8c71079e89173bea8029bbb4d0f3876bd5 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 22 Jul 2010 16:48:19 +0200 Subject: Fixed QTableView autotest to use a dummy toplevel widget. - Fixed some timing problems - Fixed mouseClick center --- tests/auto/qtableview/tst_qtableview.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 3e5d077..6c920c9 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -2591,9 +2591,10 @@ void tst_QTableView::scrollTo() QFETCH(int, expectedVerticalScroll); QtTestTableModel model(rowCount, columnCount); - QtTestTableView view; + QWidget toplevel; + QtTestTableView view(&toplevel); - view.show(); + toplevel.show(); // 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); @@ -2748,10 +2749,11 @@ void tst_QTableView::indexAt() QFETCH(int, expectedColumn); QtTestTableModel model(rowCount, columnCount); - QtTestTableView view; + QWidget toplevel; + QtTestTableView view(&toplevel); - view.show(); - QTest::qWaitForWindowShown(&view); + toplevel.show(); + QTest::qWaitForWindowShown(&toplevel); //some styles change the scroll mode in their polish view.setHorizontalScrollMode(QAbstractItemView::ScrollPerItem); @@ -3657,20 +3659,23 @@ void tst_QTableView::mouseWheel() #ifdef Q_OS_WINCE QSKIP("Since different Windows CE versions sport different taskbars, we skip this test", SkipAll); #endif + QFETCH(int, scrollMode); QFETCH(int, delta); QFETCH(int, horizontalPositon); QFETCH(int, verticalPosition); QtTestTableModel model(100, 100); - QtTestTableView view; + QWidget topLevel; + QtTestTableView view(&topLevel); view.resize(500, 500); for (int r = 0; r < 100; ++r) view.setRowHeight(r, 50); for (int c = 0; c < 100; ++c) view.setColumnWidth(c, 100); - view.show(); - QTest::qWaitForWindowShown(&view); + topLevel.show(); + + QTest::qWaitForWindowShown(&topLevel); view.setModel(&model); @@ -3772,7 +3777,7 @@ void tst_QTableView::task191545_dragSelectRows() QRect cellRect = table.visualRect(model.index(3, 0)); QHeaderView *vHeader = table.verticalHeader(); QWidget *vHeaderVp = vHeader->viewport(); - QPoint rowPos(5, (cellRect.top() + cellRect.bottom()) / 2); + QPoint rowPos(cellRect.center()); QMouseEvent rowPressEvent(QEvent::MouseButtonPress, rowPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier); qApp->sendEvent(vHeaderVp, &rowPressEvent); @@ -3851,6 +3856,7 @@ void tst_QTableView::task191545_dragSelectRows() QMouseEvent cellReleaseEvent(QEvent::MouseButtonRelease, cellPos, Qt::LeftButton, Qt::NoButton, Qt::ControlModifier); qApp->sendEvent(tableVp, &cellReleaseEvent); + QTest::qWait(200); for (int i = 0; i < 6; ++i) for (int j = 0; j < 6; ++j) { QModelIndex index = model.index(3 + i, 3 + j, table.rootIndex()); -- cgit v0.12