Avoid using QSKIP in lieu of compile-time checks
authorJason McDonald <jason.mcdonald@nokia.com>
Tue, 4 Oct 2011 03:23:23 +0000 (13:23 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 5 Oct 2011 04:15:00 +0000 (06:15 +0200)
QSKIP is intended to be used to skip test functions that are found at
run-time to be inapplicable or unsafe.  If a test function can be
determined to be inapplicable at compile-time, the entire test function
should be omitted instead of replacing the body of the test function
with a QSKIP, which only serves to slow down test runs and to inflate
test run-rates with empty, inapplicable tests.

Task-number: QTQAINFRA-278

Change-Id: I582732e3dd657df834f9a98fd52d7ee368f2f29b
Reviewed-on: http://codereview.qt-project.org/5946
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
26 files changed:
tests/auto/collections/tst_collections.cpp
tests/auto/networkselftest/tst_networkselftest.cpp
tests/auto/qcombobox/tst_qcombobox.cpp
tests/auto/qdialog/tst_qdialog.cpp
tests/auto/qdirectpainter/tst_qdirectpainter.cpp
tests/auto/qdirmodel/tst_qdirmodel.cpp
tests/auto/qfiledialog/tst_qfiledialog.cpp
tests/auto/qfocusevent/tst_qfocusevent.cpp
tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
tests/auto/qgraphicsview/tst_qgraphicsview.cpp
tests/auto/qlabel/tst_qlabel.cpp
tests/auto/qlineedit/tst_qlineedit.cpp
tests/auto/qmainwindow/tst_qmainwindow.cpp
tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp
tests/auto/qmenu/tst_qmenu.cpp
tests/auto/qmenubar/tst_qmenubar.cpp
tests/auto/qmessagebox/tst_qmessagebox.cpp
tests/auto/qscroller/tst_qscroller.cpp
tests/auto/qstyle/tst_qstyle.cpp
tests/auto/qtableview/tst_qtableview.cpp
tests/auto/qwidget_window/tst_qwidget_window.cpp
tests/auto/tools/moc/tst_moc.cpp
tests/auto/xml/sax/qxml/tst_qxml.cpp

index 7c13ecf..8077948 100644 (file)
@@ -152,7 +152,9 @@ private slots:
     void qtimerList();
     void containerTypedefs();
     void forwardDeclared();
+#if defined(Q_ALIGNOF) && defined(Q_DECL_ALIGN)
     void alignment();
+#endif
     void QTBUG13079_collectionInsideCollection();
 
     void foreach_2();
@@ -3505,12 +3507,6 @@ void tst_Collections::alignment()
     testAssociativeContainerAlignment<QHash<Aligned128, Aligned4> >();
     testAssociativeContainerAlignment<QHash<Aligned128, Aligned128> >();
 }
-
-#else
-void tst_Collections::alignment()
-{
-    QSKIP("Compiler doesn't support necessary extension keywords", SkipAll);
-}
 #endif
 
 #ifndef QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
index 82ea045..033ee57 100644 (file)
@@ -81,7 +81,9 @@ private slots:
     void httpServerFiles();
     void httpServerCGI_data();
     void httpServerCGI();
+#ifndef QT_NO_OPENSSL
     void httpsServer();
+#endif
     void httpProxy();
     void httpProxyBasicAuth();
     void httpProxyNtlmAuth();
@@ -768,9 +770,9 @@ void tst_NetworkSelfTest::httpServerCGI()
     netChat(80, chat);
 }
 
+#ifndef QT_NO_OPENSSL
 void tst_NetworkSelfTest::httpsServer()
 {
-#ifndef QT_NO_OPENSSL
     netChat(443, QList<Chat>()
             << Chat::StartEncryption
             << Chat::send("GET / HTTP/1.0\r\n"
@@ -781,10 +783,8 @@ void tst_NetworkSelfTest::httpsServer()
             << Chat::discardUntil(" ")
             << Chat::expect("200 ")
             << Chat::DiscardUntilDisconnect);
-#else
-    QSKIP("SSL not enabled, cannot test", SkipAll);
-#endif
 }
+#endif
 
 void tst_NetworkSelfTest::httpProxy()
 {
index 4fe606e..e5ff7e9 100644 (file)
@@ -137,8 +137,10 @@ private slots:
     void itemListPosition();
     void separatorItem_data();
     void separatorItem();
+#ifndef QT_NO_STYLE_CLEANLOOKS
     void task190351_layout();
     void task191329_size();
+#endif
     void task166349_setEditableOnReturn();
     void task190205_setModelAdjustToContents();
     void task248169_popupWithMinimalSize();
@@ -151,7 +153,9 @@ private slots:
     void task253944_itemDelegateIsReset();
     void subControlRectsWithOffset_data();
     void subControlRectsWithOffset();
+#ifndef QT_NO_STYLE_WINDOWS
     void task260974_menuItemRectangleForComboBoxPopup();
+#endif
     void removeItem();
     void resetModel();
     void keyBoardNavigationWithMouse();
@@ -751,7 +755,7 @@ void tst_QComboBox::insertPolicy()
     }
 }
 
-
+// Apps running with valgrind are not fast enough.
 void tst_QComboBox::virtualAutocompletion()
 {
     testWidget->clear();
@@ -784,10 +788,6 @@ void tst_QComboBox::virtualAutocompletion()
     qApp->processEvents(); // Process events to trigger autocompletion
     QTRY_VERIFY(testWidget->currentIndex() == 1);
 
-#ifdef QTEST_RUNNING_USING_VALGRIND
-    QSKIP("App running with valgrind are not fast enough", SkipAll);
-#endif
-
     QKeyEvent kp2(QEvent::KeyPress, Qt::Key_O, 0, "o");
     QKeyEvent kr2(QEvent::KeyRelease, Qt::Key_O, 0, "o");
 
@@ -1976,9 +1976,10 @@ void tst_QComboBox::separatorItem()
     }
 }
 
+// This test requires the Cleanlooks style
+#ifndef QT_NO_STYLE_CLEANLOOKS
 void tst_QComboBox::task190351_layout()
 {
-#ifndef QT_NO_STYLE_CLEANLOOKS
     const QString oldStyle = QApplication::style()->objectName();
     QApplication::setStyle(new QCleanlooksStyle);
 
@@ -2010,10 +2011,8 @@ void tst_QComboBox::task190351_layout()
 #endif
 
     QApplication::setStyle(oldStyle);
-#else
-    QSKIP("Qt configured without cleanlooks style", SkipAll);
-#endif
 }
+#endif
 
 class task166349_ComboBox : public QComboBox
 {
@@ -2042,9 +2041,10 @@ void tst_QComboBox::task166349_setEditableOnReturn()
     QCOMPARE(QLatin1String("two1"), comboBox.itemText(comboBox.count() - 1));
 }
 
+// This test requires the Cleanlooks style.
+#ifndef QT_NO_STYLE_CLEANLOOKS
 void tst_QComboBox::task191329_size()
 {
-#ifndef QT_NO_STYLE_CLEANLOOKS
     const QString oldStyle = QApplication::style()->objectName();
     QApplication::setStyle(new QCleanlooksStyle);
 
@@ -2085,10 +2085,8 @@ void tst_QComboBox::task191329_size()
 #endif
 
     QApplication::setStyle(oldStyle);
-#else
-    QSKIP("Qt configured without cleanlooks style", SkipAll);
-#endif
 }
+#endif
 
 void tst_QComboBox::task190205_setModelAdjustToContents()
 {
@@ -2360,11 +2358,10 @@ void tst_QComboBox::subControlRectsWithOffset()
 
 }
 
+// This test depends on Windows style.
+#ifndef QT_NO_STYLE_WINDOWS
 void tst_QComboBox::task260974_menuItemRectangleForComboBoxPopup()
 {
-#ifdef QT_NO_STYLE_WINDOWS
-    QSKIP("test depends on windows style", QTest::SkipAll);
-#else
     class TestStyle: public QWindowsStyle
     {
     public:
@@ -2397,8 +2394,8 @@ void tst_QComboBox::task260974_menuItemRectangleForComboBoxPopup()
 
         QTRY_VERIFY(style.discoveredRect.width() <= comboBox.width());
     }
-#endif
 }
+#endif
 
 void tst_QComboBox::removeItem()
 {
@@ -2472,10 +2469,8 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
 
     QCOMPARE(combo.currentText(), QLatin1String("0"));
 
-#ifdef Q_OS_WINCE
-    QSKIP("When calling cursor function, Windows CE responds with: This function is not supported on this system.", SkipAll);
-#endif
-
+    // When calling cursor function, Windows CE responds with: This function is not supported on this system.
+#ifndef Q_OS_WINCE
     // Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA:
     const QPoint target(combo.view()->mapToGlobal(combo.view()->rect().center()));
     QCursor::setPos(QPoint(target.x() + 1, target.y()));
@@ -2505,6 +2500,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
 
     QTest::keyClick(combo.view(), Qt::Key_Enter);
     QTRY_COMPARE(combo.currentText(), QString::number(final));
+#endif
 }
 
 void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated()
index 0349c32..0f3f274 100644 (file)
@@ -77,11 +77,17 @@ private slots:
     void showMaximized();
     void showMinimized();
     void showFullScreen();
+#if !defined(Q_WS_X11) && !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();
@@ -274,7 +280,7 @@ void tst_QDialog::showMaximized()
     dialog.showMaximized();
     QVERIFY(dialog.isMaximized());
     QVERIFY(dialog.isVisible());
-#if !defined(Q_WS_MAC) && !defined(Q_OS_IRIX) && !defined(Q_OS_HPUX)
+#if !defined(Q_OS_MAC) && !defined(Q_OS_IRIX) && !defined(Q_OS_HPUX)
     QVERIFY(!sizeGrip->isVisible());
 #endif
 
@@ -387,13 +393,11 @@ 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_WS_X11) && !defined(Q_OS_WINCE)
 void tst_QDialog::showAsTool()
 {
-#if defined(Q_WS_X11)
-    QSKIP("Qt/X11: Skipped since activeWindow() is not respected by all window managers", SkipAll);
-#elif defined(Q_OS_WINCE)
-    QSKIP("No real support for Qt::Tool on WinCE", SkipAll);
-#endif
     ToolDialog dialog(testWidget);
     testWidget->activateWindow();
     dialog.exec();
@@ -404,14 +408,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", SkipAll);
-#endif
     QDialog dialog(0, Qt::Tool);
     dialog.move(QPoint(100,100));
     const QPoint beforeShowPosition = dialog.pos();
@@ -419,6 +423,7 @@ void tst_QDialog::toolDialogPosition()
     const QPoint afterShowPosition = dialog.pos();
     QCOMPARE(afterShowPosition, beforeShowPosition);
 }
+#endif
 
 class Dialog : public QDialog
 {
@@ -446,7 +451,8 @@ void tst_QDialog::deleteInExec()
     QCOMPARE(dialog->exec(), int(QDialog::Rejected));
 }
 
-#ifndef QT_NO_EXCEPTIONS
+// 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_))
 class QDialogTestException : public std::exception { };
 
 class ExceptionDialog : public QDialog
@@ -464,10 +470,6 @@ 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.", SkipAll);
-#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.
@@ -494,12 +496,7 @@ void tst_QDialog::throwInExec()
     }
     QCOMPARE(caughtExceptions, 1);
 }
-#else
-void tst_QDialog::throwInExec()
-{
-    QSKIP("Exceptions are disabled", SkipAll);
-}
-#endif //QT_NO_EXCEPTIONS
+#endif
 
 // From Task 124269
 void tst_QDialog::showSizeGrip()
index 721e3aa..d33098d 100644 (file)
@@ -66,7 +66,9 @@ private slots:
     void initTestCase();
     void setGeometry_data();
     void setGeometry();
+#ifndef QT_NO_PROCESS
     void regionSynchronization();
+#endif
     void reservedSynchronous();
 
 private:
@@ -173,11 +175,9 @@ void tst_QDirectPainter::setGeometry()
     VERIFY_COLOR(rect, bgColor);
 }
 
+#ifndef QT_NO_PROCESS
 void tst_QDirectPainter::regionSynchronization()
 {
-#ifdef QT_NO_PROCESS
-    QSKIP("Test requires QProcess", SkipAll);
-#else
     QRect dpRect(10, 10, 50, 50);
 
     // Start the direct painter in a different process
@@ -214,8 +214,8 @@ void tst_QDirectPainter::regionSynchronization()
     QVERIFY(i > 100); // sanity check
 
     proc.kill();
-#endif
 }
+#endif
 
 class MyObject : public QObject
 {
index 2e7b012..70eb17b 100644 (file)
@@ -92,7 +92,9 @@ private slots:
 
     void filePath();
 
+#ifdef Q_OS_UNIX
     void hidden();
+#endif
 
     void fileName();
     void fileName_data();
@@ -511,9 +513,9 @@ void tst_QDirModel::rowsAboutToBeRemoved()
     QVERIFY(rowsAboutToBeRemoved_cleanup(test_path));
 }
 
+#ifdef Q_OS_UNIX
 void tst_QDirModel::hidden()
 {
-#ifdef Q_OS_UNIX
     QDir current;
     current.mkdir(".qtest_hidden");
 
@@ -529,10 +531,8 @@ void tst_QDirModel::hidden()
     model2.setFilter(model2.filter() | QDir::Hidden);
     index = model2.index(QDir::currentPath() + "/.qtest_hidden");
     QVERIFY(index.isValid());
-#else
-    QSKIP("Test not implemented on non-Unixes", SkipAll);
-#endif
 }
+#endif
 
 void tst_QDirModel::fileName_data()
 {
@@ -555,9 +555,9 @@ void tst_QDirModel::fileName()
 }
 
 #if 0
+#ifdef Q_OS_UNIX
 void tst_QDirModel::unreadable()
 {
-#ifdef Q_OS_UNIX
     //QFile current("qtest_unreadable");
     //QVERIFY(current.setPermissions(QFile::WriteOwner));
 
@@ -569,11 +569,9 @@ void tst_QDirModel::unreadable()
     model2.setFilter(model2.filter() | QDir::Hidden);
     index = model2.index(QDir::currentPath() + "/qtest_unreadable");
     QVERIFY(index.isValid());
-#else
-    QSKIP("Test not implemented on non-Unixes", SkipAll);
-#endif
 }
 #endif
+#endif
 
 void tst_QDirModel::filePath()
 {
index ada95ae..281aff3 100644 (file)
@@ -146,7 +146,7 @@ private slots:
     void clearLineEdit();
     void enableChooseButton();
     void hooks();
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_UNIX) && defined(QT_BUILD_INTERNAL)
     void tildeExpansion_data();
     void tildeExpansion();
 #endif
@@ -1319,7 +1319,8 @@ void tst_QFiledialog::hooks()
     QCOMPARE(QFileDialog::getSaveFileName(), QString("saveName"));
 }
 
-#ifdef Q_OS_UNIX
+// Test case relies on developer build (AUTOTEST_EXPORT).
+#if defined(Q_OS_UNIX) && defined(QT_BUILD_INTERNAL)
 void tst_QFiledialog::tildeExpansion_data()
 {
     QTest::addColumn<QString>("tildePath");
@@ -1336,17 +1337,12 @@ void tst_QFiledialog::tildeExpansion_data()
     QTest::newRow("invalid user name") << invalid << invalid;
 }
 
-
 void tst_QFiledialog::tildeExpansion()
 {
-#ifndef QT_BUILD_INTERNAL
-    QSKIP("Test case relies on developer build (AUTOTEST_EXPORT)", SkipAll);
-#else
     QFETCH(QString, tildePath);
     QFETCH(QString, expandedPath);
 
     QCOMPARE(qt_tildeExpansion(tildePath), expandedPath);
-#endif
 }
 #endif
 
index d295a10..9a1d312 100644 (file)
@@ -108,7 +108,9 @@ public slots:
 private slots:
     void checkReason_Tab();
     void checkReason_ShiftTab();
+#ifndef Q_OS_WIN32
     void checkReason_BackTab();
+#endif
     void checkReason_Popup();
     void checkReason_focusWidget();
     void checkReason_Shortcut();
@@ -230,11 +232,10 @@ void tst_QFocusEvent::checkReason_ShiftTab()
 /*!
     In this test we verify that the Qt::KeyBacktab key is handled in a qfocusevent
 */
+// Backtab is not supported on Windows.
+#ifndef Q_OS_WIN32
 void tst_QFocusEvent::checkReason_BackTab()
 {
-#ifdef Q_OS_WIN32 // key is not supported on Windows
-    QSKIP( "Backtab is not supported on Windows", SkipAll );
-#else
     initWidget();
     QVERIFY( childFocusWidgetOne->hasFocus() );
 
@@ -250,8 +251,8 @@ void tst_QFocusEvent::checkReason_BackTab()
     QVERIFY( childFocusWidgetTwo->hasFocus() );
     QCOMPARE( childFocusWidgetOne->focusOutEventReason, int(Qt::BacktabFocusReason) );
     QCOMPARE( childFocusWidgetTwo->focusInEventReason, int(Qt::BacktabFocusReason) );
-#endif
 }
+#endif
 
 void tst_QFocusEvent::checkReason_Popup()
 {
index 6b4ad19..e9d9cb6 100644 (file)
@@ -61,12 +61,16 @@ 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();
@@ -490,6 +494,8 @@ 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");
@@ -501,9 +507,6 @@ 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", SkipAll);
-#endif
     QFETCH(bool, hasHeightForWidth);
     QGraphicsScene scene;
     QGraphicsView view(&scene);
@@ -562,7 +565,10 @@ 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");
@@ -575,9 +581,6 @@ 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", SkipAll);
-#endif
     QFETCH(bool, hasHeightForWidth);
     QGraphicsScene scene;
     QGraphicsView view(&scene);
@@ -630,6 +633,7 @@ void tst_QGraphicsGridLayout::columnAlignment()
 
     delete widget;
 }
+#endif
 
 void tst_QGraphicsGridLayout::columnCount_data()
 {
index 4a0b337..81d2fa6 100644 (file)
@@ -1081,7 +1081,6 @@ void tst_QGraphicsLinearLayout::setStretchFactor()
 {
     QFETCH(qreal, totalSize);
     QFETCH(IntList, stretches);
-    //QSKIP("Seems to be some problems with stretch factors. Talk with Jasmin", SkipAll);
     QGraphicsScene scene;
     QGraphicsView view(&scene);
     QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
index 1afc700..c223ca5 100644 (file)
@@ -121,8 +121,10 @@ 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();
@@ -160,7 +162,9 @@ 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();
@@ -943,6 +947,8 @@ 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");
@@ -953,16 +959,11 @@ 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", SkipAll);
-#endif
-
     // proxy should translate this into events that the widget would expect
 
     QGraphicsScene scene;
@@ -1009,6 +1010,7 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent()
     if (!hasWidget)
         delete widget;
 }
+#endif
 
 void tst_QGraphicsProxyWidget::hoverMoveEvent_data()
 {
@@ -2549,12 +2551,9 @@ 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", SkipAll);
-#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;
@@ -2580,8 +2579,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
 }
+#endif
 
 void tst_QGraphicsProxyWidget::tooltip_basic()
 {
index 9696c14..809837d 100644 (file)
@@ -218,7 +218,9 @@ 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();
@@ -1321,11 +1323,9 @@ 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", SkipAll);
-#endif
     QGraphicsScene scene;
     QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10));
     QCOMPARE(scene.itemAt(0, 0), item); // forces indexing
@@ -1387,6 +1387,7 @@ void tst_QGraphicsScene::removeItem()
     qApp->processEvents(); // <- pending update is sent to view
     QVERIFY(!hoverItem->isHovered);
 }
+#endif
 
 void tst_QGraphicsScene::focusItem()
 {
index 38a146b..8e94dbc 100644 (file)
@@ -188,13 +188,17 @@ 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();
     void viewportUpdateMode2();
+#ifndef QT_NO_DRAGANDDROP
     void acceptDrops();
+#endif
     void optimizationFlags();
     void optimizationFlags_dontSavePainterState();
     void optimizationFlags_dontSavePainterState2_data();
@@ -241,12 +245,16 @@ 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();
 
@@ -2050,12 +2058,10 @@ 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", SkipAll);
-#endif
     if (PlatformQuirks::haveMouseCursor())
         QSKIP("The Platform does not have regular cursor support", SkipAll);
 
@@ -2077,15 +2083,13 @@ void tst_QGraphicsView::cursor()
 
     sendMouseMove(view.viewport(), QPoint(5, 5));
     QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor);
-#endif
 }
+#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", SkipAll);
-#endif
     if (PlatformQuirks::haveMouseCursor())
         QSKIP("The Platform does not have regular cursor support", SkipAll);
 
@@ -2151,8 +2155,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
 }
+#endif
 
 void tst_QGraphicsView::transformationAnchor()
 {
@@ -2390,11 +2394,9 @@ void tst_QGraphicsView::viewportUpdateMode2()
 #endif
 }
 
+#ifndef QT_NO_DRAGANDDROP
 void tst_QGraphicsView::acceptDrops()
 {
-#ifdef QT_NO_DRAGANDDROP
-    QSKIP("Drag'n drop disabled in this build", SkipAll);
-#else
     QGraphicsView view;
 
     // Excepted default behavior.
@@ -2428,8 +2430,8 @@ void tst_QGraphicsView::acceptDrops()
     // Switching the view to not accept drops.
     view.setAcceptDrops(false);
     QVERIFY(!view.viewport()->acceptDrops());
-#endif
 }
+#endif
 
 void tst_QGraphicsView::optimizationFlags()
 {
@@ -4251,12 +4253,10 @@ 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", SkipAll);
-#endif
-
     QGraphicsScene scene(-100, -100, 200, 200);
     scene.addRect(QRectF(-50, -50, 100, 100), QPen(Qt::black), QBrush(Qt::blue));
 
@@ -4290,6 +4290,7 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins()
     QVERIFY(qAbs(newMouseScenePos.x() - mouseScenePos.x()) < slack);
     QVERIFY(qAbs(newMouseScenePos.y() - mouseScenePos.y()) < slack);
 }
+#endif
 
 void tst_QGraphicsView::task259503_scrollingArtifacts()
 {
@@ -4438,12 +4439,10 @@ 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", SkipAll);
-#endif
     QGraphicsScene scene;
     QGraphicsItem *item = scene.addRect(QRectF(-10, -10, 20, 20));
     item->setFlag(QGraphicsItem::ItemIsMovable);
@@ -4462,8 +4461,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
 }
+#endif
 
 class GraphicsItemWithHover : public QGraphicsRectItem
 {
index 2bd4eef..495eb94 100644 (file)
@@ -95,7 +95,9 @@ private slots:
     void textFormat();
     void setTextFormat();
     void buddy();
+#ifndef Q_WS_MAC
     void setBuddy();
+#endif
     void setFont();
     void setNum();
     void clear();
@@ -207,11 +209,10 @@ void tst_QLabel::buddy()
     DEPENDS_ON( "setBuddy" );
 }
 
+// Set buddy doesn't make much sense on Mac OS X.
+#ifndef Q_WS_MAC
 void tst_QLabel::setBuddy()
 {
-#ifdef Q_WS_MAC
-    QSKIP("Set buddy doesn't make much sense on Mac OS X", SkipAll);
-#endif
     testWidget->hide();
 
     test_box = new Widget;
@@ -232,6 +233,7 @@ void tst_QLabel::setBuddy()
     QVERIFY( test_edit->hasFocus() );
     delete test_box;
 }
+#endif
 
 void tst_QLabel::text()
 {
index 891a607..5cae5b8 100644 (file)
@@ -256,7 +256,9 @@ private slots:
 
     void noTextEditedOnClear();
 
+#ifndef QT_NO_CURSOR
     void cursor();
+#endif
 
     void textMargin_data();
     void textMargin();
@@ -280,7 +282,9 @@ 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();
@@ -3331,19 +3335,17 @@ void tst_QLineEdit::textMargin()
     QTRY_COMPARE(testWidget.cursorPosition(), cursorPosition);
 }
 
+#ifndef QT_NO_CURSOR
 void tst_QLineEdit::cursor()
 {
-#ifdef QT_NO_CURSOR
-    QSKIP("Qt compiled without cursor support", SkipAll);
-#else
     testWidget->setReadOnly(false);
     QCOMPARE(testWidget->cursor().shape(), Qt::IBeamCursor);
     testWidget->setReadOnly(true);
     QCOMPARE(testWidget->cursor().shape(), Qt::ArrowCursor);
     testWidget->setReadOnly(false);
     QCOMPARE(testWidget->cursor().shape(), Qt::IBeamCursor);
-#endif
 }
+#endif
 
 class task180999_Widget : public QWidget
 {
@@ -3708,11 +3710,9 @@ 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", SkipAll);
-#endif
     QLineEdit le;
     le.setText("               ");
     QPalette p = le.palette();
@@ -3734,6 +3734,7 @@ 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()
 {
index 9b768ca..963f40f 100644 (file)
@@ -105,12 +105,16 @@ private slots:
     void saveRestore();
     void saveRestore_data();
     void isSeparator();
+#ifndef QT_NO_CURSOR
     void setCursor();
+#endif
     void addToolbarAfterShow();
     void centralWidgetSize();
     void dockWidgetSize();
     void QTBUG2774_stylechange();
+#ifdef Q_OS_MAC
     void toggleUnifiedTitleAndToolBarOnMac();
+#endif
 };
 
 // Testing get/set functions
@@ -1639,11 +1643,9 @@ class MainWindow : public QMainWindow {
         using QMainWindow::event;
 };
 
+#ifndef QT_NO_CURSOR
 void tst_QMainWindow::setCursor()
 {
-#ifdef QT_NO_CURSOR
-    QSKIP("Qt compiled without cursor support(QT_NO_CURSOR)", SkipAll);
-#else
     MainWindow mw;
     QCursor cur = Qt::WaitCursor;
     mw.setCursor(cur);
@@ -1662,8 +1664,8 @@ void tst_QMainWindow::setCursor()
     mw.event(&leaveE);
     QTest::qWait(50);
     QCOMPARE(cur.shape(), mw.cursor().shape());
-#endif
 }
+#endif
 
 void tst_QMainWindow::addToolbarAfterShow()
 {
@@ -1754,9 +1756,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");
@@ -1768,11 +1770,8 @@ void tst_QMainWindow::toggleUnifiedTitleAndToolBarOnMac()
     QVERIFY(frameGeometry.topLeft() == mw.frameGeometry().topLeft());
     mw.setUnifiedTitleAndToolBarOnMac(true);
     QVERIFY(frameGeometry.topLeft() == mw.frameGeometry().topLeft());
-#else
-    QSKIP("Mac specific test", SkipAll);
-#endif
 }
-
+#endif
 
 QTEST_MAIN(tst_QMainWindow)
 #include "tst_qmainwindow.moc"
index 0aa4aa1..93b81ec 100644 (file)
@@ -183,8 +183,10 @@ 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();
@@ -694,6 +696,8 @@ 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");
@@ -708,9 +712,6 @@ 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", SkipAll);
-#endif
     QFETCH(bool, opaqueMode);
     QFETCH(int, geometryCount);
     QFETCH(int, expectedGeometryCount);
@@ -816,6 +817,7 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove()
     QCOMPARE(window->size(), windowSize + QSize(geometryCount, geometryCount));
     }
 }
+#endif
 
 void tst_QMdiSubWindow::setWindowFlags_data()
 {
index 3616003..875deb1 100644 (file)
@@ -86,7 +86,9 @@ private slots:
     void overrideMenuAction();
     void statusTip();
     void widgetActionFocus();
+#ifndef Q_OS_WINCE_WM
     void mouseActivation();
+#endif
     void tearOff();
     void layoutDirection();
 
@@ -97,7 +99,9 @@ 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();
@@ -289,11 +293,10 @@ 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.", SkipAll);
-#endif
     QWidget topLevel;
     QMenu menu(&topLevel);
     topLevel.show();
@@ -326,7 +329,7 @@ void tst_QMenu::mouseActivation()
     QVERIFY(submenu.isVisible());
 #endif
 }
-
+#endif
 
 void
 tst_QMenu::keyboardNavigation_data()
@@ -667,12 +670,10 @@ void tst_QMenu::activeSubMenuPosition()
     QVERIFY(sub->pos() != QPoint(0,0));
     // well, it's enough to check the pos is not (0,0) but it's more safe
     // to check that submenu is to the right of the main menu too.
-#ifdef Q_OS_WINCE_WM
-    QSKIP("Not true for Windows Mobile Soft Keys", SkipSingle);
-#endif
-
+#ifndef Q_OS_WINCE_WM
     QVERIFY(sub->pos().x() > main->pos().x());
     QCOMPARE(sub->activeAction(), subAction);
+#endif
 }
 
 void tst_QMenu::task242454_sizeHint()
@@ -811,11 +812,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", SkipAll);
-#endif
 #ifdef Q_WS_QPA
     QSKIP("QTBUG-20753 QCursor::setPos() / QTest::mouseMove() doesn't work on qpa", SkipAll);
 #endif
@@ -839,6 +840,7 @@ void tst_QMenu::task258920_mouseBorder()
     QCOMPARE(static_cast<QAction*>(0), menu.activeAction());
     QVERIFY(menu.painted);
 }
+#endif
 
 void tst_QMenu::setFixedWidth()
 {
index cc26742..7ccb225 100644 (file)
@@ -119,18 +119,24 @@ 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();
@@ -138,12 +144,16 @@ 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:
@@ -333,12 +343,10 @@ 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", SkipAll);
-#endif
-
     // create a popup menu with menu items set the accelerators later...
     initSimpleMenubar();
 
@@ -350,12 +358,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", SkipAll);
-#endif
     // create a popup menu with menu items set the accelerators later...
     initSimpleMenubar();
 
@@ -363,6 +371,7 @@ void tst_QMenuBar::activatedCount()
 //wait(5000);
     QCOMPARE( activated_count, 2 ); //1 from the popupmenu and 1 from the menubar
 }
+#endif
 
 void tst_QMenuBar::clear()
 {
@@ -565,11 +574,10 @@ 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", SkipAll);
-#endif
     initComplexMenubar();
 
     // start with a bogus key that shouldn't trigger anything
@@ -633,13 +641,12 @@ 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", SkipAll);
-#endif
-
     initComplexMenubar();
 
     // start with a ALT + 1 that activates the first popupmenu
@@ -664,13 +671,12 @@ 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", SkipAll);
-#endif
-
     initComplexMenubar();
 
     // select popupmenu2
@@ -691,16 +697,15 @@ 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", SkipAll);
-#endif
-
     initComplexMenubar();
 
     // select Popupmenu 2
@@ -719,6 +724,7 @@ 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.
@@ -799,12 +805,10 @@ 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", SkipAll);
-#endif
-
     initComplexMenubar();
 
     QVERIFY( !pm1->isActiveWindow() );
@@ -833,7 +837,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()
 // {
@@ -1002,12 +1006,10 @@ 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", SkipAll);
-#endif
-
     initComplexMenubar();
 
     qApp->setActiveWindow(mw);
@@ -1022,15 +1024,13 @@ 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", SkipAll);
-#endif
-#ifdef Q_OS_WINCE_WM
-    QSKIP("Qt/CE uses native menubar", SkipAll);
-#endif
     Menu menu;
     initComplexMenubar();
     menu.setTitle("&menu");
@@ -1095,8 +1095,8 @@ void tst_QMenuBar::check_menuPosition()
         menu.close();
         qApp->setLayoutDirection(dir);
     }
-
 }
+#endif
 
 void tst_QMenuBar::task223138_triggered()
 {
@@ -1237,11 +1237,10 @@ 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", SkipAll);
-#endif
     QMenuBar menubar;
     QMenu menu("menu1");
     QAction *first = menubar.addMenu(&menu);
@@ -1261,6 +1260,7 @@ 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()
 {
index 12b6029..463d4c4 100644 (file)
@@ -124,7 +124,9 @@ private slots:
     void detailsText();
     void detailsButtonText();
 
+#ifndef Q_WS_MAC
     void shortcut();
+#endif
 
     void staticSourceCompat();
     void instanceSourceCompat();
@@ -366,17 +368,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", SkipAll);
-#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()
 {
@@ -486,11 +488,11 @@ void tst_QMessageBox::instanceSourceCompat()
 
     QCOMPARE(exec(&mb, Qt::Key_Enter), int(QMessageBox::Yes));
     QCOMPARE(exec(&mb, Qt::Key_Escape), int(QMessageBox::Cancel));
-#ifdef Q_WS_MAC
-    QSKIP("mnemonics are not used on the MAC OS X", SkipAll);
-#endif
+#ifndef Q_WS_MAC
+    // mnemonics are not used on Mac OS X
     QCOMPARE(exec(&mb, Qt::ALT + Qt::Key_R), 0);
     QCOMPARE(exec(&mb, Qt::ALT + Qt::Key_Z), 1);
+#endif
 }
 
 void tst_QMessageBox::testSymbols()
index 7e7405b..9ed4965 100644 (file)
@@ -134,8 +134,10 @@ 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
@@ -381,14 +383,10 @@ 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", SkipAll);
-    return;
-#endif
-
-#ifndef QT_NO_GESTURES
     // -- good case. normal scroll
     tst_QScrollerWidget *sw = new tst_QScrollerWidget();
     sw->scrollArea = QRectF(0, 0, 1000, 1000);
@@ -425,17 +423,13 @@ void tst_QScroller::scroll()
     QCOMPARE(sw->currentPos.y(), 500.0);
 
     delete sw;
-#endif
 }
+#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", SkipAll);
-    return;
-#endif
-
-#ifndef QT_NO_GESTURES
     tst_QScrollerWidget *sw = new tst_QScrollerWidget();
     sw->scrollArea = QRectF(0, 0, 1000, 1000);
     QScroller::grabGesture(sw, QScroller::TouchGesture);
@@ -527,11 +521,9 @@ void tst_QScroller::overshoot()
     QVERIFY(qFuzzyCompare( sw->currentPos.y(), 500 ));
     QCOMPARE( sw->receivedOvershoot, false );
 
-
     delete sw;
-#endif
 }
-
+#endif
 
 QTEST_MAIN(tst_QScroller)
 
index ae94bad..0f04b73 100644 (file)
@@ -127,13 +127,23 @@ private slots:
     void cleanupTestCase();
     void init();
     void cleanup();
+#ifndef QT_NO_STYLE_MOTIF
     void testMotifStyle();
+#endif
+#ifndef QT_NO_STYLE_PLASTIQUE
     void testPlastiqueStyle();
+#endif
     void testWindowsStyle();
+#ifndef QT_NO_STYLE_CDE
     void testCDEStyle();
+#endif
+#if defined(Q_WS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
     void testWindowsXPStyle();
+#endif
     void testWindowsVistaStyle();
+#ifndef QT_NO_STYLE_CLEANLOOKS
     void testCleanlooksStyle();
+#endif
     void testMacStyle();
     void testWindowsCEStyle();
     void testWindowsMobileStyle();
@@ -378,27 +388,23 @@ void tst_QStyle::testScrollBarSubControls(QStyle* style)
     }
 }
 
+#ifndef QT_NO_STYLE_PLASTIQUE
 void tst_QStyle::testPlastiqueStyle()
 {
-#if !defined(QT_NO_STYLE_PLASTIQUE)
     QPlastiqueStyle pstyle;
     testAllFunctions(&pstyle);
     lineUpLayoutTest(&pstyle);
-#else
-    QSKIP("No Plastique style", SkipAll);
-#endif
 }
+#endif
 
+#ifndef QT_NO_STYLE_CLEANLOOKS
 void tst_QStyle::testCleanlooksStyle()
 {
-#if !defined(QT_NO_STYLE_CLEANLOOKS)
     QCleanlooksStyle cstyle;
     testAllFunctions(&cstyle);
     lineUpLayoutTest(&cstyle);
-#else
-    QSKIP("No Cleanlooks style", SkipAll);
-#endif
 }
+#endif
 
 void tst_QStyle::testWindowsStyle()
 {
@@ -414,16 +420,14 @@ void tst_QStyle::testWindowsStyle()
     wstyle.drawControl(QStyle::CE_ProgressBar, &pb, &painter, 0);
 }
 
+#if defined(Q_WS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
 void tst_QStyle::testWindowsXPStyle()
 {
-#if defined(Q_WS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
     QWindowsXPStyle xpstyle;
     testAllFunctions(&xpstyle);
     lineUpLayoutTest(&xpstyle);
-#else
-    QSKIP("No WindowsXP style", SkipAll);
-#endif
 }
+#endif
 
 void writeImage(const QString &fileName, QImage image)
 {
@@ -566,25 +570,21 @@ void tst_QStyle::testMacStyle()
 #endif
 }
 
+#ifndef QT_NO_STYLE_MOTIF
 void tst_QStyle::testMotifStyle()
 {
-#if !defined(QT_NO_STYLE_MOTIF)
     QMotifStyle mstyle;
     testAllFunctions(&mstyle);
-#else
-    QSKIP("No Motif style", SkipAll);
-#endif
 }
+#endif
 
+#ifndef QT_NO_STYLE_CDE
 void tst_QStyle::testCDEStyle()
 {
-#if !defined(QT_NO_STYLE_CDE)
     QCDEStyle cstyle;
     testAllFunctions(&cstyle);
-#else
-    QSKIP("No CDE style", SkipAll);
-#endif
 }
+#endif
 
 void tst_QStyle::testWindowsCEStyle()
 {
index 24c3627..1130ae7 100644 (file)
@@ -205,8 +205,10 @@ 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();
@@ -3637,6 +3639,8 @@ 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");
@@ -3657,9 +3661,6 @@ 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", SkipAll);
-#endif
 
     QFETCH(int, scrollMode);
     QFETCH(int, delta);
@@ -3693,6 +3694,7 @@ void tst_QTableView::mouseWheel()
     QApplication::sendEvent(view.viewport(), &verticalEvent);
     QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 10);
 }
+#endif
 
 void tst_QTableView::addColumnWhileEditing()
 {
index 5928419..60ae6c3 100644 (file)
@@ -80,7 +80,9 @@ private slots:
     void tst_windowFilePath_data();
     void tst_windowFilePath();
 
+#ifdef Q_WS_X11
     void tst_showWithoutActivating();
+#endif
     void tst_paintEventOnSecondShow();
 };
 
@@ -285,11 +287,9 @@ 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.", SkipAll);
-#else
     QWidget w;
     w.show();
     QTest::qWaitForWindowShown(&w);
@@ -309,9 +309,8 @@ 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()
 {
index 4e01472..62d5a50 100644 (file)
@@ -452,10 +452,16 @@ private slots:
 
     void slotWithException() throw(MyStruct);
     void dontStripNamespaces();
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     void oldStyleCasts();
     void warnOnExtraSignalSlotQualifiaction();
+#endif
+#ifndef NOLONGLONG
     void uLongLong();
+#endif
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     void inputFileNameWithDotsButNoExtension();
+#endif
     void userProperties();
     void supportConstSignals();
     void task87883();
@@ -472,31 +478,47 @@ private slots:
     void slotsWithVoidTemplate();
     void structQObject();
     void namespacedFlags();
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     void warnOnMultipleInheritance();
     void forgottenQInterface();
+#endif
     void os9Newline();
     void winNewline();
     void escapesInStringLiterals();
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS)
     void frameworkSearchPath();
+#endif
     void cstyleEnums();
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     void defineMacroViaCmdline();
+#endif
     void invokable();
     void singleFunctionKeywordSignalAndSlot();
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     void templateGtGt();
+#endif
     void qprivateslots();
     void qprivateproperties();
     void inlineSlotsWithThrowDeclaration();
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     void warnOnPropertyWithoutREAD();
+#endif
     void constructors();
     void typenameWithUnsigned();
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     void warnOnVirtualSignal();
+#endif
     void QTBUG5590_dummyProperty();
     void QTBUG12260_defaultTemplate();
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     void notifyError();
+#endif
     void QTBUG17635_invokableAndProperty();
     void revisions();
+#ifndef MOC_CROSS_COMPILED
     void warnings_data();
     void warnings();
+#endif
     void privateClass();
 
 signals:
@@ -561,13 +583,10 @@ void tst_Moc::dontStripNamespaces()
     QCOMPARE(receiver.intCallCount, 1);
 }
 
-
+// Only tested on linux/gcc. Not tested when cross-compiled.
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
 void tst_Moc::oldStyleCasts()
 {
-#ifdef MOC_CROSS_COMPILED
-    QSKIP("Not tested when cross-compiled", SkipAll);
-#endif
-#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     QProcess proc;
     proc.start("moc", QStringList(srcify("/oldstyle-casts.h")));
     QVERIFY(proc.waitForFinished());
@@ -587,17 +606,13 @@ void tst_Moc::oldStyleCasts()
     QVERIFY(proc.waitForFinished());
     QCOMPARE(proc.exitCode(), 0);
     QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString());
-#else
-    QSKIP("Only tested on linux/gcc", SkipAll);
-#endif
 }
+#endif
 
+// Only tested on linux/gcc. Not tested when cross-compiled.
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
 void tst_Moc::warnOnExtraSignalSlotQualifiaction()
 {
-#ifdef MOC_CROSS_COMPILED
-    QSKIP("Not tested when cross-compiled", SkipAll);
-#endif
-#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     QProcess proc;
     proc.start("moc", QStringList(srcify("extraqualification.h")));
     QVERIFY(proc.waitForFinished());
@@ -608,14 +623,13 @@ void tst_Moc::warnOnExtraSignalSlotQualifiaction()
     QCOMPARE(mocWarning, QString(SRCDIR) +
                 QString("/extraqualification.h:53: Warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") +
                 QString(SRCDIR) + QString("/extraqualification.h:56: Warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n"));
-#else
-    QSKIP("Only tested on linux/gcc", SkipAll);
-#endif
 }
+#endif
 
+// long long doesn't work on MSVC6 & .NET 2002, also skipped on 2003 due to compiler version issue with moc
+#ifndef NOLONGLONG
 void tst_Moc::uLongLong()
 {
-#ifndef NOLONGLONG
     TestClass tst;
     const QMetaObject *mobj = tst.metaObject();
     int idx = mobj->indexOfSlot("slotWithULong(ulong)");
@@ -629,17 +643,13 @@ void tst_Moc::uLongLong()
     QVERIFY(idx != -1);
     idx = mobj->indexOfSlot("slotWithLongLong(long long)");
     QVERIFY(idx != -1);
-#else
-    QSKIP("long long doesn't work on MSVC6 & .NET 2002, also skipped on 2003 due to compiler version issue with moc", SkipAll);
-#endif
 }
+#endif
 
+// Only tested on linux/gcc. Not tested when cross-compiled.
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
 void tst_Moc::inputFileNameWithDotsButNoExtension()
 {
-#ifdef MOC_CROSS_COMPILED
-    QSKIP("Not tested when cross-compiled", SkipAll);
-#endif
-#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     QProcess proc;
     proc.setWorkingDirectory(QString(SRCDIR) + "/task71021");
     proc.start("moc", QStringList("../Header"));
@@ -660,10 +670,8 @@ void tst_Moc::inputFileNameWithDotsButNoExtension()
     QVERIFY(proc.waitForFinished());
     QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString());
     QCOMPARE(proc.exitCode(), 0);
-#else
-    QSKIP("Only tested on linux/gcc", SkipAll);
-#endif
 }
+#endif
 
 void tst_Moc::userProperties()
 {
@@ -850,12 +858,10 @@ void tst_Moc::namespacedFlags()
     QCOMPARE(l, qvariant_cast<QList<Foo::Bar::Flags> >(baz.property("flagsList")));
 }
 
+// Only tested on linux/gcc. Not tested when cross-compiled.
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
 void tst_Moc::warnOnMultipleInheritance()
 {
-#ifdef MOC_CROSS_COMPILED
-    QSKIP("Not tested when cross-compiled", SkipAll);
-#endif
-#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     QProcess proc;
     QStringList args;
     args << "-I" << qtIncludePath + "/QtGui"
@@ -868,17 +874,13 @@ void tst_Moc::warnOnMultipleInheritance()
     QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
     QCOMPARE(mocWarning, QString(SRCDIR) +
                 QString("/warn-on-multiple-qobject-subclasses.h:53: Warning: Class Bar inherits from two QObject subclasses QWindow and Foo. This is not supported!\n"));
-#else
-    QSKIP("Only tested on linux/gcc", SkipAll);
-#endif
 }
+#endif
 
+// Only tested on linux/gcc. Not tested when cross-compiled.
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
 void tst_Moc::forgottenQInterface()
 {
-#ifdef MOC_CROSS_COMPILED
-    QSKIP("Not tested when cross-compiled", SkipAll);
-#endif
-#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     QProcess proc;
     QStringList args;
     args << "-I" << qtIncludePath + "/QtCore"
@@ -891,10 +893,8 @@ void tst_Moc::forgottenQInterface()
     QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
     QCOMPARE(mocWarning, QString(SRCDIR) +
                 QString("/forgotten-qinterface.h:55: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
-#else
-    QSKIP("Only tested on linux/gcc", SkipAll);
-#endif
 }
+#endif
 
 void tst_Moc::os9Newline()
 {
@@ -955,12 +955,10 @@ void tst_Moc::escapesInStringLiterals()
              QByteArray("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nb"));
 }
 
+// Only tested on unix. Not tested when cross-compiled.
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS)
 void tst_Moc::frameworkSearchPath()
 {
-#ifdef MOC_CROSS_COMPILED
-    QSKIP("Not tested when cross-compiled", SkipAll);
-#endif
-#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS)
     QStringList args;
     args << "-F" << srcify(".")
          << srcify("interface-from-framework.h")
@@ -977,10 +975,8 @@ void tst_Moc::frameworkSearchPath()
     }
     QCOMPARE(proc.exitCode(), 0);
     QCOMPARE(proc.readAllStandardError(), QByteArray());
-#else
-    QSKIP("Only tested/relevant on unixy platforms", SkipAll);
-#endif
 }
+#endif
 
 void tst_Moc::cstyleEnums()
 {
@@ -993,12 +989,10 @@ void tst_Moc::cstyleEnums()
     QCOMPARE(metaEnum.key(1), "Bar");
 }
 
+// Only tested on linux/gcc. Not tested when cross-compiled.
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
 void tst_Moc::templateGtGt()
 {
-#ifdef MOC_CROSS_COMPILED
-    QSKIP("Not tested when cross-compiled", SkipAll);
-#endif
-#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     QProcess proc;
     proc.start("moc", QStringList(srcify("template-gtgt.h")));
     QVERIFY(proc.waitForFinished());
@@ -1007,14 +1001,13 @@ void tst_Moc::templateGtGt()
     QVERIFY(!mocOut.isEmpty());
     QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
     QVERIFY(mocWarning.isEmpty());
-#else
-    QSKIP("Only tested on linux/gcc", SkipAll);
-#endif
 }
+#endif
 
+// Only tested on linux/gcc.
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
 void tst_Moc::defineMacroViaCmdline()
 {
-#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     QProcess proc;
 
     QStringList args;
@@ -1027,10 +1020,8 @@ void tst_Moc::defineMacroViaCmdline()
     QCOMPARE(proc.readAllStandardError(), QByteArray());
     QByteArray mocOut = proc.readAllStandardOutput();
     QVERIFY(!mocOut.isEmpty());
-#else
-    QSKIP("Only tested on linux/gcc", SkipAll);
-#endif
 }
+#endif
 
 void tst_Moc::invokable()
 {
@@ -1147,12 +1138,10 @@ void tst_Moc::inlineSlotsWithThrowDeclaration()
     QVERIFY(mobj->indexOfSlot("e()") != -1);
 }
 
+// Only tested on linux/gcc. Not tested when cross-compiled.
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
 void tst_Moc::warnOnPropertyWithoutREAD()
 {
-#ifdef MOC_CROSS_COMPILED
-    QSKIP("Not tested when cross-compiled", SkipAll);
-#endif
-#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     QProcess proc;
     proc.start("moc", QStringList(srcify("warn-on-property-without-read.h")));
     QVERIFY(proc.waitForFinished());
@@ -1162,10 +1151,8 @@ void tst_Moc::warnOnPropertyWithoutREAD()
     QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
     QCOMPARE(mocWarning, QString(SRCDIR) +
                 QString("/warn-on-property-without-read.h:46: Warning: Property declaration foo has no READ accessor function. The property will be invalid.\n"));
-#else
-    QSKIP("Only tested on linux/gcc", SkipAll);
-#endif
 }
+#endif
 
 void tst_Moc::constructors()
 {
@@ -1257,13 +1244,10 @@ void tst_Moc::typenameWithUnsigned()
     QVERIFY(mobj->indexOfSlot("l(unsignedQImage)") != -1);
 }
 
-
+// Only tested on linux/gcc. Not tested when cross-compiled.
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
 void tst_Moc::warnOnVirtualSignal()
 {
-#ifdef MOC_CROSS_COMPILED
-    QSKIP("Not tested when cross-compiled", SkipAll);
-#endif
-#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     QProcess proc;
     proc.start("moc", QStringList(srcify("pure-virtual-signals.h")));
     QVERIFY(proc.waitForFinished());
@@ -1273,11 +1257,8 @@ void tst_Moc::warnOnVirtualSignal()
     QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
     QCOMPARE(mocWarning, QString(SRCDIR) + QString("/pure-virtual-signals.h:48: Warning: Signals cannot be declared virtual\n") +
                          QString(SRCDIR) + QString("/pure-virtual-signals.h:50: Warning: Signals cannot be declared virtual\n"));
-#else
-    QSKIP("Only tested on linux/gcc", SkipAll);
-#endif
 }
-
+#endif
 
 class QTBUG5590_DummyObject: public QObject
 {
@@ -1371,12 +1352,10 @@ void tst_Moc::QTBUG12260_defaultTemplate()
     QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doAnotherThing(bool,bool)") != -1);
 }
 
+// Only tested on linux/gcc. Not tested when cross-compiled.
+#if !defined(MOC_CROSS_COMPILED) && defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
 void tst_Moc::notifyError()
 {
-#ifdef MOC_CROSS_COMPILED
-    QSKIP("Not tested when cross-compiled", SkipAll);
-#endif
-#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
     QProcess proc;
     proc.start("moc", QStringList(srcify("error-on-wrong-notify.h")));
     QVERIFY(proc.waitForFinished());
@@ -1387,10 +1366,8 @@ void tst_Moc::notifyError()
     QString mocError = QString::fromLocal8Bit(proc.readAllStandardError());
     QCOMPARE(mocError, QString(SRCDIR) +
         QString("/error-on-wrong-notify.h:52: Error: NOTIFY signal 'fooChanged' of property 'foo' does not exist in class ClassWithWrongNOTIFY.\n"));
-#else
-    QSKIP("Only tested on linux/gcc", SkipAll);
-#endif
 }
+#endif
 
 class QTBUG_17635_InvokableAndProperty : public QObject
 {
@@ -1529,6 +1506,8 @@ void tst_Moc::revisions()
     revisions_T<VersionTestNotify>();
 }
 
+// Not tested when cross-compiled.
+#ifndef MOC_CROSS_COMPILED
 void tst_Moc::warnings_data()
 {
     QTest::addColumn<QByteArray>("input");
@@ -1612,10 +1591,6 @@ void tst_Moc::warnings_data()
 
 void tst_Moc::warnings()
 {
-#ifdef MOC_CROSS_COMPILED
-    QSKIP("Not tested when cross-compiled", SkipAll);
-#endif
-
     QFETCH(QByteArray, input);
     QFETCH(QStringList, args);
     QFETCH(int, exitCode);
@@ -1646,8 +1621,8 @@ void tst_Moc::warnings()
     if (expectedStdOut != "IGNORE_ALL_STDOUT")
         QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardOutput()).trimmed(), expectedStdOut);
     QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()).trimmed(), expectedStdErr);
-
-    }
+}
+#endif
 
 class tst_Moc::PrivateClass : public QObject {
     Q_PROPERTY(int someProperty READ someSlot WRITE someSlot2)
index 7b62b3d..5fd8793 100644 (file)
@@ -57,7 +57,9 @@ Q_OBJECT
 private slots:
     void getSetCheck();
     void interpretedAs0D() const;
+#ifndef QT_NO_EXCEPTIONS
     void exception();
+#endif
 };
 
 class MyXmlEntityResolver : public QXmlEntityResolver
@@ -214,9 +216,9 @@ void tst_QXml::interpretedAs0D() const
     QCOMPARE(myHandler.attrName, QChar(0x010D) + QString::fromLatin1("reated-by"));
 }
 
+#ifndef QT_NO_EXCEPTIONS
 void tst_QXml::exception()
 {
-#ifndef QT_NO_EXCEPTIONS
     QString message = QString::fromLatin1("message");
     int column = 3;
     int line = 2;
@@ -234,10 +236,8 @@ void tst_QXml::exception()
         QCOMPARE(e.publicId(), publicId);
         QCOMPARE(e.systemId(), systemId);
     }
-#else
-    QSKIP("Exceptions not available", SkipAll);
-#endif
 }
+#endif
 
 QTEST_MAIN(tst_QXml)
 #include "tst_qxml.moc"