summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@nokia.com>2010-07-22 14:48:19 (GMT)
committerHarald Fernengel <harald.fernengel@nokia.com>2010-11-02 14:24:37 (GMT)
commitde9a3a8c71079e89173bea8029bbb4d0f3876bd5 (patch)
tree6b416a719d6e1dde92e6038454ec0e3e85c4f252
parent978c1c612aacde31cc294f5ba2ad1af6feeae61c (diff)
downloadQt-de9a3a8c71079e89173bea8029bbb4d0f3876bd5.zip
Qt-de9a3a8c71079e89173bea8029bbb4d0f3876bd5.tar.gz
Qt-de9a3a8c71079e89173bea8029bbb4d0f3876bd5.tar.bz2
Fixed QTableView autotest to use a dummy toplevel widget.
- Fixed some timing problems - Fixed mouseClick center
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp24
1 files 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());