[gxml/gsoc2013] test/Serializa{tion, ble}Test.vala: adapt to new behaviour of gxml_serialization_{de, }serialize_objec



commit 6d1e7124a59a37cfc3c7816390cec2f6360440c1
Author: Richard Schwarting <aquarichy gmail com>
Date:   Tue Aug 6 16:09:36 2013 +0200

    test/Serializa{tion,ble}Test.vala: adapt to new behaviour of gxml_serialization_{de,}serialize_object

 test/SerializableTest.vala  |   10 +++++-----
 test/SerializationTest.vala |   16 ++++++++--------
 2 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/test/SerializableTest.vala b/test/SerializableTest.vala
index 4b84ffe..ddd814f 100644
--- a/test/SerializableTest.vala
+++ b/test/SerializableTest.vala
@@ -233,7 +233,7 @@ class SerializableTest : GXmlTest {
                                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", () => {
-                               GXml.Node node;
+                               GXml.Document doc;
                                SerializableCapsicum capsicum;
                                SerializableCapsicum capsicum_new;
                                string expectation;
@@ -250,7 +250,7 @@ class SerializableTest : GXmlTest {
 
                                capsicum = new SerializableCapsicum (2, 3, 5, ratings);
                                try {
-                                       node = Serialization.serialize_object (capsicum);
+                                       doc = Serialization.serialize_object (capsicum);
                                } catch (GXml.SerializationError e) {
                                        Test.message ("%s", e.message);
                                        assert_not_reached ();
@@ -260,13 +260,13 @@ class SerializableTest : GXmlTest {
 
                                try {
                                        regex = new Regex (expectation);
-                                       if (! regex.match (node.to_string ())) {
-                                               Test.message ("Did not serialize as expected.  Got [%s] but 
expected [%s]", node.to_string (), expectation);
+                                       if (! regex.match (doc.to_string ())) {
+                                               Test.message ("Did not serialize as expected.  Got [%s] but 
expected [%s]", doc.to_string (), expectation);
                                                assert_not_reached ();
                                        }
 
                                        try {
-                                               capsicum_new = 
(SerializableCapsicum)Serialization.deserialize_object (node);
+                                               capsicum_new = 
(SerializableCapsicum)Serialization.deserialize_object (doc);
                                        } catch (GXml.SerializationError e) {
                                                Test.message ("%s", e.message);
                                                assert_not_reached ();
diff --git a/test/SerializationTest.vala b/test/SerializationTest.vala
index 2bb14df..933069e 100644
--- a/test/SerializationTest.vala
+++ b/test/SerializationTest.vala
@@ -271,7 +271,7 @@ class SerializationTest : GXmlTest {
                        doc = new GXml.Document.from_path (xml_filename);
                        // TODO: assert that loaded file is right; do document compare with original
 
-                       object_new = Serialization.deserialize_object (doc.document_element);
+                       object_new = Serialization.deserialize_object (doc);
 
                        if (! equals (object, object_new)) {
                                Test.message ("Expected [%s] but got [%s]",
@@ -331,7 +331,7 @@ class SerializationTest : GXmlTest {
 
                                try {
                                        doc = new Document.from_string ("<Object otype='Fruit'><Property 
pname='age' ptype='gint'>3</Property></Object>");
-                                       fruit = (Fruit)Serialization.deserialize_object 
(doc.document_element);
+                                       fruit = (Fruit)Serialization.deserialize_object (doc);
 
                                        // we expect 9 because Fruit triples it in the setter
                                        if (fruit.age != 9) {
@@ -350,7 +350,7 @@ class SerializationTest : GXmlTest {
                                /* Right now we can infer the type from a property's name, but fields we 
might need to specify */
                                try {
                                        doc = new Document.from_string ("<Object otype='Fruit'><Property 
pname='age'>3</Property></Object>");
-                                       fruit = (Fruit)Serialization.deserialize_object 
(doc.document_element);
+                                       fruit = (Fruit)Serialization.deserialize_object (doc);
                                } catch (GLib.Error e) {
                                        Test.message ("%s", e.message);
                                        assert_not_reached ();
@@ -361,7 +361,7 @@ class SerializationTest : GXmlTest {
 
                                try {
                                        doc = new Document.from_string ("<Object otype='Fruit'><Property 
name='badname'>3</Property></Object>");
-                                       Serialization.deserialize_object (doc.document_element);
+                                       Serialization.deserialize_object (doc);
                                        Test.message ("Expected SerializationError.UNKNOWN_PROPERTY to be 
thrown for property 'badname' in object 'Fruit' :(  Did not happen.");
                                        assert_not_reached ();
                                } catch (GXml.SerializationError.UNKNOWN_PROPERTY e) {
@@ -376,7 +376,7 @@ class SerializationTest : GXmlTest {
 
                                try {
                                        doc = new Document.from_string ("<Object otype='BadType'></Object>");
-                                       Serialization.deserialize_object (doc.document_element);
+                                       Serialization.deserialize_object (doc);
                                        assert_not_reached ();
                                } catch (GXml.SerializationError.UNKNOWN_TYPE e) {
                                        // Pass
@@ -394,7 +394,7 @@ class SerializationTest : GXmlTest {
 
                                try {
                                        doc = new Document.from_string ("<Object otype='Fruit'><Property 
pname='age' ptype='badtype'>blue</Property></Object>");
-                                       fruit = (Fruit)Serialization.deserialize_object 
(doc.document_element);
+                                       fruit = (Fruit)Serialization.deserialize_object (doc);
                                        assert_not_reached ();
                                } catch (GXml.SerializationError.UNSUPPORTED_TYPE e) {
                                        // Pass
@@ -424,7 +424,7 @@ class SerializationTest : GXmlTest {
                                SimpleProperties simple_properties;
                                ComplexDuplicateProperties obj;
                                ComplexDuplicateProperties restored;
-                               GXml.Node xml;
+                               GXml.Document xml;
 
                                // Clear cache to avoid collisions with other tests
                                Serialization.clear_caches ();
@@ -591,7 +591,7 @@ class SerializationTest : GXmlTest {
 
                                        try {
                                                doc = new Document.from_string ("<Object 
otype='Fruit'><Property pname='colour' ptype='gchararray'>blue</Property><Property pname='weight' 
ptype='gint'>11</Property><Property pname='name' ptype='gchararray'>fish</Property><Property pname='age' 
ptype='gint'>3</Property></Object>");
-                                               fruit = (Fruit)Serialization.deserialize_object 
(doc.document_element);
+                                               fruit = (Fruit)Serialization.deserialize_object (doc);
 
                                                if (! fruit.test ("blue", 11, "fish", 3)) {
                                                        Test.message ("Expected [\"%s\", %d, \"%s\", %d] but 
found [%s]", "blue", 11, "fish", 3, fruit.to_string ());


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