From 3460b9c8d18a52bb859f143f0428e0325d699a3f Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Thu, 22 Oct 2015 10:55:13 +0200 Subject: Update unit test --- tests/integration/indicator-sound-test-base.h | 9 +++++++++ tests/integration/test-indicator.cpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/integration/indicator-sound-test-base.h b/tests/integration/indicator-sound-test-base.h index 6879bcb..f9df9bb 100644 --- a/tests/integration/indicator-sound-test-base.h +++ b/tests/integration/indicator-sound-test-base.h @@ -42,6 +42,15 @@ class QSignalSpy; ASSERT_EQ(signalsExpected, signalSpy.size());\ } +#define WAIT_AT_LEAST_SIGNALS(signalSpy, signalsExpected)\ +{\ + while (signalSpy.size() < signalsExpected)\ + {\ + ASSERT_TRUE(signalSpy.wait());\ + }\ + ASSERT_TRUE(signalsExpected <= signalSpy.size());\ +} + class IndicatorSoundTestBase: public testing::Test { public: diff --git a/tests/integration/test-indicator.cpp b/tests/integration/test-indicator.cpp index 86d73b1..3cc24e8 100644 --- a/tests/integration/test-indicator.cpp +++ b/tests/integration/test-indicator.cpp @@ -56,7 +56,7 @@ TEST_F(TestIndicator, PhoneChangeRoleVolume) // set an initial volume to the alert role userAccountsSpy.clear(); setStreamRestoreVolume("alert", 1.0); - WAIT_FOR_SIGNALS(userAccountsSpy, 2); + WAIT_AT_LEAST_SIGNALS(userAccountsSpy, 1); userAccountsSpy.clear(); // play a test sound, it should change the role in the indicator -- cgit v1.2.3