aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-10-13 22:32:20 -0500
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-29 14:27:02 +0200
commitcdb2480bbd5f7ab2adf8f102a45e9c256c86f271 (patch)
treeb621d5f17ae069ce4922549117c4935af18fd4af
parentcbb76bdf650b13aaa2ade1a989069bbbf5ddf478 (diff)
downloadayatana-indicator-datetime-cdb2480bbd5f7ab2adf8f102a45e9c256c86f271.tar.gz
ayatana-indicator-datetime-cdb2480bbd5f7ab2adf8f102a45e9c256c86f271.tar.bz2
ayatana-indicator-datetime-cdb2480bbd5f7ab2adf8f102a45e9c256c86f271.zip
in test-snap, wait a moment after creating the Snap to allow its async dbus internals to finish bootstrapping
-rw-r--r--tests/test-snap.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/test-snap.cpp b/tests/test-snap.cpp
index 99d8a1c..e5e3f40 100644
--- a/tests/test-snap.cpp
+++ b/tests/test-snap.cpp
@@ -34,6 +34,8 @@
using namespace ayatana::indicator::datetime;
+namespace uin = ayatana::indicator::notifications;
+
#include "glib-fixture.h"
/***
@@ -371,6 +373,15 @@ protected:
&error);
g_assert_no_error (error);
}
+
+ std::shared_ptr<Snap> create_snap(const std::shared_ptr<uin::Engine>& ne,
+ const std::shared_ptr<uin::SoundBuilder>& sb,
+ const std::shared_ptr<Settings>& settings)
+ {
+ auto snap = std::make_shared<Snap>(ne, sb, settings);
+ wait_msec(100); // wait a moment for the Snap to finish its async dbus bootstrapping
+ return snap;
+ }
};
/***
@@ -392,13 +403,14 @@ TEST_F(SnapFixture, InteractiveDuration)
auto settings = std::make_shared<Settings>();
settings->alarm_duration.set(duration_minutes);
auto ne = std::make_shared<ayatana::indicator::notifications::Engine>(APP_NAME);
- Snap snap (ne, settings);
+ auto sb = std::make_shared<ayatana::indicator::notifications::DefaultSoundBuilder>();
+ auto snap = create_snap(ne, sb, settings);
make_interactive();
// call the Snap Decision
auto func = [this](const Appointment&, const Alarm&){g_idle_add(quit_idle, loop);};
- snap(appt, appt.alarms.front(), func, func);
+ (*snap)(appt, appt.alarms.front(), func, func);
// confirm that Notify got called once
guint len = 0;
@@ -442,7 +454,8 @@ TEST_F(SnapFixture, InhibitSleep)
{
auto settings = std::make_shared<Settings>();
auto ne = std::make_shared<ayatana::indicator::notifications::Engine>(APP_NAME);
- auto snap = new Snap (ne, settings);
+ auto sb = std::make_shared<ayatana::indicator::notifications::DefaultSoundBuilder>();
+ auto snap = create_snap(ne, sb, settings);
make_interactive();
@@ -469,7 +482,7 @@ TEST_F(SnapFixture, InhibitSleep)
// force-close the snap
wait_msec(100);
- delete snap;
+ snap.reset();
wait_msec(100);
// confirm that sleep got uninhibted
@@ -497,7 +510,8 @@ TEST_F(SnapFixture, ForceScreen)
{
auto settings = std::make_shared<Settings>();
auto ne = std::make_shared<ayatana::indicator::notifications::Engine>(APP_NAME);
- auto snap = new Snap (ne, settings);
+ auto sb = std::make_shared<ayatana::indicator::notifications::DefaultSoundBuilder>();
+ auto snap = create_snap(ne, sb, settings);
make_interactive();
@@ -518,7 +532,7 @@ TEST_F(SnapFixture, ForceScreen)
// force-close the snap
wait_msec(100);
- delete snap;
+ snap.reset();
wait_msec(100);
// confirm that sleep got uninhibted
@@ -552,7 +566,7 @@ TEST_F(SnapFixture,DISABLED_Vibrate)
{ true, "pulse", true }
};
- auto snap = std::make_shared<Snap>(ne, settings);
+ auto snap = create_snap(ne, sb, settings);
for(const auto& test_case : test_cases)
{