From 97207e2c7f98d7910ef46b2cb7ee41a102995720 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 16 Jun 2015 11:48:34 +0200 Subject: 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 --- .../qabstractitemview/tst_qabstractitemview.cpp | 23 +++++----------------- 1 file 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()); -- cgit v1.2.3