autotests: Fix TestPluginEffectLoader

PluginEffectLoader was changed so that it queries and loads all effects
immediately.
master
Vlad Zahorodnii 3 years ago
parent dcd9a7b9ea
commit 57f8faeb41

@ -51,7 +51,6 @@ private Q_SLOTS:
void testLoadPluginEffect_data();
void testLoadPluginEffect();
void testLoadAllEffects();
void testCancelLoadAllEffects();
};
void TestPluginEffectLoader::testHasEffect_data()
@ -355,21 +354,15 @@ void TestPluginEffectLoader::testLoadAllEffects()
// the config is prepared so that no Effect gets loaded!
loader.queryAndLoadAll();
// we need to wait some time because it's queued and in a thread
QVERIFY(!spy.wait(100));
QCOMPARE(spy.size(), 0);
// now let's prepare a config which has one effect explicitly enabled
plugins.writeEntry(QStringLiteral("fakeeffectpluginEnabled"), true);
plugins.sync();
loader.queryAndLoadAll();
// should load one effect in first go
QVERIFY(spy.wait(100));
// and afterwards it should not load another one
QVERIFY(!spy.wait(10));
QCOMPARE(spy.size(), 1);
// if we caught a signal it should have the effect name we passed in
QList<QVariant> arguments = spy.takeFirst();
QCOMPARE(arguments.count(), 2);
@ -377,32 +370,5 @@ void TestPluginEffectLoader::testLoadAllEffects()
spy.clear();
}
void TestPluginEffectLoader::testCancelLoadAllEffects()
{
// this test verifies that no test gets loaded when the loader gets cleared
MockEffectsHandler mockHandler(KWin::OpenGLCompositing);
KWin::PluginEffectLoader loader;
loader.setPluginSubDirectory(QString());
// prepare the configuration to hard enable/disable the effects we want to load
KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
KConfigGroup plugins = config->group("Plugins");
plugins.writeEntry(QStringLiteral("fakeeffectpluginEnabled"), true);
plugins.sync();
loader.setConfig(config);
qRegisterMetaType<KWin::Effect*>();
QSignalSpy spy(&loader, &KWin::PluginEffectLoader::effectLoaded);
QVERIFY(spy.isValid());
loader.queryAndLoadAll();
loader.clear();
// Should not load any effect
QVERIFY(!spy.wait(100));
QVERIFY(spy.isEmpty());
}
QTEST_MAIN(TestPluginEffectLoader)
#include "test_plugin_effectloader.moc"

Loading…
Cancel
Save