diff --git a/autotests/iconitemtest.cpp b/autotests/iconitemtest.cpp index ae825a970..b7c973750 100644 --- a/autotests/iconitemtest.cpp +++ b/autotests/iconitemtest.cpp @@ -355,5 +355,24 @@ void IconItemTest::qiconFromTheme() QCOMPARE(icon2, item2->property("source").value()); } +void IconItemTest::changeColorGroup() +{ + // Icon from Plasma theme + QQuickItem *item = createIconItem(); + item->setProperty("animated", false); + item->setProperty("source", "zoom-fit-height"); + Plasma::Svg *svg = item->findChild(); + // not using "breeze" theme as that one follows system color scheme + // and that one might not have a complementary group or a broken one + changeTheme(svg->theme(), "breeze-light"); + QSignalSpy spy(svg, SIGNAL(repaintNeeded())); + QVERIFY(spy.isValid()); + QImage img1 = grabImage(item); + item->setProperty("colorGroup", Plasma::Theme::ComplementaryColorGroup); + QTRY_VERIFY(spy.count() == 1); + QImage img2 = grabImage(item); + QVERIFY(img1 != img2); +} + QTEST_MAIN(IconItemTest) diff --git a/autotests/iconitemtest.h b/autotests/iconitemtest.h index c7ba89f98..47eb445e7 100644 --- a/autotests/iconitemtest.h +++ b/autotests/iconitemtest.h @@ -49,6 +49,7 @@ private Q_SLOTS: void loadSvg(); void themeChange(); void qiconFromTheme(); + void changeColorGroup(); private: QQuickItem *createIconItem(); diff --git a/src/declarativeimports/core/iconitem.cpp b/src/declarativeimports/core/iconitem.cpp index 6c23a7efb..0d6fd1486 100644 --- a/src/declarativeimports/core/iconitem.cpp +++ b/src/declarativeimports/core/iconitem.cpp @@ -195,7 +195,6 @@ void IconItem::setColorGroup(Plasma::Theme::ColorGroup group) if (m_svgIcon) { m_svgIcon->setColorGroup(group); - loadPixmap(); } emit colorGroupChanged();