[gtk+] Put all GtkTreeModel unit tests in a single binary



commit 2cb9f03a66eb2f32139d72e475e41c45844e68cd
Author: Kristian Rietveld <kris gtk org>
Date:   Mon May 9 08:25:27 2011 +0200

    Put all GtkTreeModel unit tests in a single binary
    
    This to reduce linking time and have all tests in a single binary.

 gtk/tests/Makefile.am   |   14 +++-----------
 gtk/tests/filtermodel.c |    9 ++-------
 gtk/tests/liststore.c   |   11 ++++-------
 gtk/tests/treemodel.c   |   35 +++++++++++++++++++++++++++++++++++
 gtk/tests/treemodel.h   |   22 ++++++++++++++++++++++
 gtk/tests/treestore.c   |    9 ++-------
 6 files changed, 68 insertions(+), 32 deletions(-)
---
diff --git a/gtk/tests/Makefile.am b/gtk/tests/Makefile.am
index ff5720d..6219d10 100644
--- a/gtk/tests/Makefile.am
+++ b/gtk/tests/Makefile.am
@@ -27,13 +27,9 @@ TEST_PROGS			+= testing
 testing_SOURCES			 = testing.c
 testing_LDADD			 = $(progs_ldadd)
 
-TEST_PROGS			+= liststore
-liststore_SOURCES		 = liststore.c
-liststore_LDADD			 = $(progs_ldadd)
-
-TEST_PROGS			+= treestore
-treestore_SOURCES		 = treestore.c
-treestore_LDADD			 = $(progs_ldadd)
+TEST_PROGS			+= treemodel
+treemodel_SOURCES		 = treemodel.c liststore.c treestore.c filtermodel.c
+treemodel_LDADD			 = $(progs_ldadd)
 
 TEST_PROGS			+= treeview
 treeview_SOURCES		 = treeview.c
@@ -86,10 +82,6 @@ TEST_PROGS			+= textiter
 textiter_SOURCES		 = textiter.c
 textiter_LDADD			 = $(progs_ldadd)
 
-TEST_PROGS			+= filtermodel
-filtermodel_SOURCES		 = filtermodel.c
-filtermodel_LDADD		 = $(progs_ldadd)
-
 TEST_PROGS			+= expander
 expander_SOURCES		 = expander.c
 expander_LDADD			 = $(progs_ldadd)
diff --git a/gtk/tests/filtermodel.c b/gtk/tests/filtermodel.c
index 91daaf9..30f5e27 100644
--- a/gtk/tests/filtermodel.c
+++ b/gtk/tests/filtermodel.c
@@ -2823,12 +2823,9 @@ specific_bug_549287 (void)
 
 /* main */
 
-int
-main (int    argc,
-      char **argv)
+void
+register_filter_model_tests (void)
 {
-  gtk_test_init (&argc, &argv, NULL);
-
   g_test_add ("/FilterModel/self/verify-test-suite",
               FilterTest, NULL,
               filter_test_setup,
@@ -2995,6 +2992,4 @@ main (int    argc,
                    specific_bug_540201);
   g_test_add_func ("/FilterModel/specific/bug-549287",
                    specific_bug_549287);
-
-  return g_test_run ();
 }
diff --git a/gtk/tests/liststore.c b/gtk/tests/liststore.c
index e710d9b..3cbf170 100644
--- a/gtk/tests/liststore.c
+++ b/gtk/tests/liststore.c
@@ -27,6 +27,8 @@
 
 #include <gtk/gtk.h>
 
+#include "treemodel.h"
+
 static inline gboolean
 iters_equal (GtkTreeIter *a,
 	     GtkTreeIter *b)
@@ -998,12 +1000,9 @@ list_store_test_iter_parent_invalid (ListStore     *fixture,
 
 /* main */
 
-int
-main (int    argc,
-      char **argv)
+void
+register_list_store_tests (void)
 {
-  gtk_test_init (&argc, &argv, NULL);
-
   /* insertion */
   g_test_add_func ("/list-store/insert-high-values",
 	           list_store_test_insert_high_values);
@@ -1120,6 +1119,4 @@ main (int    argc,
   g_test_add ("/list-store/iter-parent-invalid", ListStore, NULL,
               list_store_setup, list_store_test_iter_parent_invalid,
               list_store_teardown);
-
-  return g_test_run ();
 }
diff --git a/gtk/tests/treemodel.c b/gtk/tests/treemodel.c
new file mode 100644
index 0000000..fd91047
--- /dev/null
+++ b/gtk/tests/treemodel.c
@@ -0,0 +1,35 @@
+/* Main wrapper for TreeModel test suite.
+ * Copyright (C) 2011  Kristian Rietveld  <kris gtk org>
+ *
+ * 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+#include "treemodel.h"
+
+int
+main (int    argc,
+      char **argv)
+{
+  gtk_test_init (&argc, &argv, NULL);
+
+  register_list_store_tests ();
+  register_tree_store_tests ();
+  register_filter_model_tests ();
+
+  return g_test_run ();
+}
diff --git a/gtk/tests/treemodel.h b/gtk/tests/treemodel.h
new file mode 100644
index 0000000..504f31b
--- /dev/null
+++ b/gtk/tests/treemodel.h
@@ -0,0 +1,22 @@
+/* Main wrapper for TreeModel test suite.
+ * Copyright (C) 2011  Kristian Rietveld  <kris gtk org>
+ *
+ * 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 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+void register_list_store_tests ();
+void register_tree_store_tests ();
+void register_filter_model_tests ();
diff --git a/gtk/tests/treestore.c b/gtk/tests/treestore.c
index 663eaaf..9ad1161 100644
--- a/gtk/tests/treestore.c
+++ b/gtk/tests/treestore.c
@@ -1001,12 +1001,9 @@ tree_store_test_iter_parent_invalid (TreeStore     *fixture,
 
 /* main */
 
-int
-main (int    argc,
-      char **argv)
+void
+register_tree_store_tests (void)
 {
-  gtk_test_init (&argc, &argv, NULL);
-
   /* insertion */
   g_test_add_func ("/tree-store/insert-high-values",
 	           tree_store_test_insert_high_values);
@@ -1123,6 +1120,4 @@ main (int    argc,
   g_test_add ("/tree-store/iter-parent-invalid", TreeStore, NULL,
               tree_store_setup, tree_store_test_iter_parent_invalid,
               tree_store_teardown);
-
-  return g_test_run ();
 }



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