[gxml] Tested Node.childs.size and its iteration



commit 208f9e9356f2c7c6d6dd6a191a54664482aa5315
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Apr 15 19:06:00 2015 -0500

    Tested Node.childs.size and its iteration

 gxml/libxml-ChildNodeList.vala         |    1 -
 test/SerializableGeeArrayListTest.vala |   18 ++++++++----------
 2 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/gxml/libxml-ChildNodeList.vala b/gxml/libxml-ChildNodeList.vala
index a514b9c..aee0d25 100644
--- a/gxml/libxml-ChildNodeList.vala
+++ b/gxml/libxml-ChildNodeList.vala
@@ -57,7 +57,6 @@ internal abstract class GXml.ChildNodeList : AbstractBidirList<xNode>, NodeList
                public override int size {
            get {
         if (head != null) {
-          //GLib.warning ("At NodeChildNodeList: get_size");
           int len = 1;
           var cur = head;
           while (cur->next != null) {
diff --git a/test/SerializableGeeArrayListTest.vala b/test/SerializableGeeArrayListTest.vala
index ec0d546..41d3062 100644
--- a/test/SerializableGeeArrayListTest.vala
+++ b/test/SerializableGeeArrayListTest.vala
@@ -73,21 +73,19 @@ class SerializableGeeArrayListTest : GXmlTest
         c.add (o1);
         c.add (o2);
         var doc = new xDocument ();
-        var root = (xElement) doc.create_element ("root");
+        var root = doc.create_element ("root");
         doc.childs.add (root);
-        c.serialize (root);
-        if (!root.has_child_nodes ()) {
-          stdout.printf (@"ERROR: root node have no childs $(doc)\n");
-          assert_not_reached ();
-        }
+        c.serialize ((xNode) root);
+        assert (root.childs.size == 2);
         bool found1 = false;
         bool found2 = false;
-        foreach (GXml.xNode n in root.child_nodes) {
-          if (n is xElement && n.node_name == "aelement") {
+        foreach (GXml.Node n in root.childs) {
+          GLib.message ("Node name ="+n.name);
+          if (n is Element && n.name == "aelement") {
             var name = ((xElement) n).get_attribute_node ("name");
             if (name != null) {
-              if (name.node_value == "Big") found1 = true;
-              if (name.node_value == "Small") found2 = true;
+              if (name.value == "Big") found1 = true;
+              if (name.value == "Small") found2 = true;
             }
           }
         }


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