summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-11-15 11:36:18 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-18 01:51:57 +0100
commita8fd0c3654f8352773638633778cd8003680cbc7 (patch)
tree4815cca9daf879b96a92a3de95621b56ac5ba868 /tests/auto/widgets/widgets
parentd90d57bb8b995c7a66e7f9b7b2515447fbe11de0 (diff)
Don't depend on moc to disable test functions.
The moc tool is not aware of all defines (particularly those that are compiler builtins) and does not correctly evaluate others that depend on compiler builtins, such as Q_OS_FOO. This commit reverts parts of the following commits, but is not a complete fix as there were many instances of this problem in the tests prior to those commits: 924d810dbdcd5b5b0fa860922b2487ea9062d002 8aaff6751038b88d17e23be6fcee945771297c5b 338d3f11973412047c2c9cd41cbd0c961d738ef3 a55034062ba2bf73a9f1ed3d9cf31745b38149e3 253497b7446c7d723aa3bdd7152e25d6852f2604 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 9d2ff58f3642828e494e7e9b2df7dbb8e2cd408f 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/widgets/widgets')
-rw-r--r--tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp8
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp7
-rw-r--r--tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp17
-rw-r--r--tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp8
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp16
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp82
6 files changed, 64 insertions, 74 deletions
diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
index 9cab8b328d..1512385033 100644
--- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
+++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
@@ -90,9 +90,7 @@ private slots:
void setText_data();
void setText();
void setTextFormat();
-#ifndef Q_WS_MAC
void setBuddy();
-#endif
void setNum();
void clear();
void wordWrap();
@@ -198,10 +196,11 @@ void tst_QLabel::cleanup()
}
}
-// Set buddy doesn't make much sense on Mac OS X.
-#ifndef Q_WS_MAC
void tst_QLabel::setBuddy()
{
+#ifdef Q_OS_MAC
+ QSKIP("Set buddy doesn't make much sense on Mac OS X");
+#endif
testWidget->hide();
test_box = new Widget;
@@ -222,7 +221,6 @@ void tst_QLabel::setBuddy()
QVERIFY( test_edit->hasFocus() );
delete test_box;
}
-#endif
void tst_QLabel::setText_data()
{
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 41d692dfc3..0a74274772 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -266,9 +266,7 @@ private slots:
void taskQTBUG_7902_contextMenuCrash();
#endif
void taskQTBUG_7395_readOnlyShortcut();
-#ifdef Q_WS_X11
void QTBUG697_paletteCurrentColorGroup();
-#endif
void QTBUG13520_textNotVisible();
void bidiVisualMovement_data();
@@ -3627,9 +3625,11 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
QCOMPARE(spy.count(), 1);
}
-#ifdef Q_WS_X11
void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup()
{
+#ifndef Q_WS_X11
+ QSKIP("Only tested on X11");
+#endif
QLineEdit le;
le.setText(" ");
QPalette p = le.palette();
@@ -3651,7 +3651,6 @@ void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup()
le.render(&img);
QCOMPARE(img.pixel(10, le.height()/2), QColor(Qt::red).rgb());
}
-#endif
void tst_QLineEdit::QTBUG13520_textNotVisible()
{
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
index 85bb481449..952078c0ff 100644
--- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
@@ -75,9 +75,7 @@ private slots:
void constructor();
void iconSize();
void toolButtonStyle();
-#ifndef Q_WS_WINCE_WM
void menuBar();
-#endif
void statusBar();
void centralWidget();
void corner();
@@ -105,9 +103,7 @@ private slots:
void centralWidgetSize();
void dockWidgetSize();
void QTBUG2774_stylechange();
-#ifdef Q_OS_MAC
void toggleUnifiedTitleAndToolBarOnMac();
-#endif
};
// Testing get/set functions
@@ -530,8 +526,6 @@ void tst_QMainWindow::toolButtonStyle()
}
}
-// With native menubar integration on Windows Mobile the menubar is not a child
-#ifndef Q_WS_WINCE_WM
void tst_QMainWindow::menuBar()
{
{
@@ -547,6 +541,9 @@ void tst_QMainWindow::menuBar()
mw.setMenuBar(mb1);
QVERIFY(mw.menuBar() != 0);
QCOMPARE(mw.menuBar(), (QMenuBar *)mb1);
+#ifdef Q_WS_WINCE_WM
+ QSKIP("With native menubar integration the menubar is not a child");
+#endif
QCOMPARE(mb1->parentWidget(), (QWidget *)&mw);
mw.setMenuBar(0);
@@ -615,7 +612,6 @@ void tst_QMainWindow::menuBar()
QVERIFY(!topRightCornerWidget);
}
}
-#endif
void tst_QMainWindow::statusBar()
{
@@ -1712,9 +1708,9 @@ void tst_QMainWindow::QTBUG2774_stylechange()
}
}
-#ifdef Q_OS_MAC
void tst_QMainWindow::toggleUnifiedTitleAndToolBarOnMac()
{
+#ifdef Q_OS_MAC
QMainWindow mw;
QToolBar *tb = new QToolBar;
tb->addAction("Test");
@@ -1726,8 +1722,11 @@ void tst_QMainWindow::toggleUnifiedTitleAndToolBarOnMac()
QVERIFY(frameGeometry.topLeft() == mw.frameGeometry().topLeft());
mw.setUnifiedTitleAndToolBarOnMac(true);
QVERIFY(frameGeometry.topLeft() == mw.frameGeometry().topLeft());
-}
+#else
+ QSKIP("Mac specific test");
#endif
+}
+
QTEST_MAIN(tst_QMainWindow)
#include "tst_qmainwindow.moc"
diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
index db51eb8df6..a9311911e6 100644
--- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
+++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
@@ -180,10 +180,8 @@ private slots:
void showShaded();
void showNormal_data();
void showNormal();
-#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE_WM)
void setOpaqueResizeAndMove_data();
void setOpaqueResizeAndMove();
-#endif
void setWindowFlags_data();
void setWindowFlags();
void mouseDoubleClick();
@@ -693,8 +691,6 @@ private:
int _count;
};
-// This test requires cursor support, which is absent on WinCE
-#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE_WM)
void tst_QMdiSubWindow::setOpaqueResizeAndMove_data()
{
QTest::addColumn<bool>("opaqueMode");
@@ -709,6 +705,9 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove_data()
void tst_QMdiSubWindow::setOpaqueResizeAndMove()
{
+#if defined (QT_NO_CURSOR) || defined (Q_OS_WINCE_WM) //For Windows CE we will set QT_NO_CURSOR if there is no cursor support
+ QSKIP("No cursor available");
+#endif
QFETCH(bool, opaqueMode);
QFETCH(int, geometryCount);
QFETCH(int, expectedGeometryCount);
@@ -814,7 +813,6 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove()
QCOMPARE(window->size(), windowSize + QSize(geometryCount, geometryCount));
}
}
-#endif
void tst_QMdiSubWindow::setWindowFlags_data()
{
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index e4f12c9f65..9b4f055684 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -83,9 +83,7 @@ private slots:
void overrideMenuAction();
void statusTip();
void widgetActionFocus();
-#ifndef Q_OS_WINCE_WM
void mouseActivation();
-#endif
void tearOff();
void layoutDirection();
@@ -96,9 +94,7 @@ private slots:
void task250673_activeMultiColumnSubMenuPosition();
void task256918_setFont();
void menuSizeHint();
-#ifndef Q_OS_WINCE_WM
void task258920_mouseBorder();
-#endif
void setFixedWidth();
void deleteActionInTriggered();
void pushButtonPopulateOnAboutToShow();
@@ -271,10 +267,11 @@ void tst_QMenu::addActionsAndClear()
QCOMPARE(menus[0]->actions().count(), 0);
}
-// We have a separate mouseActivation test for Windows mobile.
-#ifndef Q_OS_WINCE_WM
void tst_QMenu::mouseActivation()
{
+#ifdef Q_OS_WINCE_WM
+ QSKIP("We have a separate mouseActivation test for Windows mobile.");
+#endif
QWidget topLevel;
QMenu menu(&topLevel);
topLevel.show();
@@ -307,7 +304,6 @@ void tst_QMenu::mouseActivation()
QVERIFY(submenu.isVisible());
#endif
}
-#endif
void tst_QMenu::keyboardNavigation_data()
{
@@ -778,10 +774,11 @@ public:
bool painted;
};
-// Mouse move related signals for Windows Mobile unavailable.
-#ifndef Q_OS_WINCE_WM
void tst_QMenu::task258920_mouseBorder()
{
+#ifdef Q_OS_WINCE_WM
+ QSKIP("Mouse move related signals for Windows Mobile unavailable");
+#endif
// ### fixme: Check platforms
QSKIP("QTBUG-20753 QCursor::setPos() / QTest::mouseMove() doesn't work on qpa");
@@ -805,7 +802,6 @@ void tst_QMenu::task258920_mouseBorder()
QCOMPARE(static_cast<QAction*>(0), menu.activeAction());
QVERIFY(menu.painted);
}
-#endif
void tst_QMenu::setFixedWidth()
{
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index f620b9b9be..17da9c746f 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -117,24 +117,18 @@ private slots:
void removeItem();
void count();
void insertItem_QString_QObject();
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM)
void accel();
void activatedCount();
-#endif
void allowActiveAndDisabled();
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM)
void check_accelKeys();
void check_cursorKeys1();
void check_cursorKeys2();
void check_cursorKeys3();
-#endif
void check_homeKey();
void check_endKey();
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM)
void check_escKey();
-#endif
// void check_mouse1_data();
// void check_mouse1();
@@ -142,16 +136,12 @@ private slots:
// void check_mouse2();
void check_altPress();
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM)
void check_shortcutPress();
void check_menuPosition();
-#endif
void task223138_triggered();
void task256322_highlight();
void menubarSizeHint();
-#ifndef Q_WS_MAC
void taskQTBUG4965_escapeEaten();
-#endif
void taskQTBUG11823_crashwithInvisibleActions();
protected slots:
@@ -341,10 +331,12 @@ void tst_QMenuBar::onActivated( QAction* action )
// 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_WS_MAC) && !defined(Q_OS_WINCE_WM)
void tst_QMenuBar::accel()
{
+#if defined(Q_WS_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...
initSimpleMenubar();
@@ -356,12 +348,12 @@ void tst_QMenuBar::accel()
QCOMPARE( last_accel_id, action );
}
-#endif
-// On Mac/WinCE, native key events are needed to test menu action activation.
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM)
void tst_QMenuBar::activatedCount()
{
+#if defined(Q_WS_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...
initSimpleMenubar();
@@ -369,7 +361,6 @@ void tst_QMenuBar::activatedCount()
//wait(5000);
QCOMPARE( activated_count, 2 ); //1 from the popupmenu and 1 from the menubar
}
-#endif
void tst_QMenuBar::clear()
{
@@ -572,10 +563,11 @@ void tst_QMenuBar::insertItem_QString_QObject()
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_WS_MAC) && !defined(Q_OS_WINCE_WM)
void tst_QMenuBar::check_accelKeys()
{
+#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM)
+ QSKIP("On Mac/WinCE, native key events are needed to test menu action activation");
+#endif
initComplexMenubar();
// start with a bogus key that shouldn't trigger anything
@@ -639,12 +631,13 @@ void tst_QMenuBar::check_accelKeys()
QCOMPARE(item2_C->selCount(), 1u);
QCOMPARE(item2_D->selCount(), 1u);
}
-#endif
-// Qt/Mac,WinCE does not use the native popups/menubar.
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM)
void tst_QMenuBar::check_cursorKeys1()
{
+#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM)
+ QSKIP("Qt/Mac,WinCE does not use the native popups/menubar");
+#endif
+
initComplexMenubar();
// start with a ALT + 1 that activates the first popupmenu
@@ -669,12 +662,13 @@ void tst_QMenuBar::check_cursorKeys1()
QCOMPARE(item2_C->selCount(), 0u);
QCOMPARE(item2_D->selCount(), 0u);
}
-#endif
-// Qt/Mac,WinCE does not use the native popups/menubar.
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM)
void tst_QMenuBar::check_cursorKeys2()
{
+#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM)
+ QSKIP("Qt/Mac,WinCE does not use the native popups/menubar");
+#endif
+
initComplexMenubar();
// select popupmenu2
@@ -695,15 +689,16 @@ void tst_QMenuBar::check_cursorKeys2()
QCOMPARE(item2_C->selCount(), 0u);
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.
- Qt/Mac,WinCE does not use the native popups/menubar.
*/
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM)
void tst_QMenuBar::check_cursorKeys3()
{
+#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM)
+ QSKIP("Qt/Mac,WinCE does not use the native popups/menubar");
+#endif
+
initComplexMenubar();
// select Popupmenu 2
@@ -722,7 +717,6 @@ void tst_QMenuBar::check_cursorKeys3()
QCOMPARE(item2_C->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.
@@ -803,10 +797,12 @@ void tst_QMenuBar::check_endKey()
If Down is pressed next the popup is activated again.
*/
-// Qt/Mac,WinCE does not use the native popups/menubar.
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM)
void tst_QMenuBar::check_escKey()
{
+#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM)
+ QSKIP("Qt/Mac,WinCE does not use the native popups/menubar");
+#endif
+
initComplexMenubar();
QVERIFY( !pm1->isActiveWindow() );
@@ -835,7 +831,7 @@ void tst_QMenuBar::check_escKey()
// Let's see if the correct slot is called...
QVERIFY2( item2_C->selCount() == 1, "Expected item 2C to be selected" );
}
-#endif
+
// void tst_QMenuBar::check_mouse1_data()
// {
@@ -1004,10 +1000,12 @@ void tst_QMenuBar::check_altPress()
QVERIFY( ::qobject_cast<QMenuBar *>(qApp->focusWidget()) );
}
-// Qt/Mac,WinCE does not use the native popups/menubar.
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM)
void tst_QMenuBar::check_shortcutPress()
{
+#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM)
+ QSKIP("Qt/Mac,WinCE does not use the native popups/menubar");
+#endif
+
initComplexMenubar();
qApp->setActiveWindow(mw);
@@ -1022,13 +1020,15 @@ void tst_QMenuBar::check_shortcutPress()
QTest::keyClick(mb, Qt::Key_2);
QVERIFY(pm1->isActiveWindow());
}
-#endif
-// Qt/Mac does not use the native popups/menubar.
-// Qt/CE uses native menubar.
-#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE_WM)
void tst_QMenuBar::check_menuPosition()
{
+#ifdef Q_WS_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;
initComplexMenubar();
menu.setTitle("&menu");
@@ -1093,8 +1093,8 @@ void tst_QMenuBar::check_menuPosition()
menu.close();
qApp->setLayoutDirection(dir);
}
+
}
-#endif
void tst_QMenuBar::task223138_triggered()
{
@@ -1235,10 +1235,11 @@ void tst_QMenuBar::menubarSizeHint()
QCOMPARE(resSize, mb.sizeHint());
}
-// On Mac, do not test the menubar with escape key.
-#ifndef Q_WS_MAC
void tst_QMenuBar::taskQTBUG4965_escapeEaten()
{
+#ifdef Q_WS_MAC
+ QSKIP("On Mac, do not test the menubar with escape key");
+#endif
QMenuBar menubar;
QMenu menu("menu1");
QAction *first = menubar.addMenu(&menu);
@@ -1260,7 +1261,6 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten()
QTest::keyClick(static_cast<QWidget *>(0), Qt::Key_Escape); //now the action should be triggered
QTRY_VERIFY(!menubar.isVisible());
}
-#endif
void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions()
{