diff --git a/autotests/iconitemtest.cpp b/autotests/iconitemtest.cpp index 246f8c4d8..8d3f494a1 100644 --- a/autotests/iconitemtest.cpp +++ b/autotests/iconitemtest.cpp @@ -127,6 +127,33 @@ void IconItemTest::changeTheme(Plasma::Theme *theme, const QString &themeName) } // ------ Tests + +void IconItemTest::loadPixmap() +{ + QScopedPointer item(createIconItem()); + QPixmap sourcePixmap(QFINDTESTDATA("data/test_image.png")); + + item->setProperty("source", sourcePixmap); + QVERIFY(item->property("valid").toBool()); + + QImage capture = grabImage(item.data()); + QCOMPARE(capture, sourcePixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied)); +} + +//tests setting icon from a QImage +void IconItemTest::loadImage() +{ + QScopedPointer item(createIconItem()); + QImage sourceImage(QFINDTESTDATA("data/test_image.png")); + + item->setProperty("source", sourceImage); + QVERIFY(item->property("valid").toBool()); + + QImage capture = grabImage(item.data()); + QCOMPARE(capture, sourceImage.convertToFormat(QImage::Format_ARGB32_Premultiplied)); +} + + void IconItemTest::invalidIcon() { QString name("tst-plasma-framework-invalid-icon-name"); diff --git a/autotests/iconitemtest.h b/autotests/iconitemtest.h index b1cfb4ba2..2de85123a 100644 --- a/autotests/iconitemtest.h +++ b/autotests/iconitemtest.h @@ -37,6 +37,9 @@ private Q_SLOTS: void initTestCase(); void cleanup(); + void loadPixmap(); + void loadImage(); + void invalidIcon(); void usesPlasmaTheme(); void animation();