summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs
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/dialogs
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/dialogs')
-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
4 files changed, 31 insertions, 29 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
{