test: fixed crash in tst_qmenubar::accel in qpa

Always verify that the application has an active window before
attempting to generate a key click.

This problem potentially affected all platforms, but is rare on non-qpa
Linux since QTest::qWaitForWindowShown would usually avoid the problem
on that platform.

Change-Id: I0c30be6228361faffa121c9c2d7a667f8351ebd6
Reviewed-on: http://codereview.qt.nokia.com/2896
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
This commit is contained in:
Rohan McGovern 2011-08-12 15:18:08 +10:00 committed by Qt by Nokia
parent 879e351961
commit bf7ca774bd

View File

@ -344,6 +344,9 @@ void tst_QMenuBar::accel()
// create a popup menu with menu items set the accelerators later...
initSimpleMenubar();
// shortcuts won't work unless the window is active
QTRY_VERIFY( QApplication::activeWindow() );
// QTest::keyClick( 0, Qt::Key_A, AltKey );
QTest::keyClick( 0, Qt::Key_A, Qt::ControlModifier );
QTest::qWait(300);