[gnome-software] Add some self tests for GsApp
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add some self tests for GsApp
- Date: Thu, 7 Mar 2013 16:06:29 +0000 (UTC)
commit bd07981fe5886b7225325527342c51dd74873f0b
Author: Richard Hughes <richard hughsie com>
Date: Thu Mar 7 09:41:37 2013 +0000
Add some self tests for GsApp
src/Makefile.am | 21 ++++++++++++++++++
src/gs-self-test.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 2c37685..b63f0d1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,6 +53,27 @@ BUILT_SOURCES = \
gs-resources.c \
gs-resources.h
+TESTS_ENVIRONMENT = \
+ libtool --mode=execute valgrind \
+ --quiet \
+ --leak-check=full \
+ --show-possibly-lost=no
+
+check_PROGRAMS = \
+ gs-self-test
+
+gs_self_test_SOURCES = \
+ gs-app.c \
+ gs-self-test.c
+
+gs_self_test_LDADD = \
+ $(GLIB_LIBS) \
+ $(GTK_LIBS)
+
+gs_self_test_CFLAGS = $(WARNINGFLAGS_C)
+
+TESTS = gs-self-test
+
EXTRA_DIST = \
core-apps.txt \
gnome-software.gresource.xml \
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
new file mode 100644
index 0000000..e43873b
--- /dev/null
+++ b/src/gs-self-test.c
@@ -0,0 +1,58 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2013 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU Lesser General Public License Version 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+#include "gs-app.h"
+
+static void
+gs_app_func (void)
+{
+ GsApp *app;
+
+ app = gs_app_new ("gnome-software");
+ g_assert (GS_IS_APP (app));
+
+ g_assert_cmpstr (gs_app_get_id (app), ==, "gnome-software");
+
+ g_object_unref (app);
+}
+
+int
+main (int argc, char **argv)
+{
+ g_type_init ();
+ gtk_init (&argc, &argv);
+ g_test_init (&argc, &argv, NULL);
+
+ /* only critical and error are fatal */
+ g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
+
+ /* tests go here */
+ g_test_add_func ("/gnome-software/app", gs_app_func);
+
+ return g_test_run ();
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]