aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2010-03-04 21:23:40 +1100
committerRobert Collins <robertc@robertcollins.net>2010-03-04 21:23:40 +1100
commit9d0d8eaa8b9c021fbb45368f96489f520aab86e7 (patch)
treec036a36f625519e3cbc211306b9d58abce181212
parent84afe8ad635ba3294bc92e11d2b0f227996b48d5 (diff)
downloadayatana-indicator-sound-9d0d8eaa8b9c021fbb45368f96489f520aab86e7.tar.gz
ayatana-indicator-sound-9d0d8eaa8b9c021fbb45368f96489f520aab86e7.tar.bz2
ayatana-indicator-sound-9d0d8eaa8b9c021fbb45368f96489f520aab86e7.zip
Put mocking core in place for Connor.
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac7
-rw-r--r--src/Makefile.am4
-rw-r--r--tests/Makefile.am20
-rw-r--r--tests/mockpulse.c28
-rw-r--r--tests/test-indicator-sound.c6
6 files changed, 60 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am
index 357fa33..9f75289 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,8 @@
SUBDIRS = \
src \
- data \
- tests \
+ data \
+ tests \
po
EXTRA_DIST = autogen.sh
diff --git a/configure.ac b/configure.ac
index 4a2142e..925100b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,7 +34,7 @@ INDICATOR_DISPLAY_OBJECTS=0.1.2
PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
indicator >= $INDICATOR_REQUIRED_VERSION
- dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION
+ dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS)
AC_SUBST(APPLET_CFLAGS)
@@ -42,9 +42,12 @@ AC_SUBST(APPLET_LIBS)
DBUSMENUGLIB_REQUIRED_VERSION=0.1.1
+PKG_CHECK_MODULES(PULSEAUDIO, libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION)
+AC_SUBST(PULSEAUDIO_CFLAGS)
+AC_SUBST(PULSEAUDIO_LIBS)
+
PKG_CHECK_MODULES(SOUNDSERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION
indicator >= $INDICATOR_REQUIRED_VERSION
- libpulse-mainloop-glib >= $PULSE_AUDIO_REQUIRED_VERSION
)
AC_SUBST(SOUNDSERVICE_CFLAGS)
diff --git a/src/Makefile.am b/src/Makefile.am
index 40a8fdd..8ddcff5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -59,8 +59,8 @@ indicator_sound_service_SOURCES = \
sound-service-marshal.h \
slider-menu-item.h \
slider-menu-item.c
-indicator_sound_service_CFLAGS = $(SOUNDSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror
-indicator_sound_service_LDADD = $(SOUNDSERVICE_LIBS) $(GCONF_LIBS)
+indicator_sound_service_CFLAGS = $(PULSEAUDIO_CFLAGS) $(SOUNDSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror
+indicator_sound_service_LDADD = $(PULSEAUDIO_LIBS) $(SOUNDSERVICE_LIBS) $(GCONF_LIBS)
sound-service-server.h: $(srcdir)/sound-service.xml
dbus-binding-tool \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f636762..e29df33 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,9 +4,14 @@ check_PROGRAMS = \
test-indicator-sound-dbus-client
# test-indicator-sound-dbus-server
-TESTS =
+TESTS = test-indicator-sound
DISTCLEANFILES = $(TESTS)
+noinst_LTLIBRARIES = libmockpulse.la
+libmockpulse_la_SOURCES = mockpulse.c
+libmockpulse_la_CFLAGS = $(PULSEAUDIO_CFLAGS)
+
+
#########################################
## test-indicator-sound
#########################################
@@ -15,12 +20,15 @@ test_indicator_sound_SOURCES = \
$(top_builddir)/src/indicator-sound.c
test_indicator_sound_CFLAGS = \
+ $(PULSEAUDIO_CFLAGS) \
$(APPLET_CFLAGS) \
-Wall -Werror \
-I$(srcdir) \
-DTOP_BUILD_DIR="\"${abs_top_builddir}\""
test_indicator_sound_LDADD = \
+ libmockpulse.la \
+ $(PULSEAUDIO_LIBS) \
$(APPLET_LIBS)
@@ -33,12 +41,15 @@ test_indicator_sound_dbus_client_SOURCES = \
test-indicator-sound-dbus-client.c
test_indicator_sound_dbus_client_CFLAGS = \
+ $(PULSEAUDIO_CFLAGS) \
$(SOUNDSERVICE_CFLAGS) \
-Wall -Werror \
-I$(srcdir) \
-I$(SOUNDSERVICE_CFLAGS)
test_indicator_sound_dbus_client_LDADD = \
+ libmockpulse.la \
+ $(PULSEAUDIO_LIBS) \
$(SOUNDSERVICE_LIBS)
#########################################
@@ -48,12 +59,15 @@ test_indicator_sound_dbus_client_LDADD = \
# test-defines.h
#test_indicator_sound_dbus_server_CFLAGS = \
+# $(PULSEAUDIO_CFLAGS) \
# $(SOUNDSERVICE_CFLAGS) \
# -Wall -Werror \
# -I$(srcdir) \
# -I$(SOUNDSERVICE_CFLAGS)
#test_indicator_sound_dbus_server_LDADD = \
+# libmockpulse.la \
+# $(PULSEAUDIO_LIBS) \
# $(SOUNDSERVICE_LIBS) \
# $(top_builddir)/src/indicator_sound_service-sound-service.o \
# $(top_builddir)/src/indicator_sound_service-pulse-manager.o \
@@ -77,10 +91,10 @@ test_indicator_sound_dbus_client_LDADD = \
indicator-sound-tests-gtester: test-indicator-sound Makefile.am
@echo "#!/bin/sh" > $@
- @echo gtester -k --verbose -o=$(XML_REPORT) ./test-indicator-sound >> $@
+ @echo gtester -k --verbose -o=indicator-sound-check-results.xml ./test-indicator-sound >> $@
@chmod +x $@
-# TESTS += indicator-sound-tests
+ TESTS += indicator-sound-tests-gtester
DISTCLEANFILES += $(XML_REPORT) $(HTML_REPORT) indicator-sound-tests-gtester
diff --git a/tests/mockpulse.c b/tests/mockpulse.c
new file mode 100644
index 0000000..297780b
--- /dev/null
+++ b/tests/mockpulse.c
@@ -0,0 +1,28 @@
+/*
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Robert Collins <robert.collins@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <pulse/glib-mainloop.h>
+
+pa_glib_mainloop*
+pa_glib_mainloop_new(GMainContext *c)
+{
+ printf("This is reached\n", c);
+ return NULL;
+}
+
diff --git a/tests/test-indicator-sound.c b/tests/test-indicator-sound.c
index eb68b17..1d3569a 100644
--- a/tests/test-indicator-sound.c
+++ b/tests/test-indicator-sound.c
@@ -20,6 +20,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string.h>
#include <gtk/gtk.h>
#include <libindicator/indicator-object.h>
+#include <pulse/glib-mainloop.h>
#include "../src/indicator-sound.h"
static const gint STATE_MUTED = 0;
@@ -85,6 +86,10 @@ void test_libindicator_image_names()
tidy_up_hash();
}
+void test_libindicator_pa_mocked()
+{ g_assert(pa_glib_mainloop_new(NULL) == NULL);
+}
+
gint main (gint argc, gchar * argv[])
@@ -95,6 +100,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/pa_is_mocked", test_libindicator_pa_mocked);
return g_test_run ();
}