diff options
3 files changed, 42 insertions, 91 deletions
diff --git a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp index a3d5f10120..508d0ea628 100644 --- a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp +++ b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp @@ -63,22 +63,14 @@ QT_FORWARD_DECLARE_CLASS(QPrinter) //TESTED_CLASS= //TESTED_FILES= -#ifndef QT_NO_PRINTER - class tst_QPrinter : public QObject { Q_OBJECT -public: - tst_QPrinter(); - virtual ~tst_QPrinter(); - - +#ifdef QT_NO_PRINTER public slots: void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); +#else private slots: void getSetCheck(); // Add your testfunctions and testdata create functions here @@ -113,8 +105,17 @@ private slots: void taskQTBUG4497_reusePrinterOnDifferentFiles(); void testPdfTitle(); +#endif }; +#ifdef QT_NO_PRINTER +void tst_QPrinter::initTestCase() +{ + QSKIP("This test requires printing support", SkipAll); +} + +#else + // Testing get/set functions void tst_QPrinter::getSetCheck() { @@ -211,47 +212,6 @@ void tst_QPrinter::getSetCheck() QCOMPARE(QPrinter::PrintRange(QPrinter::PageRange), obj1.printRange()); } -tst_QPrinter::tst_QPrinter() -{ -} - -tst_QPrinter::~tst_QPrinter() -{ -} - -// initTestCase will be executed once before the first testfunction is executed. -void tst_QPrinter::initTestCase() -{ -// TODO: Add testcase generic initialization code here. -// suggestion: -// testWidget = new QPrinter(0,"testWidget"); -// testWidget->setFixedSize(200, 200); -// qApp->setMainWidget(testWidget); -// testWidget->show(); -} - -// cleanupTestCase will be executed once after the last testfunction is executed. -void tst_QPrinter::cleanupTestCase() -{ -// TODO: Add testcase generic cleanup code here. -// suggestion: -// testWidget->hide(); -// qApp->setMainWidget(0); -// delete testWidget; -} - -// init() will be executed immediately before each testfunction is run. -void tst_QPrinter::init() -{ -// TODO: Add testfunction specific initialization code here. -} - -// cleanup() will be executed immediately after each testfunction is run. -void tst_QPrinter::cleanup() -{ -// TODO: Add testfunction specific cleanup code here. -} - #define MYCOMPARE(a, b) QCOMPARE(QVariant((int)a), QVariant((int)b)) void tst_QPrinter::testPageSetupDialog() @@ -1033,11 +993,7 @@ void tst_QPrinter::testPdfTitle() QVERIFY(file.readAll().contains(QByteArray(expected, 26))); } +#endif + QTEST_MAIN(tst_QPrinter) #include "tst_qprinter.moc" - -#else //QT_NO_PRINTER - -QTEST_NOOP_MAIN - -#endif //QT_NO_PRINTER diff --git a/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp index f4579cfd79..297664978e 100644 --- a/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp +++ b/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp @@ -44,8 +44,6 @@ #include <QtGlobal> #include <QtAlgorithms> #include <QtNetwork/QHostInfo> - -#ifndef QT_NO_PRINTER #include <qprinterinfo.h> #ifdef Q_OS_UNIX @@ -63,16 +61,10 @@ class tst_QPrinterInfo : public QObject { Q_OBJECT -public: - //tst_QPrinterInfo(); - //virtual ~tst_QPrinterInfo(); - - +#ifdef QT_NO_PRINTER public slots: - //void initTestCase(); - //void cleanupTestCase(); - //void init(); - //void cleanup(); + void initTestCase(); +#else private slots: #if defined(Q_OS_UNIX) || defined(Q_OS_WIN32) void testForDefaultPrinter(); @@ -88,8 +80,17 @@ private: QStringList getPrintersFromSystem(); QString getOutputFromCommand(const QStringList& command); +#endif }; +#ifdef QT_NO_PRINTER +void tst_QPrinterInfo::initTestCase() +{ + QSKIP("This test requires printing support", SkipAll); +} + +#else + void tst_QPrinterInfo::macFixNameFormat(QString *printerName) { // Modify the format of the printer name to match Qt, lpstat returns @@ -386,8 +387,7 @@ void tst_QPrinterInfo::testAssignment() } } +#endif + QTEST_MAIN(tst_QPrinterInfo) #include "tst_qprinterinfo.moc" -#else -QTEST_NOOP_MAIN -#endif diff --git a/tests/auto/qabstractprintdialog/tst_qabstractprintdialog.cpp b/tests/auto/qabstractprintdialog/tst_qabstractprintdialog.cpp index a72b12efcf..5d6165d174 100644 --- a/tests/auto/qabstractprintdialog/tst_qabstractprintdialog.cpp +++ b/tests/auto/qabstractprintdialog/tst_qabstractprintdialog.cpp @@ -50,22 +50,29 @@ //TESTED_CLASS= //TESTED_FILES= -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) - class tst_QAbstractPrintDialog : public QObject { Q_OBJECT -public: - tst_QAbstractPrintDialog(); - virtual ~tst_QAbstractPrintDialog(); - +#if defined(QT_NO_PRINTER) || defined(QT_NO_PRINTDIALOG) +public slots: + void initTestCase(); +#else private slots: void getSetCheck(); void setMinMax(); void setFromTo(); +#endif }; +#if defined(QT_NO_PRINTER) || defined(QT_NO_PRINTDIALOG) +void tst_QAbstractPrintDialog::initTestCase() +{ + QSKIP("This test requires printing and print dialog support", SkipAll); +} + +#else + class MyAbstractPrintDialog : public QAbstractPrintDialog { public: @@ -73,14 +80,6 @@ public: int exec() { return 0; } }; -tst_QAbstractPrintDialog::tst_QAbstractPrintDialog() -{ -} - -tst_QAbstractPrintDialog::~tst_QAbstractPrintDialog() -{ -} - // Testing get/set functions void tst_QAbstractPrintDialog::getSetCheck() { @@ -141,11 +140,7 @@ void tst_QAbstractPrintDialog::setFromTo() QCOMPARE(obj1.maxPage(), 50); } +#endif + QTEST_MAIN(tst_QAbstractPrintDialog) #include "tst_qabstractprintdialog.moc" - -#else - -QTEST_NOOP_MAIN - -#endif |