diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 47 | ||||
-rw-r--r-- | tests/Makefile.in | 105 | ||||
-rw-r--r-- | tests/dummy-indicator-entry-func.c | 130 | ||||
-rw-r--r-- | tests/dummy-indicator-entry-func.h | 56 | ||||
-rw-r--r-- | tests/dummy-indicator-signaler.c | 2 | ||||
-rw-r--r-- | tests/dummy-indicator-visible.c | 139 | ||||
-rw-r--r-- | tests/test-loader.c | 165 |
7 files changed, 638 insertions, 6 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index f11a9d1..9319087 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -14,7 +14,9 @@ lib_LTLIBRARIES = \ libdummy-indicator-blank.la \ libdummy-indicator-null.la \ libdummy-indicator-signaler.la \ - libdummy-indicator-simple.la + libdummy-indicator-simple.la \ + libdummy-indicator-visible.la \ + libdummy-indicator-entry-func.la DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf XVFB_RUN=". $(srcdir)/run-xvfb.sh" @@ -162,6 +164,47 @@ libdummy_indicator_simple_la_LDFLAGS = \ -avoid-version ############################# +# Dummy Indicator Entry Func +############################# + +libdummy_indicator_entry_func_la_SOURCES = \ + dummy-indicator-entry-func.c \ + dummy-indicator-entry-func.h + +libdummy_indicator_entry_func_la_CFLAGS = \ + -Wall -Werror \ + $(LIBINDICATOR_CFLAGS) -I$(top_srcdir) + +libdummy_indicator_entry_func_la_LIBADD = \ + $(LIBINDICATOR_LIBS) \ + -L$(top_builddir)/libindicator/.libs \ + $(INDICATOR_LIB) + +libdummy_indicator_entry_func_la_LDFLAGS = \ + -module \ + -avoid-version + +############################# +# Dummy Indicator Visible +############################# + +libdummy_indicator_visible_la_SOURCES = \ + dummy-indicator-visible.c + +libdummy_indicator_visible_la_CFLAGS = \ + -Wall -Werror \ + $(LIBINDICATOR_CFLAGS) -I$(top_srcdir) + +libdummy_indicator_visible_la_LIBADD = \ + $(LIBINDICATOR_LIBS) \ + -L$(top_builddir)/libindicator/.libs \ + $(INDICATOR_LIB) + +libdummy_indicator_visible_la_LDFLAGS = \ + -module \ + -avoid-version + +############################# # Service Shutdown Timeout ############################# @@ -412,7 +455,7 @@ DISTCLEANFILES += service-manager-connect-nostart-tester XML_REPORT = loader-check-results.xml HTML_REPORT = loader-check-results.html -loader-tester: test-loader libdummy-indicator-null.la libdummy-indicator-simple.la Makefile +loader-tester: test-loader libdummy-indicator-null.la libdummy-indicator-simple.la libdummy-indicator-entry-func.la Makefile @echo "#!/bin/bash" > loader-tester @echo $(XVFB_RUN) >> $@ @echo gtester -k --verbose -o=$(XML_REPORT) ./test-loader >> loader-tester diff --git a/tests/Makefile.in b/tests/Makefile.in index 923451a..b3b709a 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -53,7 +53,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/gcov.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -97,6 +97,15 @@ libdummy_indicator_blank_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libdummy_indicator_blank_la_CFLAGS) $(CFLAGS) \ $(libdummy_indicator_blank_la_LDFLAGS) $(LDFLAGS) -o $@ +libdummy_indicator_entry_func_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_libdummy_indicator_entry_func_la_OBJECTS = libdummy_indicator_entry_func_la-dummy-indicator-entry-func.lo +libdummy_indicator_entry_func_la_OBJECTS = \ + $(am_libdummy_indicator_entry_func_la_OBJECTS) +libdummy_indicator_entry_func_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libdummy_indicator_entry_func_la_CFLAGS) $(CFLAGS) \ + $(libdummy_indicator_entry_func_la_LDFLAGS) $(LDFLAGS) -o $@ libdummy_indicator_null_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_libdummy_indicator_null_la_OBJECTS = \ @@ -127,6 +136,16 @@ libdummy_indicator_simple_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libdummy_indicator_simple_la_CFLAGS) $(CFLAGS) \ $(libdummy_indicator_simple_la_LDFLAGS) $(LDFLAGS) -o $@ +libdummy_indicator_visible_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_libdummy_indicator_visible_la_OBJECTS = \ + libdummy_indicator_visible_la-dummy-indicator-visible.lo +libdummy_indicator_visible_la_OBJECTS = \ + $(am_libdummy_indicator_visible_la_OBJECTS) +libdummy_indicator_visible_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libdummy_indicator_visible_la_CFLAGS) $(CFLAGS) \ + $(libdummy_indicator_visible_la_LDFLAGS) $(LDFLAGS) -o $@ am_service_manager_connect_OBJECTS = \ service_manager_connect-service-manager-connect.$(OBJEXT) service_manager_connect_OBJECTS = \ @@ -271,9 +290,11 @@ AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libdummy_indicator_blank_la_SOURCES) \ + $(libdummy_indicator_entry_func_la_SOURCES) \ $(libdummy_indicator_null_la_SOURCES) \ $(libdummy_indicator_signaler_la_SOURCES) \ $(libdummy_indicator_simple_la_SOURCES) \ + $(libdummy_indicator_visible_la_SOURCES) \ $(service_manager_connect_SOURCES) \ $(service_manager_connect_service_SOURCES) \ $(service_manager_no_connect_SOURCES) \ @@ -287,9 +308,11 @@ SOURCES = $(libdummy_indicator_blank_la_SOURCES) \ $(service_version_multiwatch_service_SOURCES) \ $(test_desktop_shortcuts_SOURCES) $(test_loader_SOURCES) DIST_SOURCES = $(libdummy_indicator_blank_la_SOURCES) \ + $(libdummy_indicator_entry_func_la_SOURCES) \ $(libdummy_indicator_null_la_SOURCES) \ $(libdummy_indicator_signaler_la_SOURCES) \ $(libdummy_indicator_simple_la_SOURCES) \ + $(libdummy_indicator_visible_la_SOURCES) \ $(service_manager_connect_SOURCES) \ $(service_manager_connect_service_SOURCES) \ $(service_manager_no_connect_SOURCES) \ @@ -318,11 +341,15 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COVERAGE_CFLAGS = @COVERAGE_CFLAGS@ +COVERAGE_CXXFLAGS = @COVERAGE_CXXFLAGS@ +COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -332,6 +359,8 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXPANDED_SYSCONFDIR = @EXPANDED_SYSCONFDIR@ FGREP = @FGREP@ +GCOVR = @GCOVR@ +GENHTML = @GENHTML@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_MKENUMS = @GLIB_MKENUMS@ GREP = @GREP@ @@ -340,6 +369,7 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDIR = @LIBDIR@ @@ -354,6 +384,7 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -377,6 +408,7 @@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHTOOL = @SHTOOL@ STRIP = @STRIP@ SYSCONFDIR = @SYSCONFDIR@ VERSION = @VERSION@ @@ -384,6 +416,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ @@ -416,7 +449,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -453,7 +485,9 @@ lib_LTLIBRARIES = \ libdummy-indicator-blank.la \ libdummy-indicator-null.la \ libdummy-indicator-signaler.la \ - libdummy-indicator-simple.la + libdummy-indicator-simple.la \ + libdummy-indicator-visible.la \ + libdummy-indicator-entry-func.la DBUS_RUNNER = dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf XVFB_RUN = ". $(srcdir)/run-xvfb.sh" @@ -570,6 +604,47 @@ libdummy_indicator_simple_la_LDFLAGS = \ -module \ -avoid-version + +############################# +# Dummy Indicator Entry Func +############################# +libdummy_indicator_entry_func_la_SOURCES = \ + dummy-indicator-entry-func.c \ + dummy-indicator-entry-func.h + +libdummy_indicator_entry_func_la_CFLAGS = \ + -Wall -Werror \ + $(LIBINDICATOR_CFLAGS) -I$(top_srcdir) + +libdummy_indicator_entry_func_la_LIBADD = \ + $(LIBINDICATOR_LIBS) \ + -L$(top_builddir)/libindicator/.libs \ + $(INDICATOR_LIB) + +libdummy_indicator_entry_func_la_LDFLAGS = \ + -module \ + -avoid-version + + +############################# +# Dummy Indicator Visible +############################# +libdummy_indicator_visible_la_SOURCES = \ + dummy-indicator-visible.c + +libdummy_indicator_visible_la_CFLAGS = \ + -Wall -Werror \ + $(LIBINDICATOR_CFLAGS) -I$(top_srcdir) + +libdummy_indicator_visible_la_LIBADD = \ + $(LIBINDICATOR_LIBS) \ + -L$(top_builddir)/libindicator/.libs \ + $(INDICATOR_LIB) + +libdummy_indicator_visible_la_LDFLAGS = \ + -module \ + -avoid-version + service_shutdown_timeout_SOURCES = \ service-shutdown-timeout.c @@ -777,12 +852,16 @@ clean-libLTLIBRARIES: done libdummy-indicator-blank.la: $(libdummy_indicator_blank_la_OBJECTS) $(libdummy_indicator_blank_la_DEPENDENCIES) $(AM_V_CCLD)$(libdummy_indicator_blank_la_LINK) -rpath $(libdir) $(libdummy_indicator_blank_la_OBJECTS) $(libdummy_indicator_blank_la_LIBADD) $(LIBS) +libdummy-indicator-entry-func.la: $(libdummy_indicator_entry_func_la_OBJECTS) $(libdummy_indicator_entry_func_la_DEPENDENCIES) + $(AM_V_CCLD)$(libdummy_indicator_entry_func_la_LINK) -rpath $(libdir) $(libdummy_indicator_entry_func_la_OBJECTS) $(libdummy_indicator_entry_func_la_LIBADD) $(LIBS) libdummy-indicator-null.la: $(libdummy_indicator_null_la_OBJECTS) $(libdummy_indicator_null_la_DEPENDENCIES) $(AM_V_CCLD)$(libdummy_indicator_null_la_LINK) -rpath $(libdir) $(libdummy_indicator_null_la_OBJECTS) $(libdummy_indicator_null_la_LIBADD) $(LIBS) libdummy-indicator-signaler.la: $(libdummy_indicator_signaler_la_OBJECTS) $(libdummy_indicator_signaler_la_DEPENDENCIES) $(AM_V_CCLD)$(libdummy_indicator_signaler_la_LINK) -rpath $(libdir) $(libdummy_indicator_signaler_la_OBJECTS) $(libdummy_indicator_signaler_la_LIBADD) $(LIBS) libdummy-indicator-simple.la: $(libdummy_indicator_simple_la_OBJECTS) $(libdummy_indicator_simple_la_DEPENDENCIES) $(AM_V_CCLD)$(libdummy_indicator_simple_la_LINK) -rpath $(libdir) $(libdummy_indicator_simple_la_OBJECTS) $(libdummy_indicator_simple_la_LIBADD) $(LIBS) +libdummy-indicator-visible.la: $(libdummy_indicator_visible_la_OBJECTS) $(libdummy_indicator_visible_la_DEPENDENCIES) + $(AM_V_CCLD)$(libdummy_indicator_visible_la_LINK) -rpath $(libdir) $(libdummy_indicator_visible_la_OBJECTS) $(libdummy_indicator_visible_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ @@ -839,9 +918,11 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdummy_indicator_blank_la-dummy-indicator-blank.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdummy_indicator_entry_func_la-dummy-indicator-entry-func.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdummy_indicator_null_la-dummy-indicator-null.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdummy_indicator_signaler_la-dummy-indicator-signaler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdummy_indicator_simple_la-dummy-indicator-simple.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdummy_indicator_visible_la-dummy-indicator-visible.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service_manager_connect-service-manager-connect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service_manager_connect_service-service-manager-connect-service.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service_manager_no_connect-service-manager-no-connect.Po@am__quote@ @@ -888,6 +969,14 @@ libdummy_indicator_blank_la-dummy-indicator-blank.lo: dummy-indicator-blank.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdummy_indicator_blank_la_CFLAGS) $(CFLAGS) -c -o libdummy_indicator_blank_la-dummy-indicator-blank.lo `test -f 'dummy-indicator-blank.c' || echo '$(srcdir)/'`dummy-indicator-blank.c +libdummy_indicator_entry_func_la-dummy-indicator-entry-func.lo: dummy-indicator-entry-func.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdummy_indicator_entry_func_la_CFLAGS) $(CFLAGS) -MT libdummy_indicator_entry_func_la-dummy-indicator-entry-func.lo -MD -MP -MF $(DEPDIR)/libdummy_indicator_entry_func_la-dummy-indicator-entry-func.Tpo -c -o libdummy_indicator_entry_func_la-dummy-indicator-entry-func.lo `test -f 'dummy-indicator-entry-func.c' || echo '$(srcdir)/'`dummy-indicator-entry-func.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdummy_indicator_entry_func_la-dummy-indicator-entry-func.Tpo $(DEPDIR)/libdummy_indicator_entry_func_la-dummy-indicator-entry-func.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dummy-indicator-entry-func.c' object='libdummy_indicator_entry_func_la-dummy-indicator-entry-func.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdummy_indicator_entry_func_la_CFLAGS) $(CFLAGS) -c -o libdummy_indicator_entry_func_la-dummy-indicator-entry-func.lo `test -f 'dummy-indicator-entry-func.c' || echo '$(srcdir)/'`dummy-indicator-entry-func.c + libdummy_indicator_null_la-dummy-indicator-null.lo: dummy-indicator-null.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdummy_indicator_null_la_CFLAGS) $(CFLAGS) -MT libdummy_indicator_null_la-dummy-indicator-null.lo -MD -MP -MF $(DEPDIR)/libdummy_indicator_null_la-dummy-indicator-null.Tpo -c -o libdummy_indicator_null_la-dummy-indicator-null.lo `test -f 'dummy-indicator-null.c' || echo '$(srcdir)/'`dummy-indicator-null.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdummy_indicator_null_la-dummy-indicator-null.Tpo $(DEPDIR)/libdummy_indicator_null_la-dummy-indicator-null.Plo @@ -912,6 +1001,14 @@ libdummy_indicator_simple_la-dummy-indicator-simple.lo: dummy-indicator-simple.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdummy_indicator_simple_la_CFLAGS) $(CFLAGS) -c -o libdummy_indicator_simple_la-dummy-indicator-simple.lo `test -f 'dummy-indicator-simple.c' || echo '$(srcdir)/'`dummy-indicator-simple.c +libdummy_indicator_visible_la-dummy-indicator-visible.lo: dummy-indicator-visible.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdummy_indicator_visible_la_CFLAGS) $(CFLAGS) -MT libdummy_indicator_visible_la-dummy-indicator-visible.lo -MD -MP -MF $(DEPDIR)/libdummy_indicator_visible_la-dummy-indicator-visible.Tpo -c -o libdummy_indicator_visible_la-dummy-indicator-visible.lo `test -f 'dummy-indicator-visible.c' || echo '$(srcdir)/'`dummy-indicator-visible.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdummy_indicator_visible_la-dummy-indicator-visible.Tpo $(DEPDIR)/libdummy_indicator_visible_la-dummy-indicator-visible.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dummy-indicator-visible.c' object='libdummy_indicator_visible_la-dummy-indicator-visible.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdummy_indicator_visible_la_CFLAGS) $(CFLAGS) -c -o libdummy_indicator_visible_la-dummy-indicator-visible.lo `test -f 'dummy-indicator-visible.c' || echo '$(srcdir)/'`dummy-indicator-visible.c + service_manager_connect-service-manager-connect.o: service-manager-connect.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(service_manager_connect_CFLAGS) $(CFLAGS) -MT service_manager_connect-service-manager-connect.o -MD -MP -MF $(DEPDIR)/service_manager_connect-service-manager-connect.Tpo -c -o service_manager_connect-service-manager-connect.o `test -f 'service-manager-connect.c' || echo '$(srcdir)/'`service-manager-connect.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/service_manager_connect-service-manager-connect.Tpo $(DEPDIR)/service_manager_connect-service-manager-connect.Po @@ -1480,7 +1577,7 @@ service-manager-connect-nostart-tester: service-manager-nostart-connect service- @echo dbus-test-runner --task ./service-manager-nostart-connect --task ./service-manager-connect-service >> $@ @chmod +x $@ -loader-tester: test-loader libdummy-indicator-null.la libdummy-indicator-simple.la Makefile +loader-tester: test-loader libdummy-indicator-null.la libdummy-indicator-simple.la libdummy-indicator-entry-func.la Makefile @echo "#!/bin/bash" > loader-tester @echo $(XVFB_RUN) >> $@ @echo gtester -k --verbose -o=$(XML_REPORT) ./test-loader >> loader-tester diff --git a/tests/dummy-indicator-entry-func.c b/tests/dummy-indicator-entry-func.c new file mode 100644 index 0000000..96e5ad0 --- /dev/null +++ b/tests/dummy-indicator-entry-func.c @@ -0,0 +1,130 @@ +/* +Test for libindicator + +Copyright 2012 Canonical Ltd. + +Authors: + Ted Gould <ted@canonical.com> + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License version 3.0 for more details. + +You should have received a copy of the GNU General Public +License along with this library. If not, see +<http://www.gnu.org/licenses/>. +*/ + +#include "dummy-indicator-entry-func.h" + + +GType dummy_indicator_entry_func_get_type (void); + +INDICATOR_SET_VERSION +INDICATOR_SET_TYPE(DUMMY_INDICATOR_ENTRY_FUNC_TYPE) + + +GtkLabel * +get_label (IndicatorObject * io) +{ + return NULL; +} + +GtkImage * +get_icon (IndicatorObject * io) +{ + return NULL; +} + +GtkMenu * +get_menu (IndicatorObject * io) +{ + return NULL; +} +const gchar * +get_accessible_desc (IndicatorObject * io) +{ + return NULL; +} + +static void +entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp) +{ + DummyIndicatorEntryFunc * self = DUMMY_INDICATOR_ENTRY_FUNC(io); + self->entry_activate_called = TRUE; + return; +} + +static void +entry_activate_window (IndicatorObject * io, IndicatorObjectEntry * entry, guint windowid, guint timestamp) +{ + DummyIndicatorEntryFunc * self = DUMMY_INDICATOR_ENTRY_FUNC(io); + self->entry_activate_window_called = TRUE; + return; +} + +static void +entry_close (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp) +{ + DummyIndicatorEntryFunc * self = DUMMY_INDICATOR_ENTRY_FUNC(io); + self->entry_close_called = TRUE; + return; +} + + +static void dummy_indicator_entry_func_class_init (DummyIndicatorEntryFuncClass *klass); +static void dummy_indicator_entry_func_init (DummyIndicatorEntryFunc *self); +static void dummy_indicator_entry_func_dispose (GObject *object); +static void dummy_indicator_entry_func_finalize (GObject *object); + +G_DEFINE_TYPE (DummyIndicatorEntryFunc, dummy_indicator_entry_func, INDICATOR_OBJECT_TYPE); + +static void +dummy_indicator_entry_func_class_init (DummyIndicatorEntryFuncClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = dummy_indicator_entry_func_dispose; + object_class->finalize = dummy_indicator_entry_func_finalize; + + IndicatorObjectClass * io_class = INDICATOR_OBJECT_CLASS(klass); + + io_class->get_label = get_label; + io_class->get_image = get_icon; + io_class->get_menu = get_menu; + io_class->get_accessible_desc = get_accessible_desc; + + io_class->entry_activate = entry_activate; + io_class->entry_activate_window = entry_activate_window; + io_class->entry_close = entry_close; + + return; +} + +static void +dummy_indicator_entry_func_init (DummyIndicatorEntryFunc *self) +{ + + return; +} + +static void +dummy_indicator_entry_func_dispose (GObject *object) +{ + + G_OBJECT_CLASS (dummy_indicator_entry_func_parent_class)->dispose (object); + return; +} + +static void +dummy_indicator_entry_func_finalize (GObject *object) +{ + + G_OBJECT_CLASS (dummy_indicator_entry_func_parent_class)->finalize (object); + return; +} diff --git a/tests/dummy-indicator-entry-func.h b/tests/dummy-indicator-entry-func.h new file mode 100644 index 0000000..f5c8264 --- /dev/null +++ b/tests/dummy-indicator-entry-func.h @@ -0,0 +1,56 @@ +/* +Test for libindicator + +Copyright 2012 Canonical Ltd. + +Authors: + Ted Gould <ted@canonical.com> + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License version 3.0 for more details. + +You should have received a copy of the GNU General Public +License along with this library. If not, see +<http://www.gnu.org/licenses/>. +*/ + +#ifndef __DUMMY_INDICATOR_ENTRY_FUNC__ +#define __DUMMY_INDICATOR_ENTRY_FUNC__ + +#include <glib.h> +#include <glib-object.h> + +#include "libindicator/indicator.h" +#include "libindicator/indicator-object.h" + +G_BEGIN_DECLS + +#define DUMMY_INDICATOR_ENTRY_FUNC_TYPE (dummy_indicator_entry_func_get_type ()) +#define DUMMY_INDICATOR_ENTRY_FUNC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DUMMY_INDICATOR_ENTRY_FUNC_TYPE, DummyIndicatorEntryFunc)) +#define DUMMY_INDICATOR_ENTRY_FUNC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DUMMY_INDICATOR_ENTRY_FUNC_TYPE, DummyIndicatorEntryFuncClass)) +#define IS_DUMMY_INDICATOR_ENTRY_FUNC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DUMMY_INDICATOR_ENTRY_FUNC_TYPE)) +#define IS_DUMMY_INDICATOR_ENTRY_FUNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DUMMY_INDICATOR_ENTRY_FUNC_TYPE)) +#define DUMMY_INDICATOR_ENTRY_FUNC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DUMMY_INDICATOR_ENTRY_FUNC_TYPE, DummyIndicatorEntryFuncClass)) + +typedef struct _DummyIndicatorEntryFunc DummyIndicatorEntryFunc; +typedef struct _DummyIndicatorEntryFuncClass DummyIndicatorEntryFuncClass; + +struct _DummyIndicatorEntryFuncClass { + IndicatorObjectClass parent_class; +}; + +struct _DummyIndicatorEntryFunc { + IndicatorObject parent; + + gboolean entry_activate_called; + gboolean entry_activate_window_called; + gboolean entry_close_called; +}; + +#endif /* __DUMMY_INDICATOR_ENTRY_FUNC__ */ diff --git a/tests/dummy-indicator-signaler.c b/tests/dummy-indicator-signaler.c index 00eee3b..c7a5c1f 100644 --- a/tests/dummy-indicator-signaler.c +++ b/tests/dummy-indicator-signaler.c @@ -99,6 +99,8 @@ dummy_indicator_signaler_class_init (DummyIndicatorSignalerClass *klass) io_class->get_image = get_icon; io_class->get_menu = get_menu; io_class->get_accessible_desc = get_accessible_desc; + io_class->entry_being_removed = NULL; + io_class->entry_was_added = NULL; return; } diff --git a/tests/dummy-indicator-visible.c b/tests/dummy-indicator-visible.c new file mode 100644 index 0000000..0bb9e89 --- /dev/null +++ b/tests/dummy-indicator-visible.c @@ -0,0 +1,139 @@ +/* +Test for libindicator + +Copyright 2012 Canonical Ltd. + +Authors: + Charles Kerr <charles.kerr@canonical.com> + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License version 3.0 for more details. + +You should have received a copy of the GNU General Public +License along with this library. If not, see +<http://www.gnu.org/licenses/>. +*/ + +#include <glib.h> +#include <glib-object.h> + +#include "libindicator/indicator.h" +#include "libindicator/indicator-object.h" + +#define DUMMY_INDICATOR_VISIBLE_TYPE (dummy_indicator_visible_get_type ()) +#define DUMMY_INDICATOR_VISIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DUMMY_INDICATOR_VISIBLE_TYPE, DummyIndicatorVisible)) +#define DUMMY_INDICATOR_VISIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DUMMY_INDICATOR_VISIBLE_TYPE, DummyIndicatorVisibleClass)) +#define IS_DUMMY_INDICATOR_VISIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DUMMY_INDICATOR_VISIBLE_TYPE)) +#define IS_DUMMY_INDICATOR_VISIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DUMMY_INDICATOR_VISIBLE_TYPE)) +#define DUMMY_INDICATOR_VISIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DUMMY_INDICATOR_VISIBLE_TYPE, DummyIndicatorVisibleClass)) + +typedef struct _DummyIndicatorVisible DummyIndicatorVisible; +typedef struct _DummyIndicatorVisibleClass DummyIndicatorVisibleClass; + +struct _DummyIndicatorVisibleClass { + IndicatorObjectClass parent_class; +}; + +struct _DummyIndicatorVisible { + IndicatorObject parent; +}; + +GType dummy_indicator_visible_get_type (void); + +INDICATOR_SET_VERSION +INDICATOR_SET_TYPE(DUMMY_INDICATOR_VISIBLE_TYPE) + +GtkLabel * +get_label (IndicatorObject * io) +{ + return GTK_LABEL(gtk_label_new("Visible Item")); +} + +GtkImage * +get_icon (IndicatorObject * io) +{ + return GTK_IMAGE(gtk_image_new()); +} + +GtkMenu * +get_menu (IndicatorObject * io) +{ + GtkMenu * main_menu = GTK_MENU(gtk_menu_new()); + GtkWidget * loading_item = gtk_menu_item_new_with_label("Loading..."); + gtk_menu_shell_append(GTK_MENU_SHELL(main_menu), loading_item); + gtk_widget_show(GTK_WIDGET(loading_item)); + + return main_menu; +} + +const gchar * +get_accessible_desc (IndicatorObject * io) +{ + return "Visible Item"; +} + +static void dummy_indicator_visible_class_init (DummyIndicatorVisibleClass *klass); +static void dummy_indicator_visible_init (DummyIndicatorVisible *self); +static void dummy_indicator_visible_dispose (GObject *object); +static void dummy_indicator_visible_finalize (GObject *object); + +G_DEFINE_TYPE (DummyIndicatorVisible, dummy_indicator_visible, INDICATOR_OBJECT_TYPE); + +static void +dummy_indicator_entry_being_removed (IndicatorObject * io, IndicatorObjectEntry * entry) +{ + g_object_set_data(G_OBJECT(entry->label), "is-hidden", GINT_TO_POINTER(1)); + + INDICATOR_OBJECT_CLASS(dummy_indicator_visible_parent_class)->entry_being_removed (io, entry); +} + +static void +dummy_indicator_entry_was_added (IndicatorObject * io, IndicatorObjectEntry * entry) +{ + g_object_steal_data(G_OBJECT(entry->label), "is-hidden"); + + INDICATOR_OBJECT_CLASS(dummy_indicator_visible_parent_class)->entry_was_added (io, entry); +} + +static void +dummy_indicator_visible_class_init (DummyIndicatorVisibleClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = dummy_indicator_visible_dispose; + object_class->finalize = dummy_indicator_visible_finalize; + + IndicatorObjectClass * io_class = INDICATOR_OBJECT_CLASS(klass); + + io_class->get_label = get_label; + io_class->get_image = get_icon; + io_class->get_menu = get_menu; + io_class->get_accessible_desc = get_accessible_desc; + io_class->entry_being_removed = dummy_indicator_entry_being_removed; + io_class->entry_was_added = dummy_indicator_entry_was_added; +} + +static void +dummy_indicator_visible_init (DummyIndicatorVisible *self) +{ +} + +static void +dummy_indicator_visible_dispose (GObject *object) +{ + + G_OBJECT_CLASS (dummy_indicator_visible_parent_class)->dispose (object); +} + +static void +dummy_indicator_visible_finalize (GObject *object) +{ + + G_OBJECT_CLASS (dummy_indicator_visible_parent_class)->finalize (object); +} diff --git a/tests/test-loader.c b/tests/test-loader.c index ac9d4e5..6f9d25b 100644 --- a/tests/test-loader.c +++ b/tests/test-loader.c @@ -23,6 +23,78 @@ License along with this library. If not, see #include <gtk/gtk.h> #include "libindicator/indicator-object.h" +#include "dummy-indicator-entry-func.h" + +void +entry_func_swap (IndicatorObject * io) +{ + static void (*saved_func) (IndicatorObject * io, IndicatorObjectEntry * entry, guint windowid, guint timestamp) = NULL; + IndicatorObjectClass * klass = INDICATOR_OBJECT_GET_CLASS(io); + + if (saved_func == NULL) { + saved_func = klass->entry_activate_window; + } + + if (klass->entry_activate_window == NULL) { + klass->entry_activate_window = saved_func; + } else { + klass->entry_activate_window = NULL; + } + + return; +} + +void +test_loader_entry_func_window (void) +{ + IndicatorObject * object = indicator_object_new_from_file(BUILD_DIR "/.libs/libdummy-indicator-entry-func.so"); + g_assert(object != NULL); + + DummyIndicatorEntryFunc * entryfunc = (DummyIndicatorEntryFunc *)(object); + + entryfunc->entry_activate_called = FALSE; + entryfunc->entry_activate_window_called = FALSE; + entryfunc->entry_close_called = FALSE; + + entry_func_swap(object); + indicator_object_entry_activate_window(object, NULL, 0, 0); + g_assert(entryfunc->entry_activate_called); + + entry_func_swap(object); + indicator_object_entry_activate_window(object, NULL, 0, 0); + g_assert(entryfunc->entry_activate_window_called); + + g_object_unref(object); + + return; +} + +void +test_loader_entry_funcs (void) +{ + IndicatorObject * object = indicator_object_new_from_file(BUILD_DIR "/.libs/libdummy-indicator-entry-func.so"); + g_assert(object != NULL); + + DummyIndicatorEntryFunc * entryfunc = (DummyIndicatorEntryFunc *)(object); + + entryfunc->entry_activate_called = FALSE; + entryfunc->entry_activate_window_called = FALSE; + entryfunc->entry_close_called = FALSE; + + indicator_object_entry_activate(object, NULL, 0); + g_assert(entryfunc->entry_activate_called); + + indicator_object_entry_activate_window(object, NULL, 0, 0); + g_assert(entryfunc->entry_activate_window_called); + + indicator_object_entry_close(object, NULL, 0); + g_assert(entryfunc->entry_close_called); + + g_object_unref(object); + + return; +} + void destroy_cb (gpointer data, GObject * object); void @@ -68,6 +140,95 @@ test_loader_filename_dummy_signaler (void) return; } +/*** +**** +***/ + +static void +visible_entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer box) +{ + // make a frame for the entry, and add the frame to the box + GtkWidget * frame = gtk_frame_new (NULL); + GtkWidget * child = GTK_WIDGET(entry->label); + g_assert (child != NULL); + gtk_container_add (GTK_CONTAINER(frame), child); + gtk_box_pack_start (GTK_BOX(box), frame, FALSE, FALSE, 0); + g_object_set_data (G_OBJECT(child), "frame-parent", frame); +} + +static void +visible_entry_removed (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer box) +{ + // destroy this entry's frame + gpointer parent = g_object_steal_data (G_OBJECT(entry->label), "frame-parent"); + if (GTK_IS_WIDGET(parent)) + gtk_widget_destroy(GTK_WIDGET(parent)); +} + +void +test_loader_filename_dummy_visible (void) +{ + const GQuark is_hidden_quark = g_quark_from_static_string ("is-hidden"); + IndicatorObject * object = indicator_object_new_from_file(BUILD_DIR "/.libs/libdummy-indicator-visible.so"); + g_assert(object != NULL); + + // create our local parent widgetry +#if GTK_CHECK_VERSION(3,0,0) + GtkWidget * box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); +#else + GtkWidget * box = gtk_hbox_new (TRUE, 0); +#endif + g_signal_connect(object, INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, + G_CALLBACK(visible_entry_added), box); + g_signal_connect(object, INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, + G_CALLBACK(visible_entry_removed), box); + + // on startup, DummyVisible has one entry and it has a label + GList * list = indicator_object_get_entries(object); + g_assert(g_list_length(list) == 1); + IndicatorObjectEntry * entry = list->data; + g_assert(entry != NULL); + g_list_free(list); + g_assert(GTK_IS_LABEL(entry->label)); + GtkWidget * label = GTK_WIDGET(entry->label); + g_assert(g_object_get_qdata(G_OBJECT(label), is_hidden_quark) == NULL); + + // add the inital entry to our local parent widgetry + visible_entry_added (object, entry, box); + entry = NULL; + list = gtk_container_get_children (GTK_CONTAINER(box)); + g_assert(g_list_length(list) == 1); + g_list_free(list); + + // hide the entries and confirm that the label survived + indicator_object_set_visible (object, FALSE); + while (g_main_context_pending(NULL)) + g_main_context_iteration(NULL, TRUE); + g_assert(GTK_IS_LABEL(label)); + g_assert(g_object_get_qdata(G_OBJECT(label), is_hidden_quark) != NULL); + list = gtk_container_get_children (GTK_CONTAINER(box)); + g_assert(g_list_length(list) == 0); + g_list_free(list); + + // restore the entries and confirm that the label survived + indicator_object_set_visible (object, TRUE); + while (g_main_context_pending(NULL)) + g_main_context_iteration(NULL, TRUE); + g_assert(GTK_IS_LABEL(label)); + g_assert(g_object_get_qdata(G_OBJECT(label), is_hidden_quark) == NULL); + list = gtk_container_get_children (GTK_CONTAINER(box)); + g_assert(g_list_length(list) == 1); + g_list_free(list); + + // cleanup + g_object_unref(object); + gtk_widget_destroy(box); +} + +/*** +**** +***/ + void test_loader_filename_dummy_simple_location (void) { @@ -80,6 +241,7 @@ test_loader_filename_dummy_simple_location (void) g_assert(indicator_object_get_location(object, (IndicatorObjectEntry *)entries->data) == 0); g_assert(indicator_object_get_location(object, NULL) == 0); + g_assert(((IndicatorObjectEntry *)entries->data)->parent_object != NULL); g_object_unref(object); @@ -174,6 +336,9 @@ test_loader_creation_deletion_suite (void) g_test_add_func ("/libindicator/loader/dummy/simple_accessors", test_loader_filename_dummy_simple_accessors); g_test_add_func ("/libindicator/loader/dummy/simple_location", test_loader_filename_dummy_simple_location); g_test_add_func ("/libindicator/loader/dummy/signaler", test_loader_filename_dummy_signaler); + g_test_add_func ("/libindicator/loader/dummy/entry_funcs", test_loader_entry_funcs); + g_test_add_func ("/libindicator/loader/dummy/entry_func_window", test_loader_entry_func_window); + g_test_add_func ("/libindicator/loader/dummy/visible", test_loader_filename_dummy_visible); return; } |