From be2b2e73044d5ba0c656431f0d19723af6b55946 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 2 Mar 2010 10:20:25 +0000 Subject: refactored the indicator tests so as no c file needs to be included --- tests/Makefile.am | 41 +++++++++++++++++++++-------------------- tests/test-indicator-sound.c | 43 +++++++++++++++++++++---------------------- 2 files changed, 42 insertions(+), 42 deletions(-) (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 285a26c..b20b070 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,8 +1,8 @@ check_PROGRAMS = \ test-indicator-sound \ - test-indicator-sound-dbus-client \ - test-indicator-sound-dbus-server + test-indicator-sound-dbus-client +# test-indicator-sound-dbus-server TESTS = DISTCLEANFILES = $(TESTS) @@ -44,20 +44,21 @@ test_indicator_sound_dbus_client_LDADD = \ ######################################### ## test-indicator-sound-dbus-server ######################################### -test_indicator_sound_dbus_server_SOURCES = \ - test-defines.h \ - test-indicator-sound-dbus-server.c - -test_indicator_sound_dbus_server_CFLAGS = \ - $(APPLET_CFLAGS) \ - -Wall -Werror \ - -I$(srcdir) \ - -I$(SOUNDSERVICE_CFLAGS) +#test_indicator_sound_dbus_server_SOURCES = \ +# test-defines.h -test_indicator_sound_dbus_server_LDADD = \ - $(SOUNDSERVICE_LIBS) \ - $(top_builddir)/src/libsoundmenu.la +#test_indicator_sound_dbus_server_CFLAGS = \ +# $(SOUNDSERVICE_CFLAGS) \ +# -Wall -Werror \ +# -I$(srcdir) \ +# -I$(SOUNDSERVICE_CFLAGS) +#test_indicator_sound_dbus_server_LDADD = \ +# $(SOUNDSERVICE_LIBS) \ +# $(top_builddir)/src/indicator_sound_service-sound-service.o \ +# $(top_builddir)/src/indicator_sound_service-pulse-manager.o \ +# $(top_builddir)/src/indicator_sound_service-slider-menu-item.o \ +# $(top_builddir)/src/indicator_sound_service-sound-service-dbus.o @@ -83,14 +84,14 @@ TESTS += indicator-sound-tests DISTCLEANFILES += $(XML_REPORT) $(HTML_REPORT) indicator-sound-tests-gtester -DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf +#DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf -test-indicator-sound-dbus: test-indicator-sound-dbus-client test-indicator-sound-dbus-server Makefile.am - @echo "#!/bin/sh" > test-indicator-sound-dbus - @echo $(DBUS_RUNNER) --task ./test-indicator-sound-dbus-client --task-name Client --task ./test-indicator-sound-dbus-server --task-name Server --ignore-return >> test-indicator-sound-dbus - @chmod +x test-indicator-sound-dbus +#test-indicator-sound-dbus: test-indicator-sound-dbus-client test-indicator-sound-dbus-server Makefile.am +# @echo "#!/bin/sh" > test-indicator-sound-dbus +# @echo $(DBUS_RUNNER) --task ./test-indicator-sound-dbus-client --task-name Client --task ./test-indicator-sound-dbus-server --task-name Server --ignore-return >> test-indicator-sound-dbus +# @chmod +x test-indicator-sound-dbus -TESTS += test-indicator-sound-dbus +#TESTS += test-indicator-sound-dbus diff --git a/tests/test-indicator-sound.c b/tests/test-indicator-sound.c index 5dad56c..eb68b17 100644 --- a/tests/test-indicator-sound.c +++ b/tests/test-indicator-sound.c @@ -57,34 +57,33 @@ void test_libindicator_determine_state() 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 = get_state_image_name(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 = get_state_image_name(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 = get_state_image_name(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 = get_state_image_name(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 = get_state_image_name(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 = get_state_image_name(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 = get_state_image_name(STATE_SINKS_NONE); + g_assert(g_ascii_strncasecmp("audio-output-none-panel", none_name, strlen("audio-output-none-panel")) == 0); + + tidy_up_hash(); +} @@ -95,7 +94,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 (); } -- cgit v1.2.3