From 8284740cdf341327c342ce9693c3768e954128e0 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 13 Jul 2022 15:24:19 +0000 Subject: [PATCH] InputMethodTest: Only create the windowAddedSpy when actually needed We don't really care about the window showing up until we're calling showInputPanel, but since Workspace::windowAdded is triggered for any window that gets added, the test sometimes fails because count() is 2 instead of 1. To avoid that, only create the spy when it's actually relevant instead of all the way at the start before any other setup is done. --- autotests/integration/inputmethod_test.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/autotests/integration/inputmethod_test.cpp b/autotests/integration/inputmethod_test.cpp index f9217311ed..d25bdf2f6d 100644 --- a/autotests/integration/inputmethod_test.cpp +++ b/autotests/integration/inputmethod_test.cpp @@ -201,7 +201,6 @@ void InputMethodTest::testEnableActive() { QVERIFY(!InputMethod::self()->isActive()); - QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded); QSignalSpy windowRemovedSpy(workspace(), &Workspace::windowRemoved); QSignalSpy activateSpy(InputMethod::self(), &InputMethod::activeChanged); @@ -223,9 +222,9 @@ void InputMethodTest::testEnableActive() QVERIFY(!textInput.isNull()); textInput->enable(surface.data()); QVERIFY(surfaceConfigureRequestedSpy.wait()); - QCOMPARE(windowAddedSpy.count(), 1); // Show the keyboard + QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded); textInput->showInputPanel(); QVERIFY(windowAddedSpy.wait());