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>
This commit is contained in:
Friedemann Kleint 2015-06-16 11:48:34 +02:00
parent 9901bfe914
commit 97207e2c7f

View File

@ -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());