summaryrefslogtreecommitdiffstats
path: root/tests/auto/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
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')
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp34
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp9
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp8
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp9
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp16
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp19
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp7
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp35
-rw-r--r--tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp22
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp9
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp8
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp9
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp24
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp10
-rw-r--r--tests/auto/widgets/util/qscroller/tst_qscroller.cpp22
-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
21 files changed, 187 insertions, 192 deletions
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index 80eb717790..4ac9a6bf5a 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -75,17 +75,11 @@ private slots:
void showMaximized();
void showMinimized();
void showFullScreen();
-#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE)
void showAsTool();
-#endif
-#ifndef Q_OS_WINCE
void toolDialogPosition();
-#endif
void deleteMainDefault();
void deleteInExec();
-#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_MAC) && !(defined(Q_OS_WINCE) && defined(_ARM_))
void throwInExec();
-#endif
void showSizeGrip();
void setVisible();
void reject();
@@ -372,11 +366,13 @@ void tst_QDialog::showFullScreen()
QVERIFY(!dialog.isVisible());
}
-// Qt/X11: Skipped since activeWindow() is not respected by all window managers.
-// Qt/WinCE: No real support for Qt::Tool on WinCE.
-#if !defined(Q_OS_UNIX) && !defined(Q_OS_WINCE)
void tst_QDialog::showAsTool()
{
+#if defined(Q_OS_UNIX)
+ QSKIP("Qt/X11: Skipped since activeWindow() is not respected by all window managers");
+#elif defined(Q_OS_WINCE)
+ QSKIP("No real support for Qt::Tool on WinCE");
+#endif
ToolDialog dialog(testWidget);
testWidget->activateWindow();
dialog.exec();
@@ -387,14 +383,14 @@ void tst_QDialog::showAsTool()
QCOMPARE(dialog.wasActive(), false);
}
}
-#endif
// Verify that pos() returns the same before and after show()
// for a dialog with the Tool window type.
-// No real support for Qt::Tool on WinCE, so skip this test.
-#ifndef Q_OS_WINCE
void tst_QDialog::toolDialogPosition()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("No real support for Qt::Tool on WinCE");
+#endif
QDialog dialog(0, Qt::Tool);
dialog.move(QPoint(100,100));
const QPoint beforeShowPosition = dialog.pos();
@@ -402,7 +398,6 @@ void tst_QDialog::toolDialogPosition()
const QPoint afterShowPosition = dialog.pos();
QCOMPARE(afterShowPosition, beforeShowPosition);
}
-#endif
class Dialog : public QDialog
{
@@ -430,8 +425,7 @@ void tst_QDialog::deleteInExec()
QCOMPARE(dialog->exec(), int(QDialog::Rejected));
}
-// Throwing exceptions in exec() is not supported on Mac or on WinCE/ARM.
-#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_MAC) && !(defined(Q_OS_WINCE) && defined(_ARM_))
+#ifndef QT_NO_EXCEPTIONS
class QDialogTestException : public std::exception { };
class ExceptionDialog : public QDialog
@@ -449,6 +443,9 @@ public slots:
void tst_QDialog::throwInExec()
{
+#if defined(Q_WS_MAC) || (defined(Q_WS_WINCE) && defined(_ARM_))
+ QSKIP("Throwing exceptions in exec() is not supported on this platform.");
+#endif
#if defined(Q_OS_LINUX)
// C++ exceptions can't be passed through glib callbacks. Skip the test if
// we're using the glib event loop.
@@ -474,7 +471,12 @@ void tst_QDialog::throwInExec()
}
QCOMPARE(caughtExceptions, 1);
}
-#endif
+#else
+void tst_QDialog::throwInExec()
+{
+ QSKIP("Exceptions are disabled");
+}
+#endif //QT_NO_EXCEPTIONS
// From Task 124269
void tst_QDialog::showSizeGrip()
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index c23992c62d..483841e8f5 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
@@ -145,7 +145,7 @@ private slots:
void clearLineEdit();
void enableChooseButton();
void hooks();
-#if defined(Q_OS_UNIX) && defined(QT_BUILD_INTERNAL)
+#ifdef Q_OS_UNIX
void tildeExpansion_data();
void tildeExpansion();
#endif
@@ -1318,8 +1318,7 @@ void tst_QFiledialog::hooks()
QCOMPARE(QFileDialog::getSaveFileName(), QString("saveName"));
}
-// Test case relies on developer build (AUTOTEST_EXPORT).
-#if defined(Q_OS_UNIX) && defined(QT_BUILD_INTERNAL)
+#ifdef Q_OS_UNIX
void tst_QFiledialog::tildeExpansion_data()
{
QTest::addColumn<QString>("tildePath");
@@ -1338,10 +1337,14 @@ void tst_QFiledialog::tildeExpansion_data()
void tst_QFiledialog::tildeExpansion()
{
+#ifndef QT_BUILD_INTERNAL
+ QSKIP("Test case relies on developer build (AUTOTEST_EXPORT)");
+#else
QFETCH(QString, tildePath);
QFETCH(QString, expandedPath);
QCOMPARE(qt_tildeExpansion(tildePath), expandedPath);
+#endif
}
#endif
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index 25ffdf63c6..3bf618b679 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -122,9 +122,7 @@ private slots:
void detailsText();
void detailsButtonText();
-#ifndef Q_WS_MAC
void shortcut();
-#endif
void staticSourceCompat();
void instanceSourceCompat();
@@ -366,17 +364,17 @@ void tst_QMessageBox::statics()
}
}
-// Shortcuts are not used on Mac OS X.
-#ifndef Q_WS_MAC
void tst_QMessageBox::shortcut()
{
+#ifdef Q_WS_MAC
+ QSKIP("shortcuts are not used on MAC OS X");
+#endif
QMessageBox msgBox;
msgBox.addButton("O&k", QMessageBox::YesRole);
msgBox.addButton("&No", QMessageBox::YesRole);
msgBox.addButton("&Maybe", QMessageBox::YesRole);
QCOMPARE(exec(&msgBox, Qt::Key_M), 2);
}
-#endif
void tst_QMessageBox::about()
{
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 2a31e8ebf4..d865461e49 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -97,10 +97,8 @@ private slots:
void setOption_HaveHelpButton();
void setOption_HelpButtonOnRight();
void setOption_HaveCustomButtonX();
-#ifndef Q_OS_WINCE
void combinations_data();
void combinations();
-#endif
void showCurrentPageOnly();
void setButtonText();
void setCommitPage();
@@ -2020,8 +2018,6 @@ public:
}
};
-// Too much memory usage for testing on CE emulator.
-#ifndef Q_OS_WINCE
void tst_QWizard::combinations_data()
{
CombinationsTestData combTestData;
@@ -2033,6 +2029,10 @@ void tst_QWizard::combinations_data()
void tst_QWizard::combinations()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Too much memory usage for testing on CE emulator");
+#endif
+
QFETCH(bool, ref);
QFETCH(bool, testEquality);
QFETCH(QList<Operation *>, operations);
@@ -2083,7 +2083,6 @@ void tst_QWizard::combinations()
QVERIFY(false);
}
}
-#endif
class WizardPage : public QWizardPage
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 26b8616231..2247173c7f 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -61,16 +61,12 @@ private slots:
void qgraphicsgridlayout();
void addItem_data();
void addItem();
-#ifndef Q_WS_MAC
void alignment_data();
void alignment();
-#endif
void alignment2();
void alignment2_data();
-#ifndef Q_WS_MAC
void columnAlignment_data();
void columnAlignment();
-#endif
void columnCount_data();
void columnCount();
void columnMaximumWidth_data();
@@ -494,8 +490,6 @@ void tst_QGraphicsGridLayout::addItem()
delete layout;
}
-// Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac.
-#ifndef Q_WS_MAC
void tst_QGraphicsGridLayout::alignment_data()
{
QTest::addColumn<bool>("hasHeightForWidth");
@@ -507,6 +501,9 @@ void tst_QGraphicsGridLayout::alignment_data()
// public Qt::Alignment alignment(QGraphicsLayoutItem* item) const
void tst_QGraphicsGridLayout::alignment()
{
+#ifdef Q_WS_MAC
+ QSKIP("Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac");
+#endif
QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
@@ -565,10 +562,7 @@ void tst_QGraphicsGridLayout::alignment()
delete widget;
}
-#endif
-// Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac.
-#ifndef Q_WS_MAC
void tst_QGraphicsGridLayout::columnAlignment_data()
{
QTest::addColumn<bool>("hasHeightForWidth");
@@ -581,6 +575,9 @@ void tst_QGraphicsGridLayout::columnAlignment_data()
// public Qt::Alignment columnAlignment(int column) const
void tst_QGraphicsGridLayout::columnAlignment()
{
+#ifdef Q_WS_MAC
+ QSKIP("Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac");
+#endif
QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
@@ -633,7 +630,6 @@ void tst_QGraphicsGridLayout::columnAlignment()
delete widget;
}
-#endif
void tst_QGraphicsGridLayout::columnCount_data()
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 0e86c0ab48..f943daf411 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -118,10 +118,8 @@ private slots:
void focusNextPrevChild();
void focusOutEvent_data();
void focusOutEvent();
-#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR))
void hoverEnterLeaveEvent_data();
void hoverEnterLeaveEvent();
-#endif
void hoverMoveEvent_data();
void hoverMoveEvent();
void keyPressEvent_data();
@@ -159,9 +157,7 @@ private slots:
void setFocus_complexTwoWidgets();
void popup_basic();
void popup_subwidget();
-#if !defined(QT_NO_CURSOR) && (!defined(Q_OS_WINCE) || defined(GWES_ICONCURS))
void changingCursor_basic();
-#endif
void tooltip_basic();
void childPos_data();
void childPos();
@@ -944,8 +940,6 @@ protected:
}
};
-// protected void hoverEnterEvent(QGraphicsSceneHoverEvent* event)
-#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR))
void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent_data()
{
QTest::addColumn<bool>("hasWidget");
@@ -956,11 +950,16 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent_data()
QTest::newRow("no widget, hover") << false << true;
}
+// protected void hoverEnterEvent(QGraphicsSceneHoverEvent* event)
void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent()
{
QFETCH(bool, hasWidget);
QFETCH(bool, hoverEnabled);
+#if defined(Q_OS_WINCE) && (!defined(GWES_ICONCURS) || defined(QT_NO_CURSOR))
+ QSKIP("hover events not supported on this platform");
+#endif
+
// proxy should translate this into events that the widget would expect
QGraphicsScene scene;
@@ -1007,7 +1006,6 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent()
if (!hasWidget)
delete widget;
}
-#endif
void tst_QGraphicsProxyWidget::hoverMoveEvent_data()
{
@@ -2548,9 +2546,12 @@ void tst_QGraphicsProxyWidget::popup_subwidget()
QCOMPARE(popup->size(), child->size().toSize());
}
-#if !defined(QT_NO_CURSOR) && (!defined(Q_OS_WINCE) || defined(GWES_ICONCURS))
void tst_QGraphicsProxyWidget::changingCursor_basic()
{
+#if defined(Q_OS_WINCE) && (!defined(GWES_ICONCURS) || defined(QT_NO_CURSOR))
+ QSKIP("hover events not supported on this platform");
+#endif
+#ifndef QT_NO_CURSOR
// Confirm that mouse events are working properly by checking that
// when moving the mouse over a line edit it will change the cursor into the I
QGraphicsScene scene;
@@ -2576,8 +2577,8 @@ void tst_QGraphicsProxyWidget::changingCursor_basic()
QTest::mouseMove(view.viewport(), QPoint(1, 1));
sendMouseMove(view.viewport(), QPoint(1, 1));
QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::ArrowCursor);
-}
#endif
+}
void tst_QGraphicsProxyWidget::tooltip_basic()
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index d69927b12c..496628597d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -216,9 +216,7 @@ private slots:
void addPixmap();
void addRect();
void addText();
-#if !defined(Q_OS_WINCE) || defined(GWES_ICONCURS)
void removeItem();
-#endif
void clear();
void focusItem();
void focusItemLostFocus();
@@ -1245,9 +1243,11 @@ void tst_QGraphicsScene::addText()
QCOMPARE(text->font(), QFont());
}
-#if !defined(Q_OS_WINCE) || defined(GWES_ICONCURS)
void tst_QGraphicsScene::removeItem()
{
+#if defined(Q_OS_WINCE) && !defined(GWES_ICONCURS)
+ QSKIP("No mouse cursor support");
+#endif
QGraphicsScene scene;
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10));
QCOMPARE(scene.itemAt(0, 0), item); // forces indexing
@@ -1309,7 +1309,6 @@ void tst_QGraphicsScene::removeItem()
qApp->processEvents(); // <- pending update is sent to view
QVERIFY(!hoverItem->isHovered);
}
-#endif
void tst_QGraphicsScene::focusItem()
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index ded0cc7965..ad204f231d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -187,10 +187,8 @@ private slots:
void mapFromScenePath();
void sendEvent();
void wheelEvent();
-#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE)
void cursor();
void cursor2();
-#endif
void transformationAnchor();
void resizeAnchor();
void viewportUpdateMode();
@@ -244,16 +242,12 @@ private slots:
void task239047_fitInViewSmallViewport();
void task245469_itemsAtPointWithClip();
void task253415_reconnectUpdateSceneOnSceneChanged();
-#ifndef Q_OS_WINCE
void task255529_transformationAnchorMouseAndViewportMargins();
-#endif
void task259503_scrollingArtifacts();
void QTBUG_4151_clipAndIgnore_data();
void QTBUG_4151_clipAndIgnore();
void QTBUG_5859_exposedRect();
-#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE)
void QTBUG_7438_cursor();
-#endif
void hoverLeave();
void QTBUG_16063_microFocusRect();
@@ -2057,10 +2051,12 @@ void tst_QGraphicsView::wheelEvent()
QVERIFY(widget->hasFocus());
}
-// Qt/CE does not have regular cursor support.
-#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE)
void tst_QGraphicsView::cursor()
{
+#ifndef QT_NO_CURSOR
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE does not have regular cursor support");
+#endif
if (PlatformQuirks::haveMouseCursor())
QSKIP("The Platform does not have regular cursor support");
@@ -2082,13 +2078,17 @@ void tst_QGraphicsView::cursor()
sendMouseMove(view.viewport(), QPoint(5, 5));
QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor);
-}
#endif
+}
// Qt/CE does not have regular cursor support.
#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE)
void tst_QGraphicsView::cursor2()
{
+#ifndef QT_NO_CURSOR
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE does not have regular cursor support");
+#endif
if (PlatformQuirks::haveMouseCursor())
QSKIP("The Platform does not have regular cursor support");
@@ -2154,8 +2154,8 @@ void tst_QGraphicsView::cursor2()
QCOMPARE(view.viewport()->cursor().shape(), Qt::IBeamCursor);
sendMouseMove(view.viewport(), view.mapFromScene(-15, -15));
QCOMPARE(view.viewport()->cursor().shape(), Qt::SizeAllCursor);
-}
#endif
+}
void tst_QGraphicsView::transformationAnchor()
{
@@ -4252,10 +4252,11 @@ void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged()
QVERIFY(wasConnected2);
}
-// Qt/CE does not implement mouse tracking at this point.
-#ifndef Q_OS_WINCE
void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE does not implement mouse tracking at this point");
+#endif
QGraphicsScene scene(-100, -100, 200, 200);
scene.addRect(QRectF(-50, -50, 100, 100), QPen(Qt::black), QBrush(Qt::blue));
@@ -4289,8 +4290,8 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins()
QEXPECT_FAIL("", "QTBUG-22455", Abort);
QVERIFY(qAbs(newMouseScenePos.x() - mouseScenePos.x()) < slack);
QVERIFY(qAbs(newMouseScenePos.y() - mouseScenePos.y()) < slack);
-}
#endif
+}
void tst_QGraphicsView::task259503_scrollingArtifacts()
{
@@ -4439,10 +4440,12 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect()
QCOMPARE(item.lastExposedRect, scene.lastBackgroundExposedRect);
}
-// Qt/CE does not have regular cursor support.
-#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE)
void tst_QGraphicsView::QTBUG_7438_cursor()
{
+#ifndef QT_NO_CURSOR
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE does not have regular cursor support");
+#endif
QGraphicsScene scene;
QGraphicsItem *item = scene.addRect(QRectF(-10, -10, 20, 20));
item->setFlag(QGraphicsItem::ItemIsMovable);
@@ -4461,8 +4464,8 @@ void tst_QGraphicsView::QTBUG_7438_cursor()
QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor);
sendMouseRelease(view.viewport(), view.mapFromScene(0, 0));
QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor);
-}
#endif
+}
class GraphicsItemWithHover : public QGraphicsRectItem
{
diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
index 00fc1bd1df..65900a4bed 100644
--- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
+++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp
@@ -54,14 +54,10 @@ class tst_QDirModel : public QObject
Q_OBJECT
public slots:
void cleanupTestCase();
-#ifdef Q_OS_UNIX
void init();
-#endif
private slots:
void getSetCheck();
-#ifdef Q_OS_UNIX
void unreadable();
-#endif
/*
void construct();
void rowCount();
@@ -87,9 +83,7 @@ private slots:
void filePath();
-#ifdef Q_OS_UNIX
void hidden();
-#endif
void fileName();
void fileName_data();
@@ -140,9 +134,9 @@ void tst_QDirModel::cleanupTestCase()
current.rmdir(".qtest_hidden");
}
-#ifdef Q_OS_UNIX
void tst_QDirModel::init()
{
+#ifdef Q_OS_UNIX
if (QTest::currentTestFunction() == QLatin1String( "unreadable" )) {
// Make sure that the unreadable file created by the unreadable()
// test function doesn't already exist.
@@ -152,8 +146,8 @@ void tst_QDirModel::init()
QVERIFY(!unreadableFile.exists());
}
}
-}
#endif
+}
/*
tests
@@ -502,9 +496,11 @@ void tst_QDirModel::rowsAboutToBeRemoved()
QVERIFY(rowsAboutToBeRemoved_cleanup(test_path));
}
-#ifdef Q_OS_UNIX
void tst_QDirModel::hidden()
{
+#ifndef Q_OS_UNIX
+ QSKIP("Test not implemented on non-Unixes");
+#else
QDir current;
current.mkdir(".qtest_hidden");
@@ -520,8 +516,8 @@ void tst_QDirModel::hidden()
model2.setFilter(model2.filter() | QDir::Hidden);
index = model2.index(QDir::currentPath() + "/.qtest_hidden");
QVERIFY(index.isValid());
-}
#endif
+}
void tst_QDirModel::fileName_data()
{
@@ -543,9 +539,11 @@ void tst_QDirModel::fileName()
QCOMPARE(model.fileName(model.index(path)), result);
}
-#ifdef Q_OS_UNIX
void tst_QDirModel::unreadable()
{
+#ifndef Q_OS_UNIX
+ QSKIP("Test not implemented on non-Unixes");
+#else
// Create an empty file which has no read permissions (file will be removed by cleanup()).
QFile unreadableFile(QDir::currentPath() + "qtest_unreadable");
QVERIFY2(unreadableFile.open(QIODevice::WriteOnly | QIODevice::Text), qPrintable(unreadableFile.errorString()));
@@ -563,8 +561,8 @@ void tst_QDirModel::unreadable()
model2.setFilter(model2.filter() | QDir::Hidden);
index = model2.index(QDir::currentPath() + "/qtest_unreadable");
QVERIFY(!index.isValid());
-}
#endif
+}
void tst_QDirModel::filePath()
{
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index b58a306f94..cb582be3c2 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -112,9 +112,7 @@ private slots:
void scrollBarAsNeeded();
void moveItems();
void wordWrap();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500
void setCurrentIndexAfterAppendRowCrash();
-#endif
void emptyItemSize();
void task203585_selectAll();
void task228566_infiniteRelayout();
@@ -1496,14 +1494,15 @@ private:
};
#endif
-// This test only makes sense on Windows 2000 and higher.
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500
void tst_QListView::setCurrentIndexAfterAppendRowCrash()
{
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500
SetCurrentIndexAfterAppendRowCrashDialog w;
w.exec();
-}
+#else
+ QSKIP("This test only makes sense on windows 2000 and higher.");
#endif
+}
void tst_QListView::emptyItemSize()
{
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index de76768d24..47e6d861b7 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -204,10 +204,8 @@ private slots:
void taskQTBUG_8777_scrollToSpans();
void taskQTBUG_10169_sizeHintForRow();
-#ifndef Q_OS_WINCE
void mouseWheel_data();
void mouseWheel();
-#endif
void addColumnWhileEditing();
void task234926_setHeaderSorting();
@@ -3638,8 +3636,6 @@ void tst_QTableView::task248688_autoScrollNavigation()
}
-// Since different Windows CE versions sport different taskbars, we skip this test.
-#ifndef Q_OS_WINCE
void tst_QTableView::mouseWheel_data()
{
QTest::addColumn<int>("scrollMode");
@@ -3660,6 +3656,9 @@ void tst_QTableView::mouseWheel_data()
void tst_QTableView::mouseWheel()
{
+#ifdef Q_OS_WINCE
+ QSKIP("Since different Windows CE versions sport different taskbars, we skip this test");
+#endif
QFETCH(int, scrollMode);
QFETCH(int, delta);
@@ -3693,7 +3692,6 @@ void tst_QTableView::mouseWheel()
QApplication::sendEvent(view.viewport(), &verticalEvent);
QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 10);
}
-#endif
void tst_QTableView::addColumnWhileEditing()
{
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index eb8b555bd6..f25a383177 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -77,9 +77,7 @@ private slots:
void tst_windowFilePath_data();
void tst_windowFilePath();
-#ifdef Q_WS_X11
void tst_showWithoutActivating();
-#endif
void tst_paintEventOnSecondShow();
};
@@ -284,9 +282,11 @@ void tst_QWidget_window::tst_windowFilePath()
}
}
-#ifdef Q_WS_X11
void tst_QWidget_window::tst_showWithoutActivating()
{
+#ifndef Q_WS_X11
+ QSKIP("This test is X11-only.");
+#else
QWidget w;
w.show();
QTest::qWaitForWindowShown(&w);
@@ -306,8 +306,9 @@ void tst_QWidget_window::tst_showWithoutActivating()
(XGetInputFocus(QX11Info::display(), &window, &revertto), window) );
// Note the use of the , before window because we want the XGetInputFocus to be re-executed
// in each iteration of the inside loop of the QTRY_COMPARE macro
+
+#endif // Q_WS_X11
}
-#endif
void tst_QWidget_window::tst_paintEventOnSecondShow()
{
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index e0a9570ee2..77c1d71129 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -133,7 +133,7 @@ private slots:
#ifndef QT_NO_STYLE_CDE
void testCDEStyle();
#endif
-#if defined(Q_WS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
+#ifndef QT_NO_STYLE_WINDOWSXP
void testWindowsXPStyle();
#endif
void testWindowsVistaStyle();
@@ -141,12 +141,8 @@ private slots:
void testCleanlooksStyle();
#endif
void testMacStyle();
-#ifdef Q_OS_WINCE
void testWindowsCEStyle();
-#endif
-#ifdef Q_OS_WINCE_WM
void testWindowsMobileStyle();
-#endif
void testStyleFactory();
void testProxyStyle();
void pixelMetric();
@@ -420,12 +416,16 @@ void tst_QStyle::testWindowsStyle()
wstyle.drawControl(QStyle::CE_ProgressBar, &pb, &painter, 0);
}
-#if defined(Q_WS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
+#ifndef QT_NO_STYLE_WINDOWSXP
void tst_QStyle::testWindowsXPStyle()
{
+#ifdef Q_WS_WIN
QWindowsXPStyle xpstyle;
QVERIFY(testAllFunctions(&xpstyle));
lineUpLayoutTest(&xpstyle);
+#else
+ QSKIP("No WindowsXP style");
+#endif
}
#endif
@@ -586,21 +586,25 @@ void tst_QStyle::testCDEStyle()
}
#endif
-#ifdef Q_OS_WINCE
void tst_QStyle::testWindowsCEStyle()
{
+#if defined(Q_OS_WINCE)
QWindowsCEStyle cstyle;
QVERIFY(testAllFunctions(&cstyle));
-}
+#else
+ QSKIP("No WindowsCEStyle style");
#endif
+}
-#ifdef Q_OS_WINCE_WM
void tst_QStyle::testWindowsMobileStyle()
{
+#if defined(Q_OS_WINCE_WM)
QWindowsMobileStyle cstyle;
QVERIFY(testAllFunctions(&cstyle));
-}
+#else
+ QSKIP("No WindowsMobileStyle style");
#endif
+}
// Helper class...
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 2e5ddb4695..9ecf4d8676 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -79,9 +79,7 @@ private slots:
void fontPropagation();
void onWidgetDestroyed();
void fontPrecedence();
-#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) || (defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL))
void focusColors();
-#endif
void hoverColors();
void background();
void tabAlignement();
@@ -726,9 +724,6 @@ static bool testForColors(const QImage& image, const QColor& color, bool ensureP
return false;
}
-// This is a fragile test which fails on many esoteric platforms
-// because of focus problems. Test only on Windows, Mac, and Linux/gcc.
-#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) || (defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL))
void tst_QStyleSheetStyle::focusColors()
{
// Tests if colors can be changed by altering the focus of the widget.
@@ -736,6 +731,10 @@ void tst_QStyleSheetStyle::focusColors()
// is reached if at least ten pixels of the right color can be found in
// the image.
// For this reason, we use unusual and extremely ugly colors! :-)
+#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) && !(defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL))
+ QSKIP("This is a fragile test which fails on many esoteric platforms because of focus problems. "
+ "That doesn't mean that the feature doesn't work in practice.");
+#endif
QList<QWidget *> widgets;
widgets << new QPushButton("TESTING");
widgets << new QLineEdit("TESTING");
@@ -792,7 +791,6 @@ void tst_QStyleSheetStyle::focusColors()
.toLocal8Bit().constData());
}
}
-#endif
void tst_QStyleSheetStyle::hoverColors()
{
diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
index 9ed4965d45..c8c8136f44 100644
--- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
+++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
@@ -134,10 +134,8 @@ private slots:
void staticScrollers();
void scrollerProperties();
void scrollTo();
-#if !defined(QT_NO_GESTURES) && !(defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6))
void scroll();
void overshoot();
-#endif
};
/*! \internal
@@ -383,10 +381,14 @@ void tst_QScroller::scrollTo()
}
}
-// Mac OS X < 10.6 does not support QTouchEvents.
-#if !defined(QT_NO_GESTURES) && !(defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6))
void tst_QScroller::scroll()
{
+#if defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)
+ QSKIP("Mac OS X < 10.6 does not support QTouchEvents");
+ return;
+#endif
+
+#ifndef QT_NO_GESTURES
// -- good case. normal scroll
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
sw->scrollArea = QRectF(0, 0, 1000, 1000);
@@ -423,13 +425,17 @@ void tst_QScroller::scroll()
QCOMPARE(sw->currentPos.y(), 500.0);
delete sw;
-}
#endif
+}
-// Mac OS X < 10.6 does not support QTouchEvents.
-#if !defined(QT_NO_GESTURES) && !(defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6))
void tst_QScroller::overshoot()
{
+#if defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)
+ QSKIP("Mac OS X < 10.6 does not support QTouchEvents");
+ return;
+#endif
+
+#ifndef QT_NO_GESTURES
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
sw->scrollArea = QRectF(0, 0, 1000, 1000);
QScroller::grabGesture(sw, QScroller::TouchGesture);
@@ -522,8 +528,8 @@ void tst_QScroller::overshoot()
QCOMPARE( sw->receivedOvershoot, false );
delete sw;
-}
#endif
+}
QTEST_MAIN(tst_QScroller)
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()
{