From 57f8faeb415e6af05dd14142d83c0194d4d4789a Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 29 Nov 2021 10:29:51 +0200 Subject: [PATCH] autotests: Fix TestPluginEffectLoader PluginEffectLoader was changed so that it queries and loads all effects immediately. --- autotests/test_plugin_effectloader.cpp | 38 ++------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/autotests/test_plugin_effectloader.cpp b/autotests/test_plugin_effectloader.cpp index c4212c2429..e3dc59ba4e 100644 --- a/autotests/test_plugin_effectloader.cpp +++ b/autotests/test_plugin_effectloader.cpp @@ -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 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(); - 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"