diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-08-01 16:44:09 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-08-02 07:37:21 +0200 |
commit | c07e1130d9fbfec2aeda2248341858b12a99fb93 (patch) | |
tree | 5934035b4779f59e4ffcfbd65e96a56bfe8b867c | |
parent | 569cd194d20e61d35768b210b4351f4eeb5c1ef8 (diff) |
test: fixed failure of tst_qicon
This test unconditionally assumed that SVG support was available.
This is an invalid circular dependency: the test is in qtbase and
depends on qtsvg, which depends on qtbase.
Change the test so that it uses SVG support only if available.
Change-Id: Ia63ce74abdecd4bcf7a4e0714b8cb7c488e17495
Reviewed-on: http://codereview.qt.nokia.com/2426
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
-rw-r--r-- | tests/auto/qicon/qicon.pro | 2 | ||||
-rw-r--r-- | tests/auto/qicon/tst_qicon.cpp | 20 |
2 files changed, 17 insertions, 5 deletions
diff --git a/tests/auto/qicon/qicon.pro b/tests/auto/qicon/qicon.pro index 21d967b978..77a9b91032 100644 --- a/tests/auto/qicon/qicon.pro +++ b/tests/auto/qicon/qicon.pro @@ -27,5 +27,3 @@ wince* { } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } - -CONFIG+=insignificant_test diff --git a/tests/auto/qicon/tst_qicon.cpp b/tests/auto/qicon/tst_qicon.cpp index cd3f84f4b0..4c430f9435 100644 --- a/tests/auto/qicon/tst_qicon.cpp +++ b/tests/auto/qicon/tst_qicon.cpp @@ -41,7 +41,7 @@ #include <QtTest/QtTest> - +#include <QImageReader> #include <qicon.h> #if defined(Q_OS_SYMBIAN) @@ -87,6 +87,8 @@ private slots: void task239461_custom_iconengine_crash(); private: + bool haveImageFormat(QByteArray const&); + QString oldCurrentDir; const static QIcon staticIcon; @@ -112,6 +114,11 @@ void tst_QIcon::cleanup() } } +bool tst_QIcon::haveImageFormat(QByteArray const& desiredFormat) +{ + return QImageReader::supportedImageFormats().contains(desiredFormat); +} + tst_QIcon::tst_QIcon() { } @@ -205,6 +212,10 @@ void tst_QIcon::actualSize2() void tst_QIcon::svgActualSize() { + if (!haveImageFormat("svg")) { + QSKIP("SVG support is not available", SkipAll); + } + const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/"); QIcon icon(prefix + "rect.svg"); QCOMPARE(icon.actualSize(QSize(16, 16)), QSize(16, 2)); @@ -415,6 +426,9 @@ void tst_QIcon::detach() void tst_QIcon::svg() { + if (!haveImageFormat("svg")) { + QSKIP("SVG support is not available", SkipAll); + } QIcon icon1("heart.svg"); QVERIFY(!icon1.pixmap(32).isNull()); @@ -521,14 +535,14 @@ void tst_QIcon::availableSizes() QCOMPARE(availableSizes.at(0), QSize(16,16)); } - { + if (haveImageFormat("svg")) { // checks that there are no availableSizes for scalable images. QIcon icon("heart.svg"); QList<QSize> availableSizes = icon.availableSizes(); QVERIFY(availableSizes.isEmpty()); } - { + if (haveImageFormat("svg")) { // even if an a scalable image contain added pixmaps, // availableSizes still should be empty. QIcon icon("heart.svg"); |