diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-06-16 11:48:34 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-06-26 06:48:32 +0000 |
commit | 97207e2c7f98d7910ef46b2cb7ee41a102995720 (patch) | |
tree | 6489f9b82627fd8f949d885925e0d976d3975fed /tests/auto | |
parent | 9901bfe914ab58655f0cc95ddea08d2d171af459 (diff) |
Prospective fix to stabilize tst_QAbstractItemView::task200665_itemEntered().
The test tried to position the mouse cursor over item #0 . This
sometimes results in the cursor being outside the window when
the window manager adds the window decoration on X11.
Move the cursor to the center of the window instead.
Add cleanup slot checking top level leaks, remove empty
functions.
Change-Id: I908240e1cc3fdbe370b43eae0015272ca342a312
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 90580aea05..eed38752d9 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -197,16 +197,11 @@ class tst_QAbstractItemView : public QObject Q_OBJECT public: - - tst_QAbstractItemView(); - virtual ~tst_QAbstractItemView(); void basic_tests(TestView *view); -public slots: - void initTestCase(); - void cleanupTestCase(); - private slots: + void initTestCase(); + void cleanup(); void getSetCheck(); void emptyModels_data(); void emptyModels(); @@ -360,14 +355,6 @@ void tst_QAbstractItemView::getSetCheck() QCOMPARE(16, obj1->autoScrollMargin()); } -tst_QAbstractItemView::tst_QAbstractItemView() -{ -} - -tst_QAbstractItemView::~tst_QAbstractItemView() -{ -} - void tst_QAbstractItemView::initTestCase() { #ifdef Q_OS_WINCE_WM @@ -375,8 +362,9 @@ void tst_QAbstractItemView::initTestCase() #endif } -void tst_QAbstractItemView::cleanupTestCase() +void tst_QAbstractItemView::cleanup() { + QVERIFY(QApplication::topLevelWidgets().isEmpty()); } void tst_QAbstractItemView::emptyModels_data() @@ -1330,8 +1318,7 @@ void tst_QAbstractItemView::task200665_itemEntered() moveCursorAway(&view); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QRect rect = view.visualRect(model.index(0,0)); - QCursor::setPos( view.viewport()->mapToGlobal(rect.center()) ); + QCursor::setPos( view.geometry().center() ); QCoreApplication::processEvents(); QSignalSpy spy(&view, SIGNAL(entered(QModelIndex))); view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum()); |