[gnome-photos/wip/rishi/unit-tests] tests: Add unit tests



commit db89091bde76df433b11d9a163d1cc58d5b59bc2
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Oct 23 20:43:27 2018 +0200

    tests: Add unit tests

 configure.ac                      |  1 +
 tests/Makefile.am                 |  2 ++
 tests/unit/Makefile.am            | 30 +++++++++++++++++++++++++++++
 tests/unit/photos-test-pipeline.c | 40 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 73 insertions(+)
---
diff --git a/configure.ac b/configure.ac
index e399bdf5..274a4cb1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,6 +147,7 @@ help/Makefile
 subprojects/libgd/Makefile
 src/Makefile
 tests/Makefile
+tests/unit/Makefile
 po/Makefile.in
 ])
 AC_OUTPUT
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f3f3b201..8bc2dfa1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,7 @@
 include $(top_srcdir)/glib-tap.mk
 
+SUBDIRS = unit
+
 dogtail_tests = \
        basic.py \
        $(NULL)
diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am
new file mode 100644
index 00000000..aac931a1
--- /dev/null
+++ b/tests/unit/Makefile.am
@@ -0,0 +1,30 @@
+include $(top_srcdir)/glib-tap.mk
+
+TESTS_ENVIRONMENT += \
+       GSETTINGS_BACKEND=memory \
+       $(NULL)
+
+test_programs = \
+       photos-test-pipeline
+       $(NULL)
+
+AM_CFLAGS = \
+       $(WARN_CFLAGS) \
+       $(NULL)
+
+AM_CPPFLAGS = \
+       $(GLIB_CFLAGS) \
+       -I$(top_builddir)/src \
+       -I$(top_srcdir)/src \
+       $(NULL)
+
+LDADD = \
+       $(GLIB_LIBS) \
+       $(top_builddir)/src/libgnome-photos.la \
+       $(NULL)
+
+AM_LDFLAGS = \
+       $(WARN_LDFLAGS) \
+       $(NULL)
+
+-include $(top_srcdir)/git.mk
diff --git a/tests/unit/photos-test-pipeline.c b/tests/unit/photos-test-pipeline.c
new file mode 100644
index 00000000..ce0f2e75
--- /dev/null
+++ b/tests/unit/photos-test-pipeline.c
@@ -0,0 +1,40 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2018 Red Hat, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 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 "config.h"
+
+#include <locale.h>
+
+#include <glib.h>
+
+#include "photos-debug.h"
+
+
+gint
+main (gint argc, gchar *argv[])
+{
+  gint exit_status;
+
+  setlocale (LC_ALL, "");
+  g_test_init (&argc, &argv, NULL);
+  photos_debug_init ();
+
+  exit_status = g_test_run ();
+  return exit_status;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]