force icon themes explicitly via new testing helper function

REVIEW: 127954
This commit is contained in:
Harald Sitter 2016-05-18 13:50:11 +02:00
parent 4883c580f9
commit 6ad988cb3d
2 changed files with 3 additions and 13 deletions

View File

@ -73,13 +73,7 @@ void IconItemTest::initTestCase()
QIcon::setThemeSearchPaths({QFINDTESTDATA("data/icons")});
QIcon::setThemeName("test-theme");
KConfigGroup cg(KSharedConfig::openConfig(), "Icons");
cg.writeEntry("Theme", "test-theme");
KConfigGroup plasmaConfig(KSharedConfig::openConfig("plasmarc"), "Theme");
plasmaConfig.writeEntry("name", "default");
cg.sync(); // sync explicitly so it will be correctly parsed
KSharedConfig::openConfig()->reparseConfiguration();
KIconTheme::forceThemeForTests("test-theme");
KIconTheme::reconfigure();
KIconLoader::global()->reconfigure(QString());

View File

@ -47,13 +47,11 @@ void ThemeTest::initTestCase()
QIcon::setThemeSearchPaths(QStringList()<<QFINDTESTDATA("data/icons"));
KConfigGroup cg(KSharedConfig::openConfig("kdeglobals"), "Icons");
cg.writeEntry("Theme", "test-theme");
KConfigGroup plasmaConfig(KSharedConfig::openConfig("plasmarc"), "Theme");
plasmaConfig.writeEntry("name", "default");
m_svg = new Plasma::Svg();
cg.sync(); // sync explicitly so it will be correctly parsed
KIconTheme::forceThemeForTests("test-theme");
KSharedConfig::openConfig()->reparseConfiguration();
KIconTheme::reconfigure();
KIconLoader::global()->reconfigure(QString());
@ -89,9 +87,7 @@ void ThemeTest::loadSvgIcon()
QSignalSpy spy(m_svg, SIGNAL(repaintNeeded()));
QVERIFY(spy.isValid());
KConfigGroup cg(KSharedConfig::openConfig("kdeglobals"), "Icons");
cg.writeEntry("Theme", "test-theme-two");
cg.sync();
KIconTheme::forceThemeForTests("test-theme-two");
// KIconloader needs changesto be emitted manually, ouch.
for (int i=0; i < KIconLoader::LastGroup; i++) {
KIconLoader::emitChange(KIconLoader::Group(i));