[gxml] Added Test TwDocument/SerializableObjectModel - override_serialize
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Added Test TwDocument/SerializableObjectModel - override_serialize
- Date: Sat, 9 May 2015 03:46:46 +0000 (UTC)
commit 4ecc93b30d7b5bc8adb7b6f280a73c559b701ac9
Author: Daniel Espinosa <esodan gmail com>
Date: Fri May 8 21:33:27 2015 -0500
Added Test TwDocument/SerializableObjectModel - override_serialize
test/SerializableObjectModel-Tw-Test.vala | 73 ++++++++++++++---------------
test/SerializableObjectModelTest.vala | 2 +-
2 files changed, 37 insertions(+), 38 deletions(-)
---
diff --git a/test/SerializableObjectModel-Tw-Test.vala b/test/SerializableObjectModel-Tw-Test.vala
index 4dd25c4..361b98a 100644
--- a/test/SerializableObjectModel-Tw-Test.vala
+++ b/test/SerializableObjectModel-Tw-Test.vala
@@ -239,49 +239,16 @@ class SerializableObjectModelTwTest : GXmlTest
stdout.printf (@"Error: $(e.message)");
assert_not_reached ();
}
- });/*
- Test.add_func ("/gxml/tw/serializable/object_model/override_transform_from_string",
- () => {
- var cpu = new Cpu ();
- var doc = new xDocument.from_string (XML_CPU_FILE);
- try {
- cpu.deserialize (doc);
- //stdout.printf (@"$doc");
- if (cpu.ghz != (float) 3.85) {
- stdout.printf (@"ERROR CPU: ghz '$(cpu.ghz)'");
- assert_not_reached ();
- }
- if (cpu.piles.size != 3) {
- stdout.printf (@"ERROR CPU: piles size '$(cpu.piles.size)'");
- assert_not_reached ();
- }
- if (!cpu.piles.contains (1)) {
- stdout.printf (@"ERROR CPU: piles contains 1 '$(cpu.piles_to_string ())'");
- assert_not_reached ();
- }
- if (!cpu.piles.contains (2)) {
- stdout.printf (@"ERROR CPU: piles contains 2 '$(cpu.piles_to_string ())'");
- assert_not_reached ();
- }
- if (!cpu.piles.contains (3)) {
- stdout.printf (@"ERROR CPU: piles contains 3 '$(cpu.piles_to_string ())'");
- assert_not_reached ();
- }
- }
- catch (GLib.Error e) {
- stdout.printf (@"Error: $(e.message)");
- assert_not_reached ();
- }
});
Test.add_func ("/gxml/tw/serializable/object_model/override_serialize",
() => {
- var doc = new xDocument ();
+ var doc = new TwDocument ();
var configuration = new Configuration ();
configuration.device = "Controller";
try {
configuration.serialize (doc);
//stdout.printf (@"DOC: $doc");
- if (doc.document_element == null) {
+ if (doc.root == null) {
#if DEBUG
GLib.message ("DOC: No root element");
#endif
@@ -314,8 +281,7 @@ class SerializableObjectModelTwTest : GXmlTest
stdout.printf (@"Error: $(e.message)");
assert_not_reached ();
}
- });
-
+ });/*
Test.add_func ("/gxml/tw/serializable/object_model/set_namespace", () => {
try {
var ns = new NameSpace ();
@@ -353,6 +319,39 @@ UNKNOWN CONTENT
}
});
// TODO: Add deserialize to TwDocument
+ Test.add_func ("/gxml/tw/serializable/object_model/override_transform_from_string",
+ () => {
+ var cpu = new Cpu ();
+ var doc = new TwDocument.from_string (XML_CPU_FILE);
+ try {
+ cpu.deserialize (doc);
+ //stdout.printf (@"$doc");
+ if (cpu.ghz != (float) 3.85) {
+ stdout.printf (@"ERROR CPU: ghz '$(cpu.ghz)'");
+ assert_not_reached ();
+ }
+ if (cpu.piles.size != 3) {
+ stdout.printf (@"ERROR CPU: piles size '$(cpu.piles.size)'");
+ assert_not_reached ();
+ }
+ if (!cpu.piles.contains (1)) {
+ stdout.printf (@"ERROR CPU: piles contains 1 '$(cpu.piles_to_string ())'");
+ assert_not_reached ();
+ }
+ if (!cpu.piles.contains (2)) {
+ stdout.printf (@"ERROR CPU: piles contains 2 '$(cpu.piles_to_string ())'");
+ assert_not_reached ();
+ }
+ if (!cpu.piles.contains (3)) {
+ stdout.printf (@"ERROR CPU: piles contains 3 '$(cpu.piles_to_string ())'");
+ assert_not_reached ();
+ }
+ }
+ catch (GLib.Error e) {
+ stdout.printf (@"Error: $(e.message)");
+ assert_not_reached ();
+ }
+ });
Test.add_func ("/gxml/tw/serializable/object_model/deserialize_serializable_properties",
() => {
var package = new Package ();
diff --git a/test/SerializableObjectModelTest.vala b/test/SerializableObjectModelTest.vala
index 91ba793..67733d8 100644
--- a/test/SerializableObjectModelTest.vala
+++ b/test/SerializableObjectModelTest.vala
@@ -239,7 +239,7 @@ class Configuration : ObjectModel
}
public override GXml.Node? serialize (GXml.Node node) throws GLib.Error
{
- var n = (xNode) default_serialize ((xNode)node);
+ var n = default_serialize (node);
n.set_namespace ("http://www.gnome.org/gxml/0.4", "om");
return (GXml.Node)n;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]