From 94b6f1ad52e967961c034b6954df25ab86bb962b Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 12 Aug 2011 14:00:38 +1000 Subject: test: skip tst_QMenu::pushButtonPopulateOnAboutToShow() for picky WM We are trying to test the case of having a widget right next to the edge of the screen, but the window manager is likely to forbid this geometry in many cases. When this happens, we can't continue the test. Change-Id: I6bce2263bdf444221c5303e83d70a254bbb9194c Reviewed-on: http://codereview.qt.nokia.com/2892 Reviewed-by: Qt Sanity Bot Reviewed-by: Kalle Lehtonen --- tests/auto/qmenu/tst_qmenu.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 331f0e9a2d..73a74c6d75 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -883,12 +883,27 @@ void tst_QMenu::pushButtonPopulateOnAboutToShow() b.show(); const QRect screen = QApplication::desktop()->screenGeometry(scrNumber); - b.move(10, screen.bottom()-b.height()-5); + QRect desiredGeometry = b.geometry(); + desiredGeometry.moveTopLeft(QPoint(10, screen.bottom()-b.height()-5)); + + b.setGeometry(desiredGeometry); QTest::qWaitForWindowShown(&b); + + if (b.geometry() != desiredGeometry) { + // We are trying to put the button very close to the edge of the screen, + // explicitly to test behavior when the popup menu goes off the screen. + // However a modern window manager is quite likely to reject this requested geometry + // (kwin in kde4 does, for example, since the button would probably appear behind + // or partially behind the taskbar). + // Your best bet is to run this test _without_ a WM. + QSKIP("Your window manager won't allow a window against the bottom of the screen", SkipAll); + } + QTimer::singleShot(300,lastMenu, SLOT(hide())); QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center()); QVERIFY(!lastMenu->geometry().intersects(b.geometry())); + // note: we're assuming that, if we previously got the desired geometry, we'll get it here too b.move(10, screen.bottom()-lastMenu->height()-5); QTimer::singleShot(300,lastMenu, SLOT(hide())); QTest::mouseClick(&b, Qt::LeftButton, Qt::NoModifier, b.rect().center()); -- cgit v1.2.3