aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-02-10 22:30:46 -0600
committerRobert Tari <robert@tari.in>2021-07-01 16:05:47 +0200
commit5b050c7f02284be9e97bf08ac80135cff5271c36 (patch)
treef02292a7362b3d9d16221a36b2e157ba8eafa047 /tests
parent7bf685ed20be13a94cb66691fddfdc3afedbc2c0 (diff)
downloadayatana-indicator-datetime-5b050c7f02284be9e97bf08ac80135cff5271c36.tar.gz
ayatana-indicator-datetime-5b050c7f02284be9e97bf08ac80135cff5271c36.tar.bz2
ayatana-indicator-datetime-5b050c7f02284be9e97bf08ac80135cff5271c36.zip
resolve some test timing issues by deferring Snap object creation until it's needed
Diffstat (limited to 'tests')
-rw-r--r--tests/test-notification.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/test-notification.cpp b/tests/test-notification.cpp
index 775d6d5..4c11dca 100644
--- a/tests/test-notification.cpp
+++ b/tests/test-notification.cpp
@@ -109,8 +109,6 @@ TEST_F(NotificationFixture,Notification)
{
for (const auto& test_muted : test_muted_apps)
{
- auto snap = create_snap(ne, sb, settings);
-
const bool expected_notify_called = test_appt.expected_notify_called
&& test_vibes.expected_notify_called
&& (test_muted.expected_notify_called.count(test_appt.appt.type) > 0)
@@ -121,13 +119,6 @@ TEST_F(NotificationFixture,Notification)
&& (test_muted.expected_vibrate_called.count(test_appt.appt.type) > 0)
&& test_haptic.expected_vibrate_called;
- // clear out any previous iterations' noise
- GError * error {};
- dbus_test_dbus_mock_object_clear_method_calls(haptic_mock, haptic_obj, &error);
- dbus_test_dbus_mock_object_clear_method_calls(notify_mock, notify_obj, &error);
- g_assert_no_error(error);
-
-
// set test case properties: blacklist
settings->muted_apps.set(test_muted.muted_apps);
@@ -136,15 +127,22 @@ TEST_F(NotificationFixture,Notification)
// set test case properties: other-vibrations flag
// (and wait for the PropertiesChanged signal so we know the dbusmock got it)
+ GError * error {};
dbus_test_dbus_mock_object_update_property(as_mock,
as_obj,
PROP_OTHER_VIBRATIONS,
g_variant_new_boolean(test_vibes.other_vibrations),
&error);
g_assert_no_error(error);
- wait_msec(100);
+
+ // wait for previous iterations' bus noise to finish and reset the counters
+ wait_msec(500);
+ dbus_test_dbus_mock_object_clear_method_calls(haptic_mock, haptic_obj, &error);
+ dbus_test_dbus_mock_object_clear_method_calls(notify_mock, notify_obj, &error);
+ g_assert_no_error(error);
// run the test
+ auto snap = create_snap(ne, sb, settings);
(*snap)(test_appt.appt, appt.alarms.front(), func, func);
// confirm that the notification was as expected