From 53c9f60b7438764853c54d977a37b267bdf64485 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Feb 2010 15:24:51 -0600 Subject: Adding in a basic test desktop file test --- tests/Makefile.am | 35 +++++++++++++++++++++++++++++++++++ tests/test-desktop-shortcuts.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 tests/test-desktop-shortcuts.c diff --git a/tests/Makefile.am b/tests/Makefile.am index b111655..ab776a9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -33,6 +33,41 @@ test_loader_LDADD = \ -L$(top_builddir)/libindicator/.libs \ -lindicator +############################# +# Test Desktop Shortcuts +############################# + +check_PROGRAMS += test-desktop-shortcuts + +test_desktop_shortcuts_SOURCES = \ + test-desktop-shortcuts.c + +test_desktop_shortcuts_CFLAGS = \ + -Wall -Werror \ + -DSRCDIR="\"$(srcdir)\"" \ + $(LIBINDICATOR_CFLAGS) -I$(top_srcdir) \ + -DBUILD_DIR="\"$(builddir)\"" + +test_desktop_shortcuts_LDADD = \ + $(LIBINDICATOR_LIBS) \ + -L$(top_builddir)/libindicator/.libs \ + -lindicator + +DS_XML_REPORT = desktop-shortcuts-check-results.xml +DS_HTML_REPORT = desktop-shortcuts-check-results.html + +test-desktop-shortcuts-tester: test-desktop-shortcuts Makefile.am + @echo "#!/bin/bash" > $@ + @echo $(XVFB_RUN) >> $@ + @echo gtester -k --verbose -o=$(XML_REPORT) ./test-desktop-shortcuts >> $@ + @chmod +x $@ + +TESTS += test-desktop-shortcuts-tester +DISTCLEANFILES += test-desktop-shortcuts-tester \ + $(DS_XML_REPORT) + $(DS_HTML_REPORT) + + ############################# # Dummy Indicator Blank ############################# diff --git a/tests/test-desktop-shortcuts.c b/tests/test-desktop-shortcuts.c new file mode 100644 index 0000000..3368c9e --- /dev/null +++ b/tests/test-desktop-shortcuts.c @@ -0,0 +1,38 @@ +#include +#include "libindicator/indicator-desktop-shortcuts.h" + +void +test_desktop_shortcuts_creation (void) +{ + + IndicatorDesktopShortcuts * ids = indicator_desktop_shortcuts_new(SRCDIR "/test-well-formed.desktop", "France"); + g_assert(ids != NULL); + + g_object_add_weak_pointer(G_OBJECT(ids), (gpointer *)&ids); + g_object_unref(G_OBJECT(ids)); + + g_assert(ids == NULL); + return; +} + +void +test_desktop_shortcuts_suite (void) +{ + g_test_add_func ("/libindicator/desktopshortcuts/creation", test_desktop_shortcuts_creation); + + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init (); + g_test_init (&argc, &argv, NULL); + gtk_init(&argc, &argv); + + test_desktop_shortcuts_suite(); + + g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); + + return g_test_run(); +} -- cgit v1.2.3