[rygel] tests: Add test for bgo#661482



commit e76b1c8d649f25d8bf5a46c98cc9350f00d3b4f8
Author: Jens Georg <mail jensge org>
Date:   Sat Aug 11 23:11:28 2012 +0200

    tests: Add test for bgo#661482

 tests/Makefile.am           |   22 ++++++++++++++-
 tests/rygel-regression.vala |   64 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 1 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 338ce57..a021cc3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -41,7 +41,8 @@ check_PROGRAMS = rygel-http-item-uri-test \
 		 rygel-album-art-spec-test \
 		 rygel-http-post-test \
 		 rygel-searchable-container-test \
-		 rygel-item-creator-test
+		 rygel-item-creator-test \
+		 rygel-regression
 
 TESTS = $(check_PROGRAMS)
 
@@ -92,6 +93,25 @@ rygel_item_creator_test_SOURCES = rygel-item-creator-test.vala \
 				  rygel-relational-expression.vala \
 				  rygel-search-expression.vala
 
+rygel_regression_SOURCES = \
+	rygel-regression.vala
+
+rygel_regression_VALAFLAGS = \
+	$(AM_VALAFLAGS) \
+	--pkg rygel-server-1.0 \
+	--pkg rygel-core-1.0 \
+	--vapidir $(top_builddir)/src/librygel-server \
+	--vapidir $(top_builddir)/src/librygel-core
+
+rygel_regression_CFLAGS = \
+	$(AM_CFLAGS) -I$(top_builddir)/src/librygel-server \
+	-I$(top_builddir)/src/librygel-core
+
+rygel_regression_LDADD = \
+	$(LDADD) \
+	$(top_builddir)/src/librygel-server/librygel-server-1.0.la \
+	$(top_builddir)/src/librygel-core/librygel-core-1.0.la
+
 if ALWAYS_TEST
 all-local: check
 endif
diff --git a/tests/rygel-regression.vala b/tests/rygel-regression.vala
new file mode 100644
index 0000000..2a3325e
--- /dev/null
+++ b/tests/rygel-regression.vala
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2012 Jens Georg <mail jensge org>
+ *
+ * Author: Jens Georg <mail jensge org>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel 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.
+ *
+ * Rygel 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 program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+private class Rygel.Regression {
+    private MainLoop loop;
+
+    public static int main (string[] args) {
+        var test = new Regression ();
+
+        test.run ();
+
+        return 0;
+    }
+
+    public void run () {
+        this.loop = new MainLoop ();
+        test_661482.begin ();
+        loop.run ();
+    }
+
+    public async void test_661482 () {
+        var container = new SimpleContainer ("0", null, "0");
+        var item_1 = new ImageItem ("Z", container, "Z");
+        var item_2 = new ImageItem ("M", container, "M");
+        var item_3 = new ImageItem ("A", container, "A");
+
+        container.add_child_item (item_1);
+        container.add_child_item (item_2);
+        container.add_child_item (item_3);
+
+        try {
+            var list = yield container.get_children (0, 3, "+dc:title", null);
+            for (var i = 0; i < 3; ++i) {
+                var children = yield container.get_children (i,
+                                                             1,
+                                                             "+dc:title",
+                                                             null);
+                assert (children[0].title == list[i].title);
+            }
+
+        } catch (Error error) { assert_not_reached (); }
+
+        loop.quit ();
+    }
+}



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