Loading
  1. From 26ad598b03776ebaca429af4ea0cc6a38631d8dc Mon Sep 17 00:00:00 2001
  2. From: Vlad Zagorodniy <vladzzag@gmail.com>
  3. Date: Thu, 6 Dec 2018 12:05:08 +0200
  4. Subject: [PATCH] [autotests] Fix failing of
  5.  testDontCrashReinitializeCompositor
  6.  
  7. ---
  8. .../dont_crash_reinitialize_compositor.cpp    | 24 +++++++++++++++----
  9.  1 file changed, 20 insertions(+), 4 deletions(-)
  10.  
  11. diff --git a/autotests/integration/dont_crash_reinitialize_compositor.cpp b/autotests/integration/dont_crash_reinitialize_compositor.cpp
  12. index f09e2705c..9e31ccd47 100644
  13. --- a/autotests/integration/dont_crash_reinitialize_compositor.cpp
  14. +++ b/autotests/integration/dont_crash_reinitialize_compositor.cpp
  15. @@ -23,6 +23,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16.  #include "abstract_client.h"
  17.  #include "composite.h"
  18.  #include "deleted.h"
  19. +#include "effectloader.h"
  20.  #include "effects.h"
  21.  #include "platform.h"
  22.  #include "screens.h"
  23. @@ -30,6 +31,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  24.  #include "wayland_server.h"
  25.  #include "workspace.h"
  26.  
  27. +#include "effect_builtins.h"
  28. +
  29.  #include <KWayland/Client/surface.h>
  30.  #include <KWayland/Client/xdgshell.h>
  31.  
  32. @@ -64,6 +67,16 @@ void DontCrashReinitializeCompositorTest::initTestCase()
  33.      QMetaObject::invokeMethod(kwinApp()->platform(), "setVirtualOutputs", Qt::DirectConnection, Q_ARG(int, 2));
  34.      QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
  35.  
  36. +    auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
  37. +    KConfigGroup plugins(config, QStringLiteral("Plugins"));
  38. +    ScriptedEffectLoader loader;
  39. +    const auto builtinNames = BuiltInEffects::availableEffectNames() << loader.listOfKnownEffects();
  40. +    for (const QString &name : builtinNames) {
  41. +        plugins.writeEntry(name + QStringLiteral("Enabled"), false);
  42. +    }
  43. +    config->sync();
  44. +    kwinApp()->setConfig(config);
  45. +
  46.      qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
  47.      qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
  48.  
  49. @@ -83,6 +96,13 @@ void DontCrashReinitializeCompositorTest::init()
  50.  void DontCrashReinitializeCompositorTest::cleanup()
  51.  {
  52.      Test::destroyWaylandConnection();
  53. +
  54. +    // Unload all effects.
  55. +    auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
  56. +    QVERIFY(effectsImpl);
  57. +    effectsImpl->unloadAllEffects();
  58. +    QVERIFY(effectsImpl->loadedEffects().isEmpty());
  59. +
  60.  }
  61.  
  62.  void DontCrashReinitializeCompositorTest::testReinitializeCompositor_data()
  63. @@ -104,10 +124,6 @@ void DontCrashReinitializeCompositorTest::testReinitializeCompositor()
  64.      auto effectsImpl = qobject_cast<EffectsHandlerImpl *>(effects);
  65.      QVERIFY(effectsImpl);
  66.  
  67. -    // Unload all effects.
  68. -    effectsImpl->unloadAllEffects();
  69. -    QVERIFY(effectsImpl->loadedEffects().isEmpty());
  70. -
  71.      // Create the test client.
  72.      using namespace KWayland::Client;
  73.  
  74. --
  75. 2.19.2

Comments