gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash testsuite/actionscript.all/XMLNode.as Cha...


From: Sandro Santilli
Subject: [Gnash-commit] gnash testsuite/actionscript.all/XMLNode.as Cha...
Date: Mon, 27 Nov 2006 09:17:28 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/11/27 09:17:28

Modified files:
        testsuite/actionscript.all: XMLNode.as 
        .              : ChangeLog 

Log message:
        * testsuite/actionscript.all/XMLNode.as: fixed tests to match reality.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/XMLNode.as?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1781&r2=1.1782

Patches:
Index: testsuite/actionscript.all/XMLNode.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/XMLNode.as,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- testsuite/actionscript.all/XMLNode.as       16 Nov 2006 23:26:53 -0000      
1.5
+++ testsuite/actionscript.all/XMLNode.as       27 Nov 2006 09:17:28 -0000      
1.6
@@ -22,242 +22,71 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: XMLNode.as,v 1.5 2006/11/16 23:26:53 strk Exp $";
+rcsid="$Id: XMLNode.as,v 1.6 2006/11/27 09:17:28 strk Exp $";
 
 #include "dejagnu.as"
 
-var node = new XMLNode;
+check(XMLNode);
+var textnode = new XMLNode(3, "text content");
+
+check(textnode);
 
 // test the XMLNode constuctor
 //dejagnu(node, "XMLNode::XMLNode()");
 
-note("Test the existance of all the methods");
+//note("Test the existance of all the methods");
 
-// test the XMLNode::appendchild method
-if (node.appendChild) {
-    pass("XMLNode::appendChild() exists");
-} else {
-    fail("XMLNode::appendChild() doesn't exist");
-}
-
-// test the XMLNode::clonenode method
-if (node.cloneNode) {
-       pass("XMLNode::cloneNode() exists");
-} else {
-       fail("XMLNode::cloneNode() doesn't exist");
-}
-// test the XMLNode::haschildnodes method
-if (node.hasChildNodes) {
-       pass("XMLNode::hasChildNodes() exists");
-} else {
-       fail("XMLNode::hasChildNodes() doesn't exist");
-}
-// test the XMLNode::insertbefore method
-if (node.insertBefore) {
-       pass("XMLNode::insertBefore() exists");
-} else {
-       fail("XMLNode::insertBefore() doesn't exist");
-}
-// test the XMLNode::removenode method
-if (node.removeNode) {
-       pass("XMLNode::removeNode() exists");
-} else {
-       fail("XMLNode::removeNode() doesn't exist");
-}
-// test the XMLNode::tostring method
-if (node.toString) {
-       pass("XMLNode::toString() exists");
-} else {
-       fail("XMLNode::toString() doesn't exist");
-}
-
-note("\nTest the existance of all the properties");
-// Check the properties
-// test the XMLNode::nodeName property
-if (node.nodeName) {
-       pass("XMLNode::nodeName exists");
-} else {
-       fail("XMLNode::nodeName doesn't exist");
-}
-if (node.nodeType) {
-       pass("XMLNode::nodeType exists");
-} else {
-       fail("XMLNode::nodeType doesn't exist");
-}
-if (node.attributes) {
-       pass("XMLNode::attributes exists");
-} else {
-       fail("XMLNode::attributes doesn't exist");
-}
-if (node.childNodes) {
-       pass("XMLNode::childNodes exists");
-} else {
-       fail("XMLNode::childNodes doesn't exist");
-}
-if (node.firstChild) {
-       pass("XMLNode::firstChild exists");
-} else {
-       fail("XMLNode::firstChild doesn't exist");
-}
-if (node.lastChild) {
-       pass("XMLNode::lastChild exists");
-} else {
-       fail("XMLNode::lastChild doesn't exist");
-}
-if (node.nextSibling) {
-       pass("XMLNode::nextSibling exists");
-} else {
-       fail("XMLNode::nextSibling doesn't exist");
-}
-if (node.parentNode) {
-       pass("XMLNode::parentNode exists");
-} else {
-       fail("XMLNode::parentNode doesn't exist");
-}
-if (node.previousSibling) {
-       pass("XMLNode::previousSibling exists");
-} else {
-       fail("XMLNode::previousSibling doesn't exist");
-}
-
-note("Now test the functionality of the properties");
-
-node.nodeName = "foo";
-
-if (node.nodeName == "foo") {
-    pass("XMLNode::nodeName works");
-} else {
-    fail("XMLNode::nodeName doesn't work");
-}
-
-node.nodeValue = "bar";
-if (node.nodeValue == "bar") {
-    pass("XMLNode::nodeValue works");
-} else {
-    fail("XMLNode::nodeValue doesn't work");
-}
+check(textnode.appendChild);
+check(textnode.cloneNode);
+check(textnode.hasChildNodes);
+check(textnode.insertBefore);
+check(textnode.removeNode);
+check(textnode.toString);
+
+//note("Now test the functionality of the properties");
+
+textnode.nodeName = "foo";
+check_equals(textnode.nodeName, "foo");
+
+xcheck_equals (textnode.nodeValue, "text content");
+textnode.nodeValue = "bar";
+check_equals (textnode.nodeValue, "bar");
 
 // The read only properties. These should all return NULL, because
 // there are no children.
-if (node.firstChild) {
-    pass("XMLNode::firstChild with no children works");
-} else {
-    fail("XMLNode::firstChild with no children doesn't works");
-}
-
-if (node.lastChild) {
-    pass("XMLNode::lastChild with no children works");
-} else {
-    fail("XMLNode::lastChild with no children doesn't works");
-}
-
-if (node.parentNode) {
-    pass("XMLNode::parentNode with no children works");
-} else {
-    fail("XMLNode::parentNode with no children doesn't works");
-}
-
-if (node.nextSibling) {
-    pass("XMLNode::nextSibling with no children works");
-} else {
-    fail("XMLNode::nextSibling with no children doesn't works");
-}
-
-if (node.previousSibling) {
-    pass("XMLNode::PreviousSibling with no children works");
-} else {
-    fail("XMLNode::PreviousSibling with no children doesn't works");
-}
-
-note("Now test the functionality of the methods");
-
-var childnode = new XMLNode;
-childnode.nodeName = "fu";
-childnode.nodeValue = "bore";
-
-var before = node.hasChildNodes();
-node.appendChild(childnode);
-var after = node.hasChildNodes();
-
-//trace(before);
-//trace(after);
-
-if ((before == false) && (after == true)) {
-    pass("XMLNode::appendChild() works");
-} else {
-    fail("XMLNode::appendChild() doesn't work");
-}
-
-// Because the node has no type, we don't have a legit value yet.
-if (childnode.nodeType == "") {
-    pass("XMLNode::nodeType property works");
-} else {
-    fail("XMLNode::nodeType property doesn't work");
-}
-
-// The read only properties. These should all return a valid XMLNode
-// object because there is one child.
-if (node.firstChild.nodeName == "fu") {
-    pass("XMLNode::firstChild with child works");
-} else {
-    fail("XMLNode::firstChild with child doesn't works");
-}
-
-if (node.lastChild.nodeName  == "fu") {
-    pass("XMLNode::lastChild with child works");
-} else {
-    fail("XMLNode::lastChild with children doesn't works");
-}
-
-// These should still return zero because there is only one child
-if (node.nextSibling) {
-    pass("XMLNode::nextSibling with child works");
-} else {
-    fail("XMLNode::nextSibling with child doesn't works");
-}
-
-if (node.previousSibling) {
-    pass("XMLNode::PreviousSibling with child work");
-} else {
-    fail("XMLNode::PreviousSibling with child doesn't work");
-}
-
-var nextnode = new XMLNode;
-nextnode.nodeName = "fur";
-nextnode.nodeValue = "bare";
-
-node.appendChild(nextnode);
-
-// The read only properties. These should all return a valid XMLNode
-// object because there is more than one child.
-if (node.firstChild.nodeName == "fu") {
-    pass("XMLNode::firstChild with children works");
-} else {
-    fail("XMLNode::firstChild with children doesn't works");
-}
-
-if (node.lastChild.nodeName  == "fur") {
-    pass("XMLNode::lastChild with children works");
-} else {
-    fail("XMLNode::lastChild with children doesn't works");
-}
-
-// These should still return a valid pointer now
-if (node.nextSibling) {
-    pass("XMLNode::nextSibling with child works");
-} else {
-    fail("XMLNode::nextSibling with child doesn't works");
-}
-
-trace(node.previousSibling.nodeName);
-
-if (node.previousSibling.nodeName == "fu") {
-    xpass("XMLNode::PreviousSibling with child works");
-} else {
-    xfail("XMLNode::PreviousSibling with child doesn't works");
-}
+check_equals(textnode.hasChildNodes(), false);
+xcheck_equals(textnode.firstChild, undefined);
+xcheck_equals(textnode.lastChild, undefined);
+xcheck_equals(textnode.parentNode, undefined);
+xcheck_equals(textnode.nextSibling, undefined);
+xcheck_equals(textnode.previousSibling, undefined);
+
+//note("Now test the functionality of the methods");
+
+var childnode1 = new XMLNode(3, "first child");
+xcheck_equals(childnode1.nodeType, 3);
+textnode.appendChild(childnode1);
+
+check_equals(textnode.hasChildNodes(), true);
+check_equals(textnode.firstChild, childnode1);
+check_equals(textnode.lastChild, childnode1);
+xcheck_equals(childnode1.nextSibling, undefined);
+xcheck_equals(childnode1.previousSibling, undefined);
+
+var nextnode = new XMLNode(3, "second child");
+xcheck_equals(nextnode.nodeType, 3);
+textnode.appendChild(nextnode);
+
+check_equals(textnode.hasChildNodes(), true);
+check_equals(textnode.firstChild, childnode1);
+check_equals(textnode.lastChild, nextnode);
+xcheck_equals(childnode1.nextSibling, nextnode);
+xcheck_equals(childnode1.previousSibling, undefined);
+xcheck_equals(nextnode.previousSibling, childnode1);
+
+//var out = textnode.toString();
+//trace(out);
 
-var out = node.toString();
-trace(out);
+// TODO: test removeNode, insertNode
 
 totals();

Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1781
retrieving revision 1.1782
diff -u -b -r1.1781 -r1.1782
--- ChangeLog   27 Nov 2006 02:12:59 -0000      1.1781
+++ ChangeLog   27 Nov 2006 09:17:28 -0000      1.1782
@@ -1,3 +1,8 @@
+2006-11-27 Sandro Santilli <address@hidden>
+
+       * testsuite/actionscript.all/XMLNode.as: fixed
+         tests to match reality.
+
 2006-11-26 Sandro Santilli <address@hidden>
 
        * server/sprite_instance.cpp (attachMovieClipInterface):




reply via email to

[Prev in Thread] Current Thread [Next in Thread]