[rygel/wip/track-changes: 128/128] WIP



commit 24599c6bd9d3ed26b213664581f5eaa094293f46
Author: Jens Georg <jensg openismus com>
Date:   Wed Oct 17 11:22:41 2012 +0200

    WIP

 .../mediathek/rygel-mediathek-rss-container.vala   |    4 +-
 tests/Makefile.am                                  |   16 +++++-
 tests/rygel-last-change-test.vala                  |   60 +++++++++++++++++++-
 3 files changed, 74 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/mediathek/rygel-mediathek-rss-container.vala b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
index c2b9bae..6e5dc14 100644
--- a/src/plugins/mediathek/rygel-mediathek-rss-container.vala
+++ b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
@@ -39,9 +39,7 @@ public class Rygel.Mediathek.RssContainer : Rygel.SimpleContainer {
         this.content_id = id;
         this.feed_uri = uri_template.printf (id);
         this.sort_criteria = "-dc:date,+dc:title";
-        Timeout.add_seconds (40, () => { this.update.begin (); return false;
-                });
-        // this.update.begin ();
+        this.update.begin ();
     }
 
     public async void update () {
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 02d5ffa..16781a5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -163,8 +163,22 @@ rygel_media_engine_test_LDADD = \
 
 rygel_last_change_test_SOURCES = rygel-last-change-test.vala
 rygel_last_change_test_CFLAGS = $(AM_CFLAGS) \
+	-I$(top_builddir)/src/librygel-server \
+	-I$(top_srcdir)/src/librygel-server \
+	-I$(top_builddir)/src/librygel-core \
+	-I$(top_srcdir)/src/librygel-core \
 	-DTEST_DATA_FOLDER='"$(abs_srcdir)/data"'
-rygel_last_change_test_VALAFLAGS = --pkg gupnp-1.0 --pkg libxml-2.0
+rygel_last_change_test_VALAFLAGS = \
+	--pkg rygel-server-2.0 \
+	--pkg rygel-core-2.0 \
+	--vapidir $(top_builddir)/src/librygel-server \
+	--vapidir $(top_builddir)/src/librygel-core
+
+rygel_last_change_test_LDADD = \
+	$(LDADD) \
+	$(top_builddir)/src/librygel-server/librygel-server-2.0.la \
+	$(top_builddir)/src/librygel-core/librygel-core-2.0.la
+
 
 if HAVE_GSTREAMER
 check_PROGRAMS += \
diff --git a/tests/rygel-last-change-test.vala b/tests/rygel-last-change-test.vala
index 9f38380..6fdb7c9 100644
--- a/tests/rygel-last-change-test.vala
+++ b/tests/rygel-last-change-test.vala
@@ -29,6 +29,46 @@ extern const string TEST_DATA_FOLDER;
 static const string TARGET =
     "urn:schemas-upnp-org:service:ContentDirectory:3";
 
+public enum Testcase {
+    ADD_OBJECT,
+    CHANGE_OBJECT,
+    REMOVE_OBJECT,
+}
+
+public class TestContainer : Rygel.MediaContainer {
+    public TestContainer (string id,
+                          Rygel.MediaContainer? parent,
+                          string title,
+                          int child_count) {
+        base (id, parent, title, child_count);
+    }
+
+    public async override  Rygel.MediaObjects? get_children (uint offset,
+                                                             uint max_count,
+                                                             string sort_criteria,
+                                                             Cancellable? cancellable)
+                                                   throws GLib.Error {
+        return null;
+    }
+
+    public async override Rygel.MediaObject? find_object (string id,
+                                                          Cancellable? cancellable)
+                                                          throws GLib.Error {
+        return null;
+    }
+}
+
+public class TestItem : Rygel.MediaItem {
+    public TestItem (string id,
+                     Rygel.MediaContainer parent,
+                     string title,
+                     string upnp_class) {
+        base (id, parent, title, upnp_class);
+    }
+
+    public override bool streamable () { return false; }
+}
+
 public class LastChangeTest : Object {
     private MainLoop loop;
     private ControlPoint cp;
@@ -38,6 +78,8 @@ public class LastChangeTest : Object {
     private SchemaValidCtxt *valid_ctxt;
     private Schema *schema;
 
+    Testcase test;
+
     ~LastChangeTest () {
         delete this.valid_ctxt;
         delete this.schema;
@@ -49,13 +91,27 @@ public class LastChangeTest : Object {
         var doc = Parser.read_memory (content, content.length);
         assert (doc != null);
         assert (this.valid_ctxt->validate_doc (doc) == 0);
-        debug (content);
+
+        // Check if the entries are in order of the update id
+        int64 updateId = -1;
+        var child = doc->children->children;
+        while (child != null) {
+            if (child->type == ElementType.ELEMENT_NODE) {
+                var id = child->get_prop ("updateID");
+                assert (id != null);
+                assert (int64.parse (id) > updateId);
+                updateId = int64.parse (id);
+            }
+            child = child->next;
+        }
+
+        switch (this.test) {
+        }
     }
 
     private void on_sp_available (ServiceProxy p) {
         this.proxy = p;
         Source.remove (this.timeout);
-        debug ("====> Got proxy: %llu", get_real_time ());
         try {
             // Check if the service offers the LastChange state variable
             var last_change = false;



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