aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-06-23 19:03:47 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-06-23 19:03:47 -0500
commit9c34627337380a3125ffc7173606d72a66feec2e (patch)
tree25943ac636603e73f54d4e2a1f441659e3e8de94 /tests
parenta85fd44e7b2dc67b3e0712e174e88d0eb6c467e7 (diff)
downloadayatana-indicator-datetime-9c34627337380a3125ffc7173606d72a66feec2e.tar.gz
ayatana-indicator-datetime-9c34627337380a3125ffc7173606d72a66feec2e.tar.bz2
ayatana-indicator-datetime-9c34627337380a3125ffc7173606d72a66feec2e.zip
in the snap decision code, handle custom sounds and volume levels.
Diffstat (limited to 'tests')
-rw-r--r--tests/manual-test-snap.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/tests/manual-test-snap.cpp b/tests/manual-test-snap.cpp
index 16e606a..a78fb9a 100644
--- a/tests/manual-test-snap.cpp
+++ b/tests/manual-test-snap.cpp
@@ -19,6 +19,7 @@
*/
#include <datetime/appointment.h>
+#include <datetime/settings-live.h>
#include <datetime/snap.h>
#include <glib.h>
@@ -29,6 +30,15 @@ using namespace unity::indicator::datetime;
****
***/
+namespace
+{
+ gboolean quit_idle (gpointer gloop)
+ {
+ g_main_loop_quit(static_cast<GMainLoop*>(gloop));
+ return G_SOURCE_REMOVE;
+ };
+}
+
int main()
{
Appointment a;
@@ -47,15 +57,22 @@ int main()
auto loop = g_main_loop_new(nullptr, false);
auto show = [loop](const Appointment& appt){
g_message("You clicked 'show' for appt url '%s'", appt.url.c_str());
- g_main_loop_quit(loop);
+ g_idle_add(quit_idle, loop);
};
auto dismiss = [loop](const Appointment&){
g_message("You clicked 'dismiss'");
- g_main_loop_quit(loop);
+ g_idle_add(quit_idle, loop);
};
-
- Snap snap;
+
+ // only use local, temporary settings
+ g_assert(g_setenv("GSETTINGS_SCHEMA_DIR", SCHEMA_DIR, true));
+ g_assert(g_setenv("GSETTINGS_BACKEND", "memory", true));
+ g_debug("SCHEMA_DIR is %s", SCHEMA_DIR);
+
+ auto settings = std::make_shared<LiveSettings>();
+ Snap snap (settings);
snap(a, show, dismiss);
g_main_loop_run(loop);
+ g_main_loop_unref(loop);
return 0;
}