Skip to content
Snippets Groups Projects
Commit 3e654cc5 authored by Richard Schwarting's avatar Richard Schwarting
Browse files

test/*.vala: change DomNode to GXml.Node

parent 3f8177ca
Branches
Tags
No related merge requests found
...@@ -6,7 +6,7 @@ class AttrTest : GXmlTest { ...@@ -6,7 +6,7 @@ class AttrTest : GXmlTest {
Test.add_func ("/gxml/element/namespace_uri", () => { Test.add_func ("/gxml/element/namespace_uri", () => {
try { try {
Document doc = new Document.from_string ("<Wands xmlns:wands=\"http://mom.co.uk/wands\"><Wand price=\"43.56\" wands:core=\"dragon heart cord\" wands:shell=\"oak\"/></Wands>"); Document doc = new Document.from_string ("<Wands xmlns:wands=\"http://mom.co.uk/wands\"><Wand price=\"43.56\" wands:core=\"dragon heart cord\" wands:shell=\"oak\"/></Wands>");
DomNode root = doc.document_element; GXml.Node root = doc.document_element;
Element node = (Element)root.child_nodes.item (0); Element node = (Element)root.child_nodes.item (0);
Attr core = node.get_attribute_node ("core"); Attr core = node.get_attribute_node ("core");
...@@ -24,7 +24,7 @@ class AttrTest : GXmlTest { ...@@ -24,7 +24,7 @@ class AttrTest : GXmlTest {
Test.add_func ("/gxml/element/prefix", () => { Test.add_func ("/gxml/element/prefix", () => {
try { try {
Document doc = new Document.from_string ("<Wands xmlns:wands=\"http://mom.co.uk/wands\"><Wand price=\"43.56\" wands:core=\"dragon heart cord\" wands:shell=\"oak\"/></Wands>"); Document doc = new Document.from_string ("<Wands xmlns:wands=\"http://mom.co.uk/wands\"><Wand price=\"43.56\" wands:core=\"dragon heart cord\" wands:shell=\"oak\"/></Wands>");
DomNode root = doc.document_element; GXml.Node root = doc.document_element;
Element node = (Element)root.child_nodes.item (0); Element node = (Element)root.child_nodes.item (0);
Attr core = node.get_attribute_node ("core"); Attr core = node.get_attribute_node ("core");
...@@ -42,7 +42,7 @@ class AttrTest : GXmlTest { ...@@ -42,7 +42,7 @@ class AttrTest : GXmlTest {
Test.add_func ("/gxml/element/local_name", () => { Test.add_func ("/gxml/element/local_name", () => {
try { try {
Document doc = new Document.from_string ("<Wands xmlns:wands=\"http://mom.co.uk/wands\"><Wand price=\"43.56\" wands:core=\"dragon heart cord\" wands:shell=\"oak\"/></Wands>"); Document doc = new Document.from_string ("<Wands xmlns:wands=\"http://mom.co.uk/wands\"><Wand price=\"43.56\" wands:core=\"dragon heart cord\" wands:shell=\"oak\"/></Wands>");
DomNode root = doc.document_element; GXml.Node root = doc.document_element;
Element node = (Element)root.child_nodes.item (0); Element node = (Element)root.child_nodes.item (0);
Attr core = node.get_attribute_node ("core"); Attr core = node.get_attribute_node ("core");
......
...@@ -73,7 +73,7 @@ class DocumentTest : GXmlTest { ...@@ -73,7 +73,7 @@ class DocumentTest : GXmlTest {
string xml = "<Fruits><Apple></Apple><Orange></Orange></Fruits>"; string xml = "<Fruits><Apple></Apple><Orange></Orange></Fruits>";
Document doc = new Document.from_string (xml); Document doc = new Document.from_string (xml);
DomNode root = doc.document_element; GXml.Node root = doc.document_element;
assert (root.node_name == "Fruits"); assert (root.node_name == "Fruits");
assert (root.has_child_nodes () == true); assert (root.has_child_nodes () == true);
assert (root.first_child.node_name == "Apple"); assert (root.first_child.node_name == "Apple");
...@@ -347,8 +347,8 @@ class DocumentTest : GXmlTest { ...@@ -347,8 +347,8 @@ class DocumentTest : GXmlTest {
"); ");
} }
public static void print_node (DomNode node) { public static void print_node (GXml.Node node) {
List<GXml.DomNode> children = (List<GXml.DomNode>)node.child_nodes; List<GXml.Node> children = (List<GXml.Node>)node.child_nodes;
if (node.node_type != 3) if (node.node_type != 3)
GLib.stdout.printf ("<%s", node.node_name); GLib.stdout.printf ("<%s", node.node_name);
...@@ -361,7 +361,7 @@ class DocumentTest : GXmlTest { ...@@ -361,7 +361,7 @@ class DocumentTest : GXmlTest {
GLib.stdout.printf (">"); GLib.stdout.printf (">");
if (node.node_value != null) if (node.node_value != null)
GLib.stdout.printf ("%s", node.node_value); GLib.stdout.printf ("%s", node.node_value);
foreach (GXml.DomNode child in children) { foreach (GXml.Node child in children) {
// TODO: want a stringification method for Nodes? // TODO: want a stringification method for Nodes?
print_node (child); print_node (child);
} }
......
...@@ -33,8 +33,8 @@ class ElementTest : GXmlTest { ...@@ -33,8 +33,8 @@ class ElementTest : GXmlTest {
xmlroot->add_child (xmlnode); xmlroot->add_child (xmlnode);
Document doc = new Document.from_libxml2 (xmldoc); Document doc = new Document.from_libxml2 (xmldoc);
DomNode root = doc.document_element; GXml.Node root = doc.document_element;
DomNode node = root.child_nodes.item (0); GXml.Node node = root.child_nodes.item (0);
assert (node.namespace_uri == null); assert (node.namespace_uri == null);
assert (node.prefix == null); assert (node.prefix == null);
...@@ -52,8 +52,8 @@ class ElementTest : GXmlTest { ...@@ -52,8 +52,8 @@ class ElementTest : GXmlTest {
try { try {
// TODO: wanted to use TestElement but CAN'T because Vala won't let me access the internal constructor of Element? // TODO: wanted to use TestElement but CAN'T because Vala won't let me access the internal constructor of Element?
Document doc = new Document.from_string ("<Potions><magic:Potion xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>"); Document doc = new Document.from_string ("<Potions><magic:Potion xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>");
DomNode root = doc.document_element; GXml.Node root = doc.document_element;
DomNode node = root.child_nodes.item (0); GXml.Node node = root.child_nodes.item (0);
assert (node.namespace_uri == "http://hogwarts.co.uk/magic"); assert (node.namespace_uri == "http://hogwarts.co.uk/magic");
} catch (GXml.DomError e) { } catch (GXml.DomError e) {
...@@ -65,8 +65,8 @@ class ElementTest : GXmlTest { ...@@ -65,8 +65,8 @@ class ElementTest : GXmlTest {
try { try {
// TODO: wanted to use TestElement but CAN'T because Vala won't let me access the internal constructor of Element? // TODO: wanted to use TestElement but CAN'T because Vala won't let me access the internal constructor of Element?
Document doc = new Document.from_string ("<Potions><magic:Potion xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"><products:Ingredient /></magic:Potion></Potions>"); Document doc = new Document.from_string ("<Potions><magic:Potion xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"><products:Ingredient /></magic:Potion></Potions>");
DomNode root = doc.document_element; GXml.Node root = doc.document_element;
DomNode node = root.child_nodes.item (0); GXml.Node node = root.child_nodes.item (0);
// root.dbg_inspect (); // root.dbg_inspect ();
// node.dbg_inspect (); // node.dbg_inspect ();
...@@ -87,8 +87,8 @@ class ElementTest : GXmlTest { ...@@ -87,8 +87,8 @@ class ElementTest : GXmlTest {
Test.add_func ("/gxml/element/prefix", () => { Test.add_func ("/gxml/element/prefix", () => {
try { try {
Document doc = new Document.from_string ("<Potions><magic:Potion xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>"); Document doc = new Document.from_string ("<Potions><magic:Potion xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>");
DomNode root = doc.document_element; GXml.Node root = doc.document_element;
DomNode node = root.child_nodes.item (0); GXml.Node node = root.child_nodes.item (0);
assert (node.prefix == "magic"); assert (node.prefix == "magic");
} catch (GXml.DomError e) { } catch (GXml.DomError e) {
...@@ -99,8 +99,8 @@ class ElementTest : GXmlTest { ...@@ -99,8 +99,8 @@ class ElementTest : GXmlTest {
Test.add_func ("/gxml/element/local_name", () => { Test.add_func ("/gxml/element/local_name", () => {
try { try {
Document doc = new Document.from_string ("<Potions><magic:Potion xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>"); Document doc = new Document.from_string ("<Potions><magic:Potion xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>");
DomNode root = doc.document_element; GXml.Node root = doc.document_element;
DomNode node = root.child_nodes.item (0); GXml.Node node = root.child_nodes.item (0);
assert (node.local_name == "Potion"); assert (node.local_name == "Potion");
} catch (GXml.DomError e) { } catch (GXml.DomError e) {
...@@ -111,8 +111,8 @@ class ElementTest : GXmlTest { ...@@ -111,8 +111,8 @@ class ElementTest : GXmlTest {
Test.add_func ("/gxml/element/namespace_definitions", () => { Test.add_func ("/gxml/element/namespace_definitions", () => {
try { try {
Document doc = new Document.from_string ("<Potions><magic:Potion xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>"); Document doc = new Document.from_string ("<Potions><magic:Potion xmlns:magic=\"http://hogwarts.co.uk/magic\" xmlns:products=\"http://diagonalley.co.uk/products\"/></Potions>");
DomNode root = doc.document_element; GXml.Node root = doc.document_element;
DomNode node = root.child_nodes.item (0); GXml.Node node = root.child_nodes.item (0);
NodeList namespaces = node.namespace_definitions; NodeList namespaces = node.namespace_definitions;
...@@ -180,8 +180,8 @@ class ElementTest : GXmlTest { ...@@ -180,8 +180,8 @@ class ElementTest : GXmlTest {
try { try {
Document doc = new Document.from_string ("<?xml version='1.0' encoding='UTF-8'?><entry><link rel='http://schemas.google.com/contacts/2008/rel#photo'/></entry>"); Document doc = new Document.from_string ("<?xml version='1.0' encoding='UTF-8'?><entry><link rel='http://schemas.google.com/contacts/2008/rel#photo'/></entry>");
DomNode root = doc.document_element; GXml.Node root = doc.document_element;
foreach (DomNode child in root.child_nodes) { foreach (GXml.Node child in root.child_nodes) {
attrs = child.attributes; attrs = child.attributes;
} }
...@@ -288,7 +288,7 @@ class ElementTest : GXmlTest { ...@@ -288,7 +288,7 @@ class ElementTest : GXmlTest {
Test.add_func ("/gxml/element/get_elements_by_tag_name", () => { Test.add_func ("/gxml/element/get_elements_by_tag_name", () => {
try { try {
Document doc; Document doc;
DomNode root; GXml.Node root;
Element elem; Element elem;
NodeList emails; NodeList emails;
Element email; Element email;
...@@ -361,10 +361,10 @@ class ElementTest : GXmlTest { ...@@ -361,10 +361,10 @@ class ElementTest : GXmlTest {
</A>"; </A>";
doc = new Document.from_string (xml); doc = new Document.from_string (xml);
DomNode a = doc.document_element; GXml.Node a = doc.document_element;
DomNode bs = a.child_nodes.item (3); GXml.Node bs = a.child_nodes.item (3);
DomNode b3 = bs.child_nodes.item (7); GXml.Node b3 = bs.child_nodes.item (7);
DomNode t1, t2; GXml.Node t1, t2;
NodeList ts = ((Element)bs).get_elements_by_tag_name ("t"); NodeList ts = ((Element)bs).get_elements_by_tag_name ("t");
assert (ts.length == 5); assert (ts.length == 5);
...@@ -378,8 +378,8 @@ class ElementTest : GXmlTest { ...@@ -378,8 +378,8 @@ class ElementTest : GXmlTest {
assert (ts.length == 7); assert (ts.length == 7);
// Test situation where we add a node tree // Test situation where we add a node tree
DomNode b4; GXml.Node b4;
DomNode d, d2; GXml.Node d, d2;
b4 = doc.create_element ("B"); b4 = doc.create_element ("B");
b4.append_child (doc.create_element ("t")); b4.append_child (doc.create_element ("t"));
......
...@@ -27,7 +27,7 @@ class GXmlTest { ...@@ -27,7 +27,7 @@ class GXmlTest {
GLib.Log.set_always_fatal (GLib.LogLevelFlags.FLAG_RECURSION | GLib.LogLevelFlags.LEVEL_ERROR | GLib.LogLevelFlags.LEVEL_CRITICAL); GLib.Log.set_always_fatal (GLib.LogLevelFlags.FLAG_RECURSION | GLib.LogLevelFlags.LEVEL_ERROR | GLib.LogLevelFlags.LEVEL_CRITICAL);
DocumentTest.add_tests (); DocumentTest.add_tests ();
DomNodeTest.add_tests (); NodeTest.add_tests ();
ElementTest.add_tests (); ElementTest.add_tests ();
AttrTest.add_tests (); AttrTest.add_tests ();
NodeListTest.add_tests (); NodeListTest.add_tests ();
......
...@@ -29,7 +29,7 @@ gxml_test_SOURCES = \ ...@@ -29,7 +29,7 @@ gxml_test_SOURCES = \
AttrTest.vala \ AttrTest.vala \
CharacterDataTest.vala \ CharacterDataTest.vala \
DocumentTest.vala \ DocumentTest.vala \
DomNodeTest.vala \ NodeTest.vala \
ElementTest.vala \ ElementTest.vala \
GXmlTest.vala \ GXmlTest.vala \
NodeListTest.vala \ NodeListTest.vala \
......
...@@ -4,18 +4,18 @@ using GXml; ...@@ -4,18 +4,18 @@ using GXml;
/* For testing, based on: /* For testing, based on:
https://live.gnome.org/Vala/TestSample https://live.gnome.org/Vala/TestSample
Using an Element subclass of Node to test Node. Using an Element subclass of GXml.Node to test Node.
*/ */
class DomNodeTest : GXmlTest { class NodeTest : GXmlTest {
// TODO: test setters? // TODO: test setters?
public static void add_tests () { public static void add_tests () {
Test.add_func ("/gxml/domnode/node_name_get", () => { Test.add_func ("/gxml/domnode/node_name_get", () => {
try { try {
// TODO: should DomNodes never have a null name? // TODO: should Nodes never have a null name?
Document doc = get_doc (); Document doc = get_doc ();
DomNode node; GXml.Node node;
node = get_elem ("elemname", doc); node = get_elem ("elemname", doc);
assert (node.node_name == "elemname"); assert (node.node_name == "elemname");
...@@ -61,7 +61,7 @@ class DomNodeTest : GXmlTest { ...@@ -61,7 +61,7 @@ class DomNodeTest : GXmlTest {
// TODO: implement commented-out types // TODO: implement commented-out types
Document doc = get_doc (); Document doc = get_doc ();
DomNode node; GXml.Node node;
node = get_elem ("a", doc); node = get_elem ("a", doc);
assert (node.node_type == NodeType.ELEMENT); assert (node.node_type == NodeType.ELEMENT);
...@@ -110,7 +110,7 @@ class DomNodeTest : GXmlTest { ...@@ -110,7 +110,7 @@ class DomNodeTest : GXmlTest {
Document doc = get_doc (); Document doc = get_doc ();
DomNode node; GXml.Node node;
node = doc.create_element ("elem"); node = doc.create_element ("elem");
assert (node.node_value == null); assert (node.node_value == null);
...@@ -142,8 +142,8 @@ class DomNodeTest : GXmlTest { ...@@ -142,8 +142,8 @@ class DomNodeTest : GXmlTest {
// assert (attr.node_value == "harry"); // assert (attr.node_value == "harry");
/* TODO: figure out a solution. /* TODO: figure out a solution.
Attr's node_value doesn't get used when elem is thought of Attr's node_value doesn't get used when elem is thought of
as a DomNode. as a Node.
DomNode wants to get it from DomNode's Xml.Node* node, GXml.Node wants to get it from Node's Xml.Node* node,
while Attr wants to get it from Attr's Xml.Attr* node. :( */ while Attr wants to get it from Attr's Xml.Attr* node. :( */
} catch (GXml.DomError e) { } catch (GXml.DomError e) {
Test.message ("%s", e.message); Test.message ("%s", e.message);
...@@ -153,14 +153,14 @@ class DomNodeTest : GXmlTest { ...@@ -153,14 +153,14 @@ class DomNodeTest : GXmlTest {
Test.add_func ("/gxml/domnode/parent_node", () => { Test.add_func ("/gxml/domnode/parent_node", () => {
try { try {
Document doc = get_doc (); Document doc = get_doc ();
DomNode parent = get_elem ("James", doc); GXml.Node parent = get_elem ("James", doc);
DomNode child = get_elem ("Harry", doc); GXml.Node child = get_elem ("Harry", doc);
assert (child.parent_node == null); assert (child.parent_node == null);
parent.append_child (child); parent.append_child (child);
assert (child.parent_node == parent); assert (child.parent_node == parent);
DomNode attr = doc.create_attribute ("a"); GXml.Node attr = doc.create_attribute ("a");
assert (attr.parent_node == null); assert (attr.parent_node == null);
assert (doc.parent_node == null); assert (doc.parent_node == null);
// assert (document fragment's parent_node == null); // TODO // assert (document fragment's parent_node == null); // TODO
...@@ -172,10 +172,10 @@ class DomNodeTest : GXmlTest { ...@@ -172,10 +172,10 @@ class DomNodeTest : GXmlTest {
Test.add_func ("/gxml/domnode/child_nodes", () => { Test.add_func ("/gxml/domnode/child_nodes", () => {
try { try {
Document doc = get_doc (); Document doc = get_doc ();
DomNode parent = get_elem ("Molly", doc); GXml.Node parent = get_elem ("Molly", doc);
DomNode child_0 = get_elem ("Percy", doc); GXml.Node child_0 = get_elem ("Percy", doc);
DomNode child_1 = get_elem ("Ron", doc); GXml.Node child_1 = get_elem ("Ron", doc);
DomNode child_2 = get_elem ("Ginnie", doc); GXml.Node child_2 = get_elem ("Ginnie", doc);
assert (parent.child_nodes.length == 0); assert (parent.child_nodes.length == 0);
parent.append_child (child_0); parent.append_child (child_0);
...@@ -192,10 +192,10 @@ class DomNodeTest : GXmlTest { ...@@ -192,10 +192,10 @@ class DomNodeTest : GXmlTest {
Test.add_func ("/gxml/domnode/first_child", () => { Test.add_func ("/gxml/domnode/first_child", () => {
try { try {
Document doc = get_doc (); Document doc = get_doc ();
DomNode parent = get_elem ("Molly", doc); GXml.Node parent = get_elem ("Molly", doc);
DomNode child_0 = get_elem ("Percy", doc); GXml.Node child_0 = get_elem ("Percy", doc);
DomNode child_1 = get_elem ("Ron", doc); GXml.Node child_1 = get_elem ("Ron", doc);
DomNode child_2 = get_elem ("Ginnie", doc); GXml.Node child_2 = get_elem ("Ginnie", doc);
assert (parent.child_nodes.length == 0); assert (parent.child_nodes.length == 0);
parent.append_child (child_0); parent.append_child (child_0);
...@@ -211,10 +211,10 @@ class DomNodeTest : GXmlTest { ...@@ -211,10 +211,10 @@ class DomNodeTest : GXmlTest {
Test.add_func ("/gxml/domnode/last_child", () => { Test.add_func ("/gxml/domnode/last_child", () => {
try { try {
Document doc = get_doc (); Document doc = get_doc ();
DomNode parent = get_elem ("Molly", doc); GXml.Node parent = get_elem ("Molly", doc);
DomNode child_0 = get_elem ("Percy", doc); GXml.Node child_0 = get_elem ("Percy", doc);
DomNode child_1 = get_elem ("Ron", doc); GXml.Node child_1 = get_elem ("Ron", doc);
DomNode child_2 = get_elem ("Ginnie", doc); GXml.Node child_2 = get_elem ("Ginnie", doc);
assert (parent.child_nodes.length == 0); assert (parent.child_nodes.length == 0);
parent.append_child (child_0); parent.append_child (child_0);
...@@ -230,10 +230,10 @@ class DomNodeTest : GXmlTest { ...@@ -230,10 +230,10 @@ class DomNodeTest : GXmlTest {
Test.add_func ("/gxml/domnode/previous_sibling", () => { Test.add_func ("/gxml/domnode/previous_sibling", () => {
try { try {
Document doc = get_doc (); Document doc = get_doc ();
DomNode parent = get_elem ("Molly", doc); GXml.Node parent = get_elem ("Molly", doc);
DomNode child_0 = get_elem ("Percy", doc); GXml.Node child_0 = get_elem ("Percy", doc);
DomNode child_1 = get_elem ("Ron", doc); GXml.Node child_1 = get_elem ("Ron", doc);
DomNode child_2 = get_elem ("Ginnie", doc); GXml.Node child_2 = get_elem ("Ginnie", doc);
assert (parent.child_nodes.length == 0); assert (parent.child_nodes.length == 0);
parent.append_child (child_0); parent.append_child (child_0);
...@@ -251,10 +251,10 @@ class DomNodeTest : GXmlTest { ...@@ -251,10 +251,10 @@ class DomNodeTest : GXmlTest {
Test.add_func ("/gxml/domnode/next_sibling", () => { Test.add_func ("/gxml/domnode/next_sibling", () => {
try { try {
Document doc = get_doc (); Document doc = get_doc ();
DomNode parent = get_elem ("Molly", doc); GXml.Node parent = get_elem ("Molly", doc);
DomNode child_0 = get_elem ("Percy", doc); GXml.Node child_0 = get_elem ("Percy", doc);
DomNode child_1 = get_elem ("Ron", doc); GXml.Node child_1 = get_elem ("Ron", doc);
DomNode child_2 = get_elem ("Ginnie", doc); GXml.Node child_2 = get_elem ("Ginnie", doc);
assert (parent.child_nodes.length == 0); assert (parent.child_nodes.length == 0);
parent.append_child (child_0); parent.append_child (child_0);
...@@ -272,8 +272,8 @@ class DomNodeTest : GXmlTest { ...@@ -272,8 +272,8 @@ class DomNodeTest : GXmlTest {
Test.add_func ("/gxml/domnode/attributes", () => { Test.add_func ("/gxml/domnode/attributes", () => {
try { try {
Document doc = get_doc (); Document doc = get_doc ();
DomNode elem = get_elem ("Hogwarts", doc); GXml.Node elem = get_elem ("Hogwarts", doc);
DomNode attr = get_attr ("Potter", "Lily", doc); GXml.Node attr = get_attr ("Potter", "Lily", doc);
assert (elem.attributes != null); assert (elem.attributes != null);
assert (attr.attributes == null); assert (attr.attributes == null);
...@@ -289,7 +289,7 @@ class DomNodeTest : GXmlTest { ...@@ -289,7 +289,7 @@ class DomNodeTest : GXmlTest {
try { try {
Document doc2 = get_doc (); Document doc2 = get_doc ();
Document doc1 = get_doc (); Document doc1 = get_doc ();
DomNode elem = get_elem ("Malfoy", doc1); GXml.Node elem = get_elem ("Malfoy", doc1);
assert (elem.owner_document == doc1); assert (elem.owner_document == doc1);
assert (elem.owner_document != doc2); assert (elem.owner_document != doc2);
...@@ -301,10 +301,10 @@ class DomNodeTest : GXmlTest { ...@@ -301,10 +301,10 @@ class DomNodeTest : GXmlTest {
Test.add_func ("/gxml/domnode/insert_before", () => { Test.add_func ("/gxml/domnode/insert_before", () => {
try { try {
Document doc = get_doc (); Document doc = get_doc ();
DomNode parent = get_elem ("Molly", doc); GXml.Node parent = get_elem ("Molly", doc);
DomNode child_0 = get_elem ("Percy", doc); GXml.Node child_0 = get_elem ("Percy", doc);
DomNode child_1 = get_elem ("Ron", doc); GXml.Node child_1 = get_elem ("Ron", doc);
DomNode child_2 = get_elem ("Ginnie", doc); GXml.Node child_2 = get_elem ("Ginnie", doc);
assert (parent.child_nodes.length == 0); assert (parent.child_nodes.length == 0);
parent.append_child (child_2); parent.append_child (child_2);
...@@ -333,10 +333,10 @@ class DomNodeTest : GXmlTest { ...@@ -333,10 +333,10 @@ class DomNodeTest : GXmlTest {
// TODO: for this one, and others that include a ref_child, we want to test passing an irrelevant ref child and a null ref child // TODO: for this one, and others that include a ref_child, we want to test passing an irrelevant ref child and a null ref child
Document doc = get_doc (); Document doc = get_doc ();
DomNode parent = get_elem ("Molly", doc); GXml.Node parent = get_elem ("Molly", doc);
DomNode child_0 = get_elem ("Percy", doc); GXml.Node child_0 = get_elem ("Percy", doc);
DomNode child_1 = get_elem ("Ron", doc); GXml.Node child_1 = get_elem ("Ron", doc);
DomNode child_2 = get_elem ("Ginnie", doc); GXml.Node child_2 = get_elem ("Ginnie", doc);
assert (parent.child_nodes.length == 0); assert (parent.child_nodes.length == 0);
parent.append_child (child_0); parent.append_child (child_0);
...@@ -361,10 +361,10 @@ class DomNodeTest : GXmlTest { ...@@ -361,10 +361,10 @@ class DomNodeTest : GXmlTest {
Test.add_func ("/gxml/domnode/remove_child", () => { Test.add_func ("/gxml/domnode/remove_child", () => {
try { try {
Document doc = get_doc (); Document doc = get_doc ();
DomNode parent = get_elem ("Molly", doc); GXml.Node parent = get_elem ("Molly", doc);
DomNode child_0 = get_elem ("Percy", doc); GXml.Node child_0 = get_elem ("Percy", doc);
DomNode child_1 = get_elem ("Ron", doc); GXml.Node child_1 = get_elem ("Ron", doc);
DomNode child_2 = get_elem ("Ginnie", doc); GXml.Node child_2 = get_elem ("Ginnie", doc);
assert (parent.child_nodes.length == 0); assert (parent.child_nodes.length == 0);
parent.append_child (child_0); parent.append_child (child_0);
...@@ -408,10 +408,10 @@ class DomNodeTest : GXmlTest { ...@@ -408,10 +408,10 @@ class DomNodeTest : GXmlTest {
Test.add_func ("/gxml/domnode/append_child", () => { Test.add_func ("/gxml/domnode/append_child", () => {
try { try {
Document doc = get_doc (); Document doc = get_doc ();
DomNode parent = get_elem ("Molly", doc); GXml.Node parent = get_elem ("Molly", doc);
DomNode child_0 = get_elem ("Percy", doc); GXml.Node child_0 = get_elem ("Percy", doc);
DomNode child_1 = get_elem ("Ron", doc); GXml.Node child_1 = get_elem ("Ron", doc);
DomNode child_2 = get_elem ("Ginnie", doc); GXml.Node child_2 = get_elem ("Ginnie", doc);
assert (parent.child_nodes.length == 0); assert (parent.child_nodes.length == 0);
parent.append_child (child_0); parent.append_child (child_0);
...@@ -438,8 +438,8 @@ class DomNodeTest : GXmlTest { ...@@ -438,8 +438,8 @@ class DomNodeTest : GXmlTest {
Test.add_func ("/gxml/domnode/has_child_nodes", () => { Test.add_func ("/gxml/domnode/has_child_nodes", () => {
try { try {
Document doc = get_doc (); Document doc = get_doc ();
DomNode parent = get_elem ("Molly", doc); GXml.Node parent = get_elem ("Molly", doc);
DomNode child_0 = get_elem ("Percy", doc); GXml.Node child_0 = get_elem ("Percy", doc);
assert (parent.has_child_nodes () == false); assert (parent.has_child_nodes () == false);
......
...@@ -79,13 +79,13 @@ public class SerializableCapsicum : GLib.Object, GXml.Serializable { ...@@ -79,13 +79,13 @@ public class SerializableCapsicum : GLib.Object, GXml.Serializable {
Perhaps these shouldn't be object methods, perhaps they should be static? Perhaps these shouldn't be object methods, perhaps they should be static?
Can't have static methods in an interface :(, right? */ Can't have static methods in an interface :(, right? */
public bool deserialize_property (string property_name, /* out GLib.Value value, */ public bool deserialize_property (string property_name, /* out GLib.Value value, */
GLib.ParamSpec spec, GXml.DomNode property_node) { GLib.ParamSpec spec, GXml.Node property_node) {
GLib.Value outvalue = GLib.Value (typeof (int)); GLib.Value outvalue = GLib.Value (typeof (int));
switch (property_name) { switch (property_name) {
case "ratings": case "ratings":
this.ratings = new GLib.List<int> (); this.ratings = new GLib.List<int> ();
foreach (GXml.DomNode rating in property_node.child_nodes) { foreach (GXml.Node rating in property_node.child_nodes) {
int64.try_parse (((GXml.Element)rating).content, out outvalue); int64.try_parse (((GXml.Element)rating).content, out outvalue);
this.ratings.append ((int)outvalue.get_int64 ()); this.ratings.append ((int)outvalue.get_int64 ());
} }
...@@ -101,7 +101,7 @@ public class SerializableCapsicum : GLib.Object, GXml.Serializable { ...@@ -101,7 +101,7 @@ public class SerializableCapsicum : GLib.Object, GXml.Serializable {
return false; return false;
} }
public GXml.DomNode? serialize_property (string property_name, /*GLib.Value value,*/ GLib.ParamSpec spec, GXml.Document doc) { public GXml.Node? serialize_property (string property_name, /*GLib.Value value,*/ GLib.ParamSpec spec, GXml.Document doc) {
GXml.Element c_prop; GXml.Element c_prop;
GXml.Element rating; GXml.Element rating;
...@@ -238,7 +238,7 @@ class SerializableTest : GXmlTest { ...@@ -238,7 +238,7 @@ class SerializableTest : GXmlTest {
SerializationTest.test_serialization_deserialization (tomato, "interface_defaults", (GLib.EqualFunc)SerializableTomato.equals, (SerializationTest.StringifyFunc)SerializableTomato.to_string); SerializationTest.test_serialization_deserialization (tomato, "interface_defaults", (GLib.EqualFunc)SerializableTomato.equals, (SerializationTest.StringifyFunc)SerializableTomato.to_string);
}); });
Test.add_func ("/gxml/serializable/interface_override_serialization_on_list", () => { Test.add_func ("/gxml/serializable/interface_override_serialization_on_list", () => {
GXml.DomNode node; GXml.Node node;
SerializableCapsicum capsicum; SerializableCapsicum capsicum;
SerializableCapsicum capsicum_new; SerializableCapsicum capsicum_new;
string expectation; string expectation;
......
...@@ -253,7 +253,7 @@ class SerializationTest : GXmlTest { ...@@ -253,7 +253,7 @@ class SerializationTest : GXmlTest {
public static GLib.Object test_serialization_deserialization (GLib.Object object, string name, EqualFunc equals, StringifyFunc stringify) { public static GLib.Object test_serialization_deserialization (GLib.Object object, string name, EqualFunc equals, StringifyFunc stringify) {
string xml_filename; string xml_filename;
GXml.DomNode node; GXml.Node node;
GXml.Document doc; GXml.Document doc;
GLib.Object object_new = null; GLib.Object object_new = null;
...@@ -291,7 +291,7 @@ class SerializationTest : GXmlTest { ...@@ -291,7 +291,7 @@ class SerializationTest : GXmlTest {
Test.add_func ("/gxml/serialization/xml_serialize", () => { Test.add_func ("/gxml/serialization/xml_serialize", () => {
Fruit fruit; Fruit fruit;
GXml.DomNode fruit_xml; GXml.Node fruit_xml;
string expectation; string expectation;
Regex regex; Regex regex;
...@@ -424,7 +424,7 @@ class SerializationTest : GXmlTest { ...@@ -424,7 +424,7 @@ class SerializationTest : GXmlTest {
SimpleProperties simple_properties; SimpleProperties simple_properties;
ComplexDuplicateProperties obj; ComplexDuplicateProperties obj;
ComplexDuplicateProperties restored; ComplexDuplicateProperties restored;
GXml.DomNode xml; GXml.Node xml;
// Clear cache to avoid collisions with other tests // Clear cache to avoid collisions with other tests
Serialization.clear_cache (); Serialization.clear_cache ();
...@@ -551,7 +551,7 @@ class SerializationTest : GXmlTest { ...@@ -551,7 +551,7 @@ class SerializationTest : GXmlTest {
/* NOTE: We expect this one to fail right now */ /* NOTE: We expect this one to fail right now */
Fruit fruit; Fruit fruit;
GXml.DomNode fruit_xml; GXml.Node fruit_xml;
string expectation; string expectation;
Regex regex; Regex regex;
......
...@@ -3,7 +3,7 @@ using GXml; ...@@ -3,7 +3,7 @@ using GXml;
class TextTest : GXmlTest { class TextTest : GXmlTest {
public static void add_tests () { public static void add_tests () {
/* NOTE: Node name and node value behaviour tested by DomNodeTest */ /* NOTE: GXml.Node name and node value behaviour tested by NodeTest */
Test.add_func ("/gxml/text/split_text", () => { Test.add_func ("/gxml/text/split_text", () => {
try { try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment