From b942106bb661736264aec69961caecc35c814c09 Mon Sep 17 00:00:00 2001 From: Toby Tomkins Date: Tue, 7 Feb 2012 14:08:53 +1000 Subject: Remove SVG specific tests and testdata from QIcon. SVG support is now handled in QtSvg. Previously this test code would normally be skipped when testing qtbase. This code is only executed when testing qt5 with QtSvg enabled. This code will be moved to QtSvg. Task-number: QTBUG-22360 Change-Id: I7372012469f9c0f9b7d3851a0ae696f8f935ba10 Reviewed-by: Jason McDonald Reviewed-by: Rohan McGovern --- tests/auto/gui/image/qicon/tst_qicon.cpp | 88 -------------------------------- 1 file changed, 88 deletions(-) (limited to 'tests/auto/gui/image/qicon/tst_qicon.cpp') diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index 7d455f1010..4a9ab93921 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -58,13 +58,11 @@ private slots: void actualSize(); void actualSize2_data(); // test with 2 pixmaps with different aspect ratio void actualSize2(); - void svgActualSize(); void isNull(); void swap(); void bestMatch(); void cacheKey(); void detach(); - void svg(); void addFile(); void availableSizes(); void name(); @@ -181,28 +179,6 @@ void tst_QIcon::actualSize2() QCOMPARE(icon.pixmap(argument).size(), result); } -void tst_QIcon::svgActualSize() -{ - if (!haveImageFormat("svg")) { - QSKIP("SVG support is not available"); - } - - const QString prefix = QFileInfo(QFINDTESTDATA("icons")).absolutePath() + "/"; - QIcon icon(prefix + "rect.svg"); - QCOMPARE(icon.actualSize(QSize(16, 16)), QSize(16, 2)); - QCOMPARE(icon.pixmap(QSize(16, 16)).size(), QSize(16, 2)); - - QPixmap p(16, 16); - p.fill(Qt::cyan); - icon.addPixmap(p); - - QCOMPARE(icon.actualSize(QSize(16, 16)), QSize(16, 16)); - QCOMPARE(icon.pixmap(QSize(16, 16)).size(), QSize(16, 16)); - - QCOMPARE(icon.actualSize(QSize(16, 14)), QSize(16, 2)); - QCOMPARE(icon.pixmap(QSize(16, 14)).size(), QSize(16, 2)); -} - void tst_QIcon::isNull() { // test default constructor QIcon defaultConstructor; @@ -395,54 +371,6 @@ void tst_QIcon::detach() QVERIFY(img1 == img2); } -void tst_QIcon::svg() -{ - if (!haveImageFormat("svg")) { - QSKIP("SVG support is not available"); - } - QIcon icon1("heart.svg"); - - QVERIFY(!icon1.pixmap(32).isNull()); - QImage img1 = icon1.pixmap(32).toImage(); - QVERIFY(!icon1.pixmap(32, QIcon::Disabled).isNull()); - QImage img2 = icon1.pixmap(32, QIcon::Disabled).toImage(); - - icon1.addFile("trash.svg", QSize(), QIcon::Disabled); - QVERIFY(!icon1.pixmap(32, QIcon::Disabled).isNull()); - QImage img3 = icon1.pixmap(32, QIcon::Disabled).toImage(); - QVERIFY(img3 != img2); - QVERIFY(img3 != img1); - - QPixmap pm("image.png"); - icon1.addPixmap(pm, QIcon::Normal, QIcon::On); - QVERIFY(!icon1.pixmap(128, QIcon::Normal, QIcon::On).isNull()); - QImage img4 = icon1.pixmap(128, QIcon::Normal, QIcon::On).toImage(); - QVERIFY(img4 != img3); - QVERIFY(img4 != img2); - QVERIFY(img4 != img1); - - QIcon icon2; - icon2.addFile("heart.svg"); - QVERIFY(icon2.pixmap(57).toImage() == icon1.pixmap(57).toImage()); - - QIcon icon3("trash.svg"); - icon3.addFile("heart.svg"); - QVERIFY(icon3.pixmap(57).toImage() == icon1.pixmap(57).toImage()); - - QIcon icon4("heart.svg"); - icon4.addFile("image.png", QSize(), QIcon::Active); - QVERIFY(!icon4.pixmap(32).isNull()); - QVERIFY(!icon4.pixmap(32, QIcon::Active).isNull()); - QVERIFY(icon4.pixmap(32).toImage() == img1); - QIcon pmIcon(pm); - QVERIFY(icon4.pixmap(pm.size(), QIcon::Active).toImage() == pmIcon.pixmap(pm.size(), QIcon::Active).toImage()); - -#ifndef QT_NO_COMPRESS - QIcon icon5("heart.svgz"); - QVERIFY(!icon5.pixmap(32).isNull()); -#endif -} - void tst_QIcon::addFile() { QIcon icon; @@ -506,22 +434,6 @@ 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 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"); - icon.addFile("image.png", QSize(32,32)); - QList availableSizes = icon.availableSizes(); - QVERIFY(availableSizes.isEmpty()); - } - { // we try to load an icon from resources QIcon icon(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-open-16.png")); -- cgit v1.2.3