From b660f2141c1820cb460cac441ab16a940605b09d 2012-09-14 09:21:27 From: Marek Rosa Date: 2012-09-14 09:21:27 Subject: [PATCH] Qt5: declarative fix part4 - re-enabled tests - fixed the include files in tests folder - fixed QSKIP macro in tests --- diff --git a/charts.pro b/charts.pro index b4f89c5..cddbe0b 100644 --- a/charts.pro +++ b/charts.pro @@ -3,8 +3,7 @@ } TEMPLATE = subdirs -SUBDIRS = src plugins demos examples -# tests +SUBDIRS = src plugins demos examples tests development_build: message('Development build') diff --git a/tests/auto/auto.pri b/tests/auto/auto.pri index 424c8cd..70e05bc 100644 --- a/tests/auto/auto.pri +++ b/tests/auto/auto.pri @@ -3,7 +3,7 @@ } greaterThan(QT_MAJOR_VERSION, 4) { - QT += testlib + QT += testlib widgets } else { CONFIG += qtestlib } diff --git a/tests/auto/chartdataset/tst_chartdataset.cpp b/tests/auto/chartdataset/tst_chartdataset.cpp index c7229f6..4cc7259 100644 --- a/tests/auto/chartdataset/tst_chartdataset.cpp +++ b/tests/auto/chartdataset/tst_chartdataset.cpp @@ -31,7 +31,11 @@ private Q_SLOTS: void tst_ChartDataSet::skip() { +#ifdef QT5_QUICK_1 + QSKIP("This test requires the debug version of library"); +#else QSKIP("This test requires the debug version of library", SkipAll); +#endif } QTEST_MAIN(tst_ChartDataSet) diff --git a/tests/auto/domain/tst_domain.cpp b/tests/auto/domain/tst_domain.cpp index 544f97b..e4cfbab 100644 --- a/tests/auto/domain/tst_domain.cpp +++ b/tests/auto/domain/tst_domain.cpp @@ -32,7 +32,11 @@ private Q_SLOTS: void tst_Domain::skip() { +#ifdef QT5_QUICK_1 + QSKIP("This test requires the debug version of library"); +#else QSKIP("This test requires the debug version of library", SkipAll); +#endif } QTEST_MAIN(tst_Domain) diff --git a/tests/auto/qabstractaxis/tst_qabstractaxis.cpp b/tests/auto/qabstractaxis/tst_qabstractaxis.cpp index fa7744c..2979483 100644 --- a/tests/auto/qabstractaxis/tst_qabstractaxis.cpp +++ b/tests/auto/qabstractaxis/tst_qabstractaxis.cpp @@ -139,7 +139,11 @@ void tst_QAbstractAxis::axisPenColor_data() void tst_QAbstractAxis::axisPenColor() { +#ifdef QT5_QUICK_1 + QSKIP("Test is not implemented. This is depreciated function"); +#else QSKIP("Test is not implemented. This is depreciated function", SkipAll); +#endif } void tst_QAbstractAxis::gridLinePen_data() @@ -404,7 +408,11 @@ void tst_QAbstractAxis::labelsColor_data() void tst_QAbstractAxis::labelsColor() { +#ifdef QT5_QUICK_1 + QSKIP("Test is not implemented. This is depreciated function"); +#else QSKIP("Test is not implemented. This is depreciated function", SkipAll); +#endif } void tst_QAbstractAxis::labelsFont_data() @@ -629,7 +637,11 @@ void tst_QAbstractAxis::shadesBorderColor_data() void tst_QAbstractAxis::shadesBorderColor() { +#ifdef QT5_QUICK_1 + QSKIP("Test is not implemented. This is depreciated function"); +#else QSKIP("Test is not implemented. This is depreciated function", SkipAll); +#endif } void tst_QAbstractAxis::shadesBrush_data() @@ -679,7 +691,11 @@ void tst_QAbstractAxis::shadesColor_data() // public QColor shadesColor() const void tst_QAbstractAxis::shadesColor() { +#ifdef QT5_QUICK_1 + QSKIP("Test is not implemented. This is depreciated function"); +#else QSKIP("Test is not implemented. This is depreciated function", SkipAll); +#endif } void tst_QAbstractAxis::shadesPen_data() diff --git a/tests/qmlchartaxis/main.cpp b/tests/qmlchartaxis/main.cpp index 3af10b6..992a119 100644 --- a/tests/qmlchartaxis/main.cpp +++ b/tests/qmlchartaxis/main.cpp @@ -27,7 +27,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) QScopedPointer app(createApplication(argc, argv)); QScopedPointer viewer(QmlApplicationViewer::create()); - viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer->setSource(QUrl("qrc:/qml/qmlchartaxis/main.qml")); viewer->showExpanded(); diff --git a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp b/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp index 6d37b0b..05ba5a3 100644 --- a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -12,9 +12,15 @@ #include #include -#include -#include -#include +#ifdef QT5_QUICK_1 + #include + #include + #include +#else + #include + #include + #include +#endif #include #include // MEEGO_EDITION_HARMATTAN @@ -136,48 +142,48 @@ void QmlApplicationViewer::addImportPath(const QString &path) d->view->engine()->addImportPath(d->adjustPath(path)); } -void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) -{ -#if defined(Q_OS_SYMBIAN) - // If the version of Qt on the device is < 4.7.2, that attribute won't work - if (orientation != ScreenOrientationAuto) { - const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); - if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { - qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); - return; - } - } -#endif // Q_OS_SYMBIAN - - Qt::WidgetAttribute attribute; - switch (orientation) { -#if QT_VERSION < 0x040702 - // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes - case ScreenOrientationLockPortrait: - attribute = static_cast(128); - break; - case ScreenOrientationLockLandscape: - attribute = static_cast(129); - break; - default: - case ScreenOrientationAuto: - attribute = static_cast(130); - break; -#else // QT_VERSION < 0x040702 - case ScreenOrientationLockPortrait: - attribute = Qt::WA_LockPortraitOrientation; - break; - case ScreenOrientationLockLandscape: - attribute = Qt::WA_LockLandscapeOrientation; - break; - default: - case ScreenOrientationAuto: - attribute = Qt::WA_AutoOrientation; - break; -#endif // QT_VERSION < 0x040702 - }; - setAttribute(attribute, true); -} +//void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +//{ +//#if defined(Q_OS_SYMBIAN) +// // If the version of Qt on the device is < 4.7.2, that attribute won't work +// if (orientation != ScreenOrientationAuto) { +// const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); +// if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { +// qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); +// return; +// } +// } +//#endif // Q_OS_SYMBIAN + +// Qt::WidgetAttribute attribute; +// switch (orientation) { +//#if QT_VERSION < 0x040702 +// // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes +// case ScreenOrientationLockPortrait: +// attribute = static_cast(128); +// break; +// case ScreenOrientationLockLandscape: +// attribute = static_cast(129); +// break; +// default: +// case ScreenOrientationAuto: +// attribute = static_cast(130); +// break; +//#else // QT_VERSION < 0x040702 +// case ScreenOrientationLockPortrait: +// attribute = Qt::WA_LockPortraitOrientation; +// break; +// case ScreenOrientationLockLandscape: +// attribute = Qt::WA_LockLandscapeOrientation; +// break; +// default: +// case ScreenOrientationAuto: +// attribute = Qt::WA_AutoOrientation; +// break; +//#endif // QT_VERSION < 0x040702 +// }; +// setAttribute(attribute, true); +//} void QmlApplicationViewer::showExpanded() { diff --git a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h b/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h index f8008f5..7f85658 100644 --- a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h +++ b/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h @@ -11,7 +11,11 @@ #ifndef QMLAPPLICATIONVIEWER_H #define QMLAPPLICATIONVIEWER_H -#include +#ifdef QT5_QUICK_1 + #include +#else + #include +#endif class QmlApplicationViewer : public QDeclarativeView { @@ -33,7 +37,7 @@ public: void addImportPath(const QString &path); // Note that this will only have an effect on Symbian and Fremantle. - void setOrientation(ScreenOrientation orientation); + // void setOrientation(ScreenOrientation orientation); void showExpanded(); diff --git a/tests/qmlchartproperties/main.cpp b/tests/qmlchartproperties/main.cpp index 3737597..352dd7b 100644 --- a/tests/qmlchartproperties/main.cpp +++ b/tests/qmlchartproperties/main.cpp @@ -27,7 +27,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) QScopedPointer app(createApplication(argc, argv)); QScopedPointer viewer(QmlApplicationViewer::create()); - viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer->setSource(QUrl("qrc:/qml/qmlchartproperties/loader.qml")); viewer->setRenderHint(QPainter::Antialiasing, true); viewer->showExpanded(); diff --git a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp b/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp index 6d37b0b..05ba5a3 100644 --- a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -12,9 +12,15 @@ #include #include -#include -#include -#include +#ifdef QT5_QUICK_1 + #include + #include + #include +#else + #include + #include + #include +#endif #include #include // MEEGO_EDITION_HARMATTAN @@ -136,48 +142,48 @@ void QmlApplicationViewer::addImportPath(const QString &path) d->view->engine()->addImportPath(d->adjustPath(path)); } -void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) -{ -#if defined(Q_OS_SYMBIAN) - // If the version of Qt on the device is < 4.7.2, that attribute won't work - if (orientation != ScreenOrientationAuto) { - const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); - if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { - qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); - return; - } - } -#endif // Q_OS_SYMBIAN - - Qt::WidgetAttribute attribute; - switch (orientation) { -#if QT_VERSION < 0x040702 - // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes - case ScreenOrientationLockPortrait: - attribute = static_cast(128); - break; - case ScreenOrientationLockLandscape: - attribute = static_cast(129); - break; - default: - case ScreenOrientationAuto: - attribute = static_cast(130); - break; -#else // QT_VERSION < 0x040702 - case ScreenOrientationLockPortrait: - attribute = Qt::WA_LockPortraitOrientation; - break; - case ScreenOrientationLockLandscape: - attribute = Qt::WA_LockLandscapeOrientation; - break; - default: - case ScreenOrientationAuto: - attribute = Qt::WA_AutoOrientation; - break; -#endif // QT_VERSION < 0x040702 - }; - setAttribute(attribute, true); -} +//void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +//{ +//#if defined(Q_OS_SYMBIAN) +// // If the version of Qt on the device is < 4.7.2, that attribute won't work +// if (orientation != ScreenOrientationAuto) { +// const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); +// if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { +// qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); +// return; +// } +// } +//#endif // Q_OS_SYMBIAN + +// Qt::WidgetAttribute attribute; +// switch (orientation) { +//#if QT_VERSION < 0x040702 +// // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes +// case ScreenOrientationLockPortrait: +// attribute = static_cast(128); +// break; +// case ScreenOrientationLockLandscape: +// attribute = static_cast(129); +// break; +// default: +// case ScreenOrientationAuto: +// attribute = static_cast(130); +// break; +//#else // QT_VERSION < 0x040702 +// case ScreenOrientationLockPortrait: +// attribute = Qt::WA_LockPortraitOrientation; +// break; +// case ScreenOrientationLockLandscape: +// attribute = Qt::WA_LockLandscapeOrientation; +// break; +// default: +// case ScreenOrientationAuto: +// attribute = Qt::WA_AutoOrientation; +// break; +//#endif // QT_VERSION < 0x040702 +// }; +// setAttribute(attribute, true); +//} void QmlApplicationViewer::showExpanded() { diff --git a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h b/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h index f8008f5..7f85658 100644 --- a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h +++ b/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h @@ -11,7 +11,11 @@ #ifndef QMLAPPLICATIONVIEWER_H #define QMLAPPLICATIONVIEWER_H -#include +#ifdef QT5_QUICK_1 + #include +#else + #include +#endif class QmlApplicationViewer : public QDeclarativeView { @@ -33,7 +37,7 @@ public: void addImportPath(const QString &path); // Note that this will only have an effect on Symbian and Fremantle. - void setOrientation(ScreenOrientation orientation); + // void setOrientation(ScreenOrientation orientation); void showExpanded();