From 208f9e9356f2c7c6d6dd6a191a54664482aa5315 Mon Sep 17 00:00:00 2001 From: Daniel Espinosa Date: Wed, 15 Apr 2015 19:06:00 -0500 Subject: [PATCH] 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 a514b9c5..aee0d256 100644 --- a/gxml/libxml-ChildNodeList.vala +++ b/gxml/libxml-ChildNodeList.vala @@ -57,7 +57,6 @@ internal abstract class GXml.ChildNodeList : AbstractBidirList, 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 ec0d546a..41d3062b 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; } } } -- GitLab