From 18763d14830ef447d844115bb016f030a2f42a1f Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Wed, 22 Jun 2022 09:33:18 -0700 Subject: [PATCH] Fix flaky testTextInputV3Interface In a74c4361564217919437986feb91a3f85c5a5c33, we changed behavior that every commit() will be followed by a done(), which makes this test might catch a different done() from server. Change the spy to make sure it exhaust all other done before checking the one expected. --- src/wayland/autotests/server/test_textinputv3_interface.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wayland/autotests/server/test_textinputv3_interface.cpp b/src/wayland/autotests/server/test_textinputv3_interface.cpp index bb6bbf2ec8..463f5140f0 100644 --- a/src/wayland/autotests/server/test_textinputv3_interface.cpp +++ b/src/wayland/autotests/server/test_textinputv3_interface.cpp @@ -557,6 +557,7 @@ void TestTextInputV3Interface::testMultipleTextinputs() QVERIFY(m_serverTextInputV3); QVERIFY(!m_serverTextInputV3->isEnabled()); + QSignalSpy doneSpy1(ti1, &TextInputV3::done); QSignalSpy committedSpy(m_serverTextInputV3, &TextInputV3Interface::stateCommitted); // Enable ti1 ti1->enable(); @@ -564,6 +565,7 @@ void TestTextInputV3Interface::testMultipleTextinputs() QVERIFY(committedSpy.wait()); QCOMPARE(committedSpy.last().at(0).value(), 1); QVERIFY(m_serverTextInputV3->isEnabled()); + QVERIFY(doneSpy1.wait()); // Send another three commits on ti1 ti1->enable(); @@ -572,6 +574,7 @@ void TestTextInputV3Interface::testMultipleTextinputs() QVERIFY(committedSpy.wait()); QCOMPARE(committedSpy.last().at(0).value(), 2); QVERIFY(m_serverTextInputV3->isEnabled()); + QVERIFY(doneSpy1.wait()); ti1->enable(); ti1->set_content_type(QtWayland::zwp_text_input_v3::content_hint_none, QtWayland::zwp_text_input_v3::content_purpose_normal); @@ -579,9 +582,9 @@ void TestTextInputV3Interface::testMultipleTextinputs() QVERIFY(committedSpy.wait()); QCOMPARE(committedSpy.last().at(0).value(), 3); QVERIFY(m_serverTextInputV3->isEnabled()); + QVERIFY(doneSpy1.wait()); // at this point total commit count to ti1 is 3 - QSignalSpy doneSpy1(ti1, &TextInputV3::done); QSignalSpy doneSpy2(ti2, &TextInputV3::done); m_serverTextInputV3->commitString("Hello");