tst_QMenuBar: remove QSKIP's -> omit whole test cases instead

Change-Id: I2cf356c5790fd7f2b27a9032e2effacd098b3d05
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
This commit is contained in:
J-P Nurmi 2012-09-27 15:50:01 +02:00 committed by The Qt Project
parent f0ee31dc93
commit f92f78094d

View File

@ -110,6 +110,8 @@ private slots:
void removeItem(); void removeItem();
void count(); void count();
void insertItem_QString_QObject(); void insertItem_QString_QObject();
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
void accel(); void accel();
void activatedCount(); void activatedCount();
void allowActiveAndDisabled(); void allowActiveAndDisabled();
@ -119,9 +121,11 @@ private slots:
void check_cursorKeys2(); void check_cursorKeys2();
void check_cursorKeys3(); void check_cursorKeys3();
void check_homeKey();
void check_endKey();
void check_escKey(); void check_escKey();
#endif
void check_endKey();
void check_homeKey();
// void check_mouse1_data(); // void check_mouse1_data();
// void check_mouse1(); // void check_mouse1();
@ -129,12 +133,16 @@ private slots:
// void check_mouse2(); // void check_mouse2();
void check_altPress(); void check_altPress();
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
void check_shortcutPress(); void check_shortcutPress();
void check_menuPosition(); void check_menuPosition();
#endif
void task223138_triggered(); void task223138_triggered();
void task256322_highlight(); void task256322_highlight();
void menubarSizeHint(); void menubarSizeHint();
#ifndef Q_OS_MAC
void taskQTBUG4965_escapeEaten(); void taskQTBUG4965_escapeEaten();
#endif
void taskQTBUG11823_crashwithInvisibleActions(); void taskQTBUG11823_crashwithInvisibleActions();
protected slots: protected slots:
@ -324,12 +332,10 @@ void tst_QMenuBar::onActivated( QAction* action )
// printf( QString("acceleratorId: %1, count: %1\n").arg( i ).arg(activated_count) ); // printf( QString("acceleratorId: %1, count: %1\n").arg( i ).arg(activated_count) );
} }
// On Mac/WinCE, native key events are needed to test menu action activation
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
void tst_QMenuBar::accel() void tst_QMenuBar::accel()
{ {
#if defined(Q_OS_MAC) || defined(Q_OS_WINCE_WM)
QSKIP("On Mac/WinCE, native key events are needed to test menu action activation");
#endif
// create a popup menu with menu items set the accelerators later... // create a popup menu with menu items set the accelerators later...
initSimpleMenubar(); initSimpleMenubar();
@ -341,12 +347,12 @@ void tst_QMenuBar::accel()
QCOMPARE( last_accel_id, action ); QCOMPARE( last_accel_id, action );
} }
#endif
// On Mac/WinCE, native key events are needed to test menu action activation
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
void tst_QMenuBar::activatedCount() void tst_QMenuBar::activatedCount()
{ {
#if defined(Q_OS_MAC) || defined(Q_OS_WINCE_WM)
QSKIP("On Mac/WinCE, native key events are needed to test menu action activation");
#endif
// create a popup menu with menu items set the accelerators later... // create a popup menu with menu items set the accelerators later...
initSimpleMenubar(); initSimpleMenubar();
@ -354,6 +360,7 @@ void tst_QMenuBar::activatedCount()
//wait(5000); //wait(5000);
QCOMPARE( activated_count, 2 ); //1 from the popupmenu and 1 from the menubar QCOMPARE( activated_count, 2 ); //1 from the popupmenu and 1 from the menubar
} }
#endif
void tst_QMenuBar::clear() void tst_QMenuBar::clear()
{ {
@ -556,11 +563,10 @@ void tst_QMenuBar::insertItem_QString_QObject()
QVERIFY(actions.size() < 4); // there is no menu 4! QVERIFY(actions.size() < 4); // there is no menu 4!
} }
// On Mac/WinCE, native key events are needed to test menu action activation
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
void tst_QMenuBar::check_accelKeys() void tst_QMenuBar::check_accelKeys()
{ {
#if defined(Q_OS_MAC) || defined(Q_OS_WINCE_WM)
QSKIP("On Mac/WinCE, native key events are needed to test menu action activation");
#endif
initComplexMenubar(); initComplexMenubar();
// start with a bogus key that shouldn't trigger anything // start with a bogus key that shouldn't trigger anything
@ -624,13 +630,12 @@ void tst_QMenuBar::check_accelKeys()
QCOMPARE(item2_C->selCount(), 1u); QCOMPARE(item2_C->selCount(), 1u);
QCOMPARE(item2_D->selCount(), 1u); QCOMPARE(item2_D->selCount(), 1u);
} }
void tst_QMenuBar::check_cursorKeys1()
{
#if defined(Q_OS_MAC) || defined(Q_OS_WINCE_WM)
QSKIP("Qt/Mac,WinCE does not use the native popups/menubar");
#endif #endif
// On Mac/WinCE, native key events are needed to test menu action activation
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
void tst_QMenuBar::check_cursorKeys1()
{
initComplexMenubar(); initComplexMenubar();
// start with a ALT + 1 that activates the first popupmenu // start with a ALT + 1 that activates the first popupmenu
@ -655,13 +660,12 @@ void tst_QMenuBar::check_cursorKeys1()
QCOMPARE(item2_C->selCount(), 0u); QCOMPARE(item2_C->selCount(), 0u);
QCOMPARE(item2_D->selCount(), 0u); QCOMPARE(item2_D->selCount(), 0u);
} }
void tst_QMenuBar::check_cursorKeys2()
{
#if defined(Q_OS_MAC) || defined(Q_OS_WINCE_WM)
QSKIP("Qt/Mac,WinCE does not use the native popups/menubar");
#endif #endif
// Qt/Mac,WinCE does not use the native popups/menubar
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
void tst_QMenuBar::check_cursorKeys2()
{
initComplexMenubar(); initComplexMenubar();
// select popupmenu2 // select popupmenu2
@ -682,16 +686,15 @@ void tst_QMenuBar::check_cursorKeys2()
QCOMPARE(item2_C->selCount(), 0u); QCOMPARE(item2_C->selCount(), 0u);
QCOMPARE(item2_D->selCount(), 1u); QCOMPARE(item2_D->selCount(), 1u);
} }
#endif
/*! /*!
If a popupmenu is active you can use Left to move to the menu to the left of it. If a popupmenu is active you can use Left to move to the menu to the left of it.
*/ */
// Qt/Mac,WinCE does not use the native popups/menubar
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
void tst_QMenuBar::check_cursorKeys3() void tst_QMenuBar::check_cursorKeys3()
{ {
#if defined(Q_OS_MAC) || defined(Q_OS_WINCE_WM)
QSKIP("Qt/Mac,WinCE does not use the native popups/menubar");
#endif
initComplexMenubar(); initComplexMenubar();
// select Popupmenu 2 // select Popupmenu 2
@ -710,6 +713,7 @@ void tst_QMenuBar::check_cursorKeys3()
QCOMPARE(item2_C->selCount(), 0u); QCOMPARE(item2_C->selCount(), 0u);
QCOMPARE(item2_D->selCount(), 0u); QCOMPARE(item2_D->selCount(), 0u);
} }
#endif
/*! /*!
If a popupmenu is active you can use home to go quickly to the first item in the menu. If a popupmenu is active you can use home to go quickly to the first item in the menu.
@ -790,12 +794,10 @@ void tst_QMenuBar::check_endKey()
If Down is pressed next the popup is activated again. If Down is pressed next the popup is activated again.
*/ */
// Qt/Mac,WinCE does not use the native popups/menubar
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
void tst_QMenuBar::check_escKey() void tst_QMenuBar::check_escKey()
{ {
#if defined(Q_OS_MAC) || defined(Q_OS_WINCE_WM)
QSKIP("Qt/Mac,WinCE does not use the native popups/menubar");
#endif
initComplexMenubar(); initComplexMenubar();
QVERIFY( !pm1->isActiveWindow() ); QVERIFY( !pm1->isActiveWindow() );
@ -824,6 +826,7 @@ void tst_QMenuBar::check_escKey()
// Let's see if the correct slot is called... // Let's see if the correct slot is called...
QVERIFY2( item2_C->selCount() == 1, "Expected item 2C to be selected" ); QVERIFY2( item2_C->selCount() == 1, "Expected item 2C to be selected" );
} }
#endif
// void tst_QMenuBar::check_mouse1_data() // void tst_QMenuBar::check_mouse1_data()
@ -932,10 +935,9 @@ void tst_QMenuBar::check_escKey()
// QCOMPARE(item2_H->selCount(), (uint)itemH_count); // QCOMPARE(item2_H->selCount(), (uint)itemH_count);
// } // }
void #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
tst_QMenuBar::allowActiveAndDisabled() void tst_QMenuBar::allowActiveAndDisabled()
{ {
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE_WM)
mb->hide(); mb->hide();
mb->clear(); mb->clear();
@ -973,8 +975,8 @@ tst_QMenuBar::allowActiveAndDisabled()
QCOMPARE(mb->activeAction()->text(), fileMenu.title()); QCOMPARE(mb->activeAction()->text(), fileMenu.title());
mb->hide(); mb->hide();
#endif //Q_OS_MAC
} }
#endif
void tst_QMenuBar::check_altPress() void tst_QMenuBar::check_altPress()
{ {
@ -993,12 +995,10 @@ void tst_QMenuBar::check_altPress()
QVERIFY( ::qobject_cast<QMenuBar *>(qApp->focusWidget()) ); QVERIFY( ::qobject_cast<QMenuBar *>(qApp->focusWidget()) );
} }
// Qt/Mac,WinCE does not use the native popups/menubar
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
void tst_QMenuBar::check_shortcutPress() void tst_QMenuBar::check_shortcutPress()
{ {
#if defined(Q_OS_MAC) || defined(Q_OS_WINCE_WM)
QSKIP("Qt/Mac,WinCE does not use the native popups/menubar");
#endif
initComplexMenubar(); initComplexMenubar();
qApp->setActiveWindow(mw); qApp->setActiveWindow(mw);
@ -1013,15 +1013,12 @@ void tst_QMenuBar::check_shortcutPress()
QTest::keyClick(mb, Qt::Key_2); QTest::keyClick(mb, Qt::Key_2);
QVERIFY(pm1->isActiveWindow()); QVERIFY(pm1->isActiveWindow());
} }
#endif
// Qt/Mac,WinCE does not use the native popups/menubar
#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE)
void tst_QMenuBar::check_menuPosition() void tst_QMenuBar::check_menuPosition()
{ {
#ifdef Q_OS_MAC
QSKIP("Qt/Mac does not use the native popups/menubar");
#endif
#ifdef Q_OS_WINCE_WM
QSKIP("Qt/CE uses native menubar");
#endif
Menu menu; Menu menu;
initComplexMenubar(); initComplexMenubar();
menu.setTitle("&menu"); menu.setTitle("&menu");
@ -1086,8 +1083,8 @@ void tst_QMenuBar::check_menuPosition()
menu.close(); menu.close();
qApp->setLayoutDirection(dir); qApp->setLayoutDirection(dir);
} }
} }
#endif
void tst_QMenuBar::task223138_triggered() void tst_QMenuBar::task223138_triggered()
{ {
@ -1228,11 +1225,10 @@ void tst_QMenuBar::menubarSizeHint()
QCOMPARE(resSize, mb.sizeHint()); QCOMPARE(resSize, mb.sizeHint());
} }
// On Mac, do not test the menubar with escape key
#ifndef Q_OS_MAC
void tst_QMenuBar::taskQTBUG4965_escapeEaten() void tst_QMenuBar::taskQTBUG4965_escapeEaten()
{ {
#ifdef Q_OS_MAC
QSKIP("On Mac, do not test the menubar with escape key");
#endif
QMenuBar menubar; QMenuBar menubar;
QMenu menu("menu1"); QMenu menu("menu1");
QAction *first = menubar.addMenu(&menu); QAction *first = menubar.addMenu(&menu);
@ -1254,6 +1250,7 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten()
QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_Escape); //now the action should be triggered QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_Escape); //now the action should be triggered
QTRY_VERIFY(!menubar.isVisible()); QTRY_VERIFY(!menubar.isVisible());
} }
#endif
void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions() void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions()
{ {