aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-03-02 00:18:04 +0000
committerConor Curran <conor.curran@canonical.com>2010-03-02 00:18:04 +0000
commita6152fcf5ec57d7252617a7ede36aa53de7f2930 (patch)
treeabce27406eaa2fe29e1705b0b38b81cd947871af /tests
parent6468402475d7bfced0ee905bdd56977cc2f4b7da (diff)
parent7a92d249547ff1783725850edb39a952e52ee8c9 (diff)
downloadayatana-indicator-sound-a6152fcf5ec57d7252617a7ede36aa53de7f2930.tar.gz
ayatana-indicator-sound-a6152fcf5ec57d7252617a7ede36aa53de7f2930.tar.bz2
ayatana-indicator-sound-a6152fcf5ec57d7252617a7ede36aa53de7f2930.zip
slow progress on the testing front
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am18
-rw-r--r--tests/test-indicator-sound-dbus-client.c2
-rw-r--r--tests/test-indicator-sound-dbus-server.c2
-rw-r--r--tests/test-indicator-sound.c70
4 files changed, 51 insertions, 41 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7d061fb..285a26c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,6 @@
check_PROGRAMS = \
- test-indicator-sound
+ test-indicator-sound \
test-indicator-sound-dbus-client \
test-indicator-sound-dbus-server
@@ -21,7 +21,8 @@ test_indicator_sound_CFLAGS = \
test_indicator_sound_LDADD = \
$(APPLET_LIBS) \
- $(INDICATORDIR)/libsoundmenu.la
+ $(top_builddir)/src/libsoundmenu_la-indicator-sound.o
+
#########################################
## test-indicator-sound-dbus-client
@@ -38,8 +39,7 @@ test_indicator_sound_dbus_client_CFLAGS = \
-I$(SOUNDSERVICE_CFLAGS)
test_indicator_sound_dbus_client_LDADD = \
- $(SOUNDSERVICE_LIBS) \
- $(INDICATORDIR)/libsoundmenu.la
+ $(SOUNDSERVICE_LIBS)
#########################################
## test-indicator-sound-dbus-server
@@ -51,11 +51,15 @@ test_indicator_sound_dbus_server_SOURCES = \
test_indicator_sound_dbus_server_CFLAGS = \
$(APPLET_CFLAGS) \
-Wall -Werror \
- -I$(srcdir)
+ -I$(srcdir) \
+ -I$(SOUNDSERVICE_CFLAGS)
-test_libappindicator_dbus_server_LDADD = \
+test_indicator_sound_dbus_server_LDADD = \
$(SOUNDSERVICE_LIBS) \
- $(INDICATORDIR)/libsoundmenu.la
+ $(top_builddir)/src/libsoundmenu.la
+
+
+
#########################################
diff --git a/tests/test-indicator-sound-dbus-client.c b/tests/test-indicator-sound-dbus-client.c
index 9d6f7ab..dc36ae3 100644
--- a/tests/test-indicator-sound-dbus-client.c
+++ b/tests/test-indicator-sound-dbus-client.c
@@ -44,7 +44,7 @@ fetch_mute_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data)
return;
}
- if (TEST_MUTE != g_value_get_boolean(&value))) {
+ if (TEST_MUTE != g_value_get_boolean(&value)) {
g_debug("Mute vale Returned: FAILED");
passed = FALSE;
} else {
diff --git a/tests/test-indicator-sound-dbus-server.c b/tests/test-indicator-sound-dbus-server.c
index c9ad61d..21d7dfe 100644
--- a/tests/test-indicator-sound-dbus-server.c
+++ b/tests/test-indicator-sound-dbus-server.c
@@ -29,11 +29,13 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "test-defines.h"
static GMainLoop * mainloop = NULL;
+static SoundServiceDbus *dbus_interface = NULL;
gboolean
kill_func (gpointer userdata)
{
g_main_loop_quit(mainloop);
+ // TODO free the dbus interface !!
return FALSE;
}
diff --git a/tests/test-indicator-sound.c b/tests/test-indicator-sound.c
index 0de09b7..5dad56c 100644
--- a/tests/test-indicator-sound.c
+++ b/tests/test-indicator-sound.c
@@ -18,8 +18,17 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include "../src/indicator-sound.c"
-
+#include <gtk/gtk.h>
+#include <libindicator/indicator-object.h>
+#include "../src/indicator-sound.h"
+
+static const gint STATE_MUTED = 0;
+static const gint STATE_ZERO = 1;
+static const gint STATE_LOW = 2;
+static const gint STATE_MEDIUM = 3;
+static const gint STATE_HIGH = 4;
+static const gint STATE_MUTED_WHILE_INPUT = 5;
+static const gint STATE_SINKS_NONE = 6;
void test_libindicator_sound_init()
{
@@ -31,57 +40,52 @@ void test_libindicator_sound_init()
void test_libindicator_determine_state()
{
IndicatorObject * sound_menu = indicator_object_new_from_file(TOP_BUILD_DIR "/src/.libs/libsoundmenu.so");
- get_icon(sound_menu);
+ prepare_for_tests(sound_menu);
determine_state_from_volume(40);
- g_assert(current_state == STATE_MEDIUM);
+ g_assert(get_state() == STATE_MEDIUM);
determine_state_from_volume(0);
- g_assert(current_state == STATE_ZERO);
+ g_assert(get_state() == STATE_ZERO);
determine_state_from_volume(15);
- g_assert(current_state == STATE_LOW);
+ g_assert(get_state() == STATE_LOW);
determine_state_from_volume(70);
- g_assert(current_state == STATE_HIGH);
+ g_assert(get_state() == STATE_HIGH);
g_object_unref(G_OBJECT(sound_menu));
}
-void test_libindicator_image_names()
-{
- prepare_state_machine();
-
- gchar* muted_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED));
- g_assert(g_ascii_strncasecmp("audio-volume-muted-panel", muted_name, strlen("audio-volume-muted-panel")) == 0);
+/*void test_libindicator_image_names()*/
+/*{*/
+/* prepare_state_machine();*/
- gchar* zero_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_ZERO));
- g_assert(g_ascii_strncasecmp("audio-volume-low-zero-panel", zero_name, strlen("audio-volume-low-zero-panel")) == 0);
+/* gchar* muted_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED)); */
+/* g_assert(g_ascii_strncasecmp("audio-volume-muted-panel", muted_name, strlen("audio-volume-muted-panel")) == 0);*/
- gchar* low_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_LOW));
- g_assert(g_ascii_strncasecmp("audio-volume-low-panel", low_name, strlen("audio-volume-low-panel")) == 0);
+/* gchar* zero_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_ZERO)); */
+/* g_assert(g_ascii_strncasecmp("audio-volume-low-zero-panel", zero_name, strlen("audio-volume-low-zero-panel")) == 0);*/
- gchar* medium_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MEDIUM));
- g_assert(g_ascii_strncasecmp("audio-volume-medium-panel", medium_name, strlen("audio-volume-medium-panel")) == 0);
+/* gchar* low_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_LOW)); */
+/* g_assert(g_ascii_strncasecmp("audio-volume-low-panel", low_name, strlen("audio-volume-low-panel")) == 0);*/
- gchar* high_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_HIGH));
- g_assert(g_ascii_strncasecmp("audio-volume-high-panel", high_name, strlen("audio-volume-high-panel")) == 0);
+/* gchar* medium_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MEDIUM)); */
+/* g_assert(g_ascii_strncasecmp("audio-volume-medium-panel", medium_name, strlen("audio-volume-medium-panel")) == 0);*/
- gchar* blocked_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT));
- g_assert(g_ascii_strncasecmp("audio-volume-muted-blocking-panel", blocked_name, strlen("audio-volume-muted-blocking-panel")) == 0);
+/* gchar* high_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_HIGH)); */
+/* g_assert(g_ascii_strncasecmp("audio-volume-high-panel", high_name, strlen("audio-volume-high-panel")) == 0);*/
- gchar* none_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_SINKS_NONE));
- g_assert(g_ascii_strncasecmp("audio-output-none-panel", none_name, strlen("audio-output-none-panel")) == 0);
+/* gchar* blocked_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT)); */
+/* g_assert(g_ascii_strncasecmp("audio-volume-muted-blocking-panel", blocked_name, strlen("audio-volume-muted-blocking-panel")) == 0);*/
- // tidy up
- g_hash_table_destroy(volume_states);
-}
+/* gchar* none_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_SINKS_NONE)); */
+/* g_assert(g_ascii_strncasecmp("audio-output-none-panel", none_name, strlen("audio-output-none-panel")) == 0);*/
+/* // tidy up*/
+/* g_hash_table_destroy(volume_states);*/
+/*}*/
-void test_libindicator_mute_switching()
-{
-
-}
gint main (gint argc, gchar * argv[])
@@ -91,7 +95,7 @@ gint main (gint argc, gchar * argv[])
g_test_add_func("/indicator-sound/indicator-sound/init", test_libindicator_sound_init);
g_test_add_func("/indicator-sound/indicator-sound/state_machine", test_libindicator_determine_state);
- g_test_add_func("/indicator-sound/indicator-sound/image_names", test_libindicator_image_names);
+ //g_test_add_func("/indicator-sound/indicator-sound/image_names", test_libindicator_image_names);
return g_test_run ();
}