aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-03-08 20:40:32 +0000
committerConor Curran <conor.curran@canonical.com>2010-03-08 20:40:32 +0000
commit364d9362165f9f0d468eadc269c6421f4bf929e3 (patch)
tree548dca2a96ea30cea1dff2fef1f35e2e824824ad
parent230210f34c0a3cea1de4d95697d7bbec65420750 (diff)
downloadayatana-indicator-sound-364d9362165f9f0d468eadc269c6421f4bf929e3.tar.gz
ayatana-indicator-sound-364d9362165f9f0d468eadc269c6421f4bf929e3.tar.bz2
ayatana-indicator-sound-364d9362165f9f0d468eadc269c6421f4bf929e3.zip
new pulse manager test beginnings
-rw-r--r--src/pulse-manager.c3
-rw-r--r--tests/mockpulse.c1
-rw-r--r--tests/test-pulse-manager.c29
3 files changed, 32 insertions, 1 deletions
diff --git a/src/pulse-manager.c b/src/pulse-manager.c
index 4594d2f..04f842a 100644
--- a/src/pulse-manager.c
+++ b/src/pulse-manager.c
@@ -462,7 +462,8 @@ static void subscribed_events_callback(pa_context *c, enum pa_subscription_event
if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE)
{
//TODO handle the remove event => if its our default sink - update date pa state
- } else
+ }
+ else
{
pa_operation_unref(pa_context_get_sink_info_by_index(c, index, update_sink_info, userdata));
}
diff --git a/tests/mockpulse.c b/tests/mockpulse.c
index 297780b..a931e1d 100644
--- a/tests/mockpulse.c
+++ b/tests/mockpulse.c
@@ -26,3 +26,4 @@ pa_glib_mainloop_new(GMainContext *c)
return NULL;
}
+
diff --git a/tests/test-pulse-manager.c b/tests/test-pulse-manager.c
new file mode 100644
index 0000000..6a9c55b
--- /dev/null
+++ b/tests/test-pulse-manager.c
@@ -0,0 +1,29 @@
+#include "defintions.h"
+// I know this is not nice but I would rather not make everything public ?
+#include "pulse-manager.c"
+
+pa_context* context;
+
+static void pa_context_exit()
+{
+ pa_context_set_state_callback(context, context_state_callback, NULL);
+ // => call context_state_callback(context, NULL);
+ // pa_context_get_state needs to be mocked to return the right FAIL flag.
+ // 1. test to make sure relevant variables are tidied up
+ // 2. then using the same pa_context_get_state we could ensure the manager is attempting to reconnect tp PA.
+}
+
+static void test_sink_insert()
+{
+ sink_info *value;
+ value = g_new0(sink_info, 1);
+ value->index = 8;
+ value->name = "mock_sink";"
+ value->description = "mock description"
+ value->mute = FALSE
+ value->volume = 30000; // almost full
+ // update_sink_info is a static method in pulse-manager.c ?
+ pa_context_get_sink_info_by_index(context, value->index, update_sink_info);
+ // the mockinkg lib should then return this mocked up sink_info to the method update_sink_info which tests could be wrote against to make sure everthing is populated correctly.
+}
+