aboutsummaryrefslogtreecommitdiff
path: root/tests/test-notification.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-02-10 22:30:46 -0600
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-29 14:37:39 +0200
commit0fee0c157594ca750c3a253e984203cc3abe7cd5 (patch)
tree0ac0ab10066f6d05b0b35f7c21a66831838e7bcb /tests/test-notification.cpp
parent8a5815d92048f84581cc6802c1689f06c7df24f0 (diff)
downloadayatana-indicator-datetime-0fee0c157594ca750c3a253e984203cc3abe7cd5.tar.gz
ayatana-indicator-datetime-0fee0c157594ca750c3a253e984203cc3abe7cd5.tar.bz2
ayatana-indicator-datetime-0fee0c157594ca750c3a253e984203cc3abe7cd5.zip
resolve some test timing issues by deferring Snap object creation until it's needed
Diffstat (limited to 'tests/test-notification.cpp')
-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