diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/Test.as new file mode 100644 index 000000000..8bafc2eef --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/Test.as @@ -0,0 +1,123 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("bug157597 - XML insertChildAfter()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("insertChildAfter")); + +var example:XML = +2 +; + +correct = + +2 +3 +; + +example.insertChildAfter(example.two, 3); + +TEST(2, correct, example); + + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/output.txt new file mode 100644 index 000000000..689110c48 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/output.txt @@ -0,0 +1 @@ +2 PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/test.swf new file mode 100644 index 000000000..384171aad Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/Test.as new file mode 100644 index 000000000..1226b10b4 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/Test.as @@ -0,0 +1,123 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("bug157597 - XML insertChildBefore()"); + + + +var example:XML = +2 +; + +correct = + +1 +2 +; + +example.insertChildBefore(example.two, 1); + +TEST(2, correct, example); + + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/output.txt new file mode 100644 index 000000000..689110c48 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/output.txt @@ -0,0 +1 @@ +2 PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/test.swf new file mode 100644 index 000000000..b0356403c Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157597_2/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/Test.as new file mode 100644 index 000000000..497634a4c --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/Test.as @@ -0,0 +1,113 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("bug157735 - XML comments()"); + +XML.ignoreComments = false; + +var p =

this is normal text

; + +TEST(1, "this is normal text", p.toString()); + + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/output.txt new file mode 100644 index 000000000..2844c2eaf --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/output.txt @@ -0,0 +1 @@ +1 PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/test.swf new file mode 100644 index 000000000..3b9ba96db Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug157735/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/Test.as new file mode 100644 index 000000000..4b0abe605 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/Test.as @@ -0,0 +1,118 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("bug158506"); + + +var x:XML = + + +for each( var node:XML in x..author ) +{ var name:String = node.@name; +var sign:String = node.@sign; +TEST(1, "Contino Chuck", name); +} + + + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/output.txt new file mode 100644 index 000000000..2844c2eaf --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/output.txt @@ -0,0 +1 @@ +1 PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/test.swf new file mode 100644 index 000000000..649c61cae Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug158506/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/Test.as new file mode 100644 index 000000000..22cdb5a71 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/Test.as @@ -0,0 +1,164 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + /* +* +* +* See http://bugzilla.mozilla.org/show_bug.cgi?id=564468 +* +*/ +//----------------------------------------------------------------------------- + +// var SECTION = "564468"; +// var VERSION = ""; +// var TITLE = " XMLParser need to use caseless compares for ?XML and CDATA tags"; +// var bug = "564468"; + + + +// Unable to access xml declaration node via AS code so instead cause an +// XMLParser::kUnterminatedXMLDeclaration error to be thrown by XMLParser.getNext(). +// Prior to this fix this code would throw an XMLParser::kUnterminatedProcessingInstruction +// error was thrown since it fell into the " is some cdata!]]>"; +var lowerCDATA:XML = new XML(lowerdata); +Assert.expectEq("lower CDATA", " is some cdata!]]>", lowerCDATA.toXMLString() ); + +var mixeddata:String = " is some cdata!]]>"; +var mixedCDATA:XML = new XML(mixeddata); +Assert.expectEq("mixed CDATA", " is some cdata!]]>", mixedCDATA.toXMLString() ); + +var upperdata:String = " is some cdata!]]>"; +var upperCDATA:XML = new XML(upperdata); +Assert.expectEq("upper CDATA", " is some cdata!]]>", upperCDATA.toXMLString() ); + diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/output.txt new file mode 100644 index 000000000..655d15e2f --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/output.txt @@ -0,0 +1,9 @@ +Asserting for TypeError PASSED! +lowercase xml PASSED! +Asserting for TypeError PASSED! +uppercase xml PASSED! +Asserting for TypeError PASSED! +mixed xml PASSED! +lower CDATA PASSED! +mixed CDATA PASSED! +upper CDATA PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/test.swf new file mode 100644 index 000000000..6a1e89afc Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/bug_564468/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/Test.as new file mode 100644 index 000000000..b961f6e88 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/Test.as @@ -0,0 +1,189 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.1 - XML Constructor as Function"); + +x1 = XML(); +TEST(1, "xml", typeof(x1)); +TEST(2, true, x1 instanceof XML); + +correct = + + + + DIS + + +; + +x1 = XML(correct); +TEST(3, correct, x1); + +text = +"" + +" " + +" " + +" DIS" + +" " + +" " + +""; + +x1 = XML(text); +TEST(4, correct, x1); + +// Make sure it's not copied if it's XML +x1 = + + two +; + +y1 = XML(x1); + +x1.bravo = "three"; + +correct = + + three +; + +TEST(5, correct, y1); + +// Make text node +x1 = XML("4"); +TEST_XML(6, 4, x1); + +x1 = XML(4); +TEST_XML(7, 4, x1); + +// Undefined and null should behave like "" +x1 = XML(null); +TEST_XML(8, "", x1); + +x1 = XML(undefined); +TEST_XML(9, "", x1); + +XML.prettyPrinting = false; + +var thisXML = "GiantsSan Francisco"; +var NULL_OBJECT = null; +// value is null +Assert.expectEq( "XML(null).valueOf().toString()", "", XML(null).valueOf().toString() ); +Assert.expectEq( "typeof XML(null)", "xml", typeof XML(null) ); + +// value is undefined +Assert.expectEq( "XML(undefined).valueOf().toString()", "", XML(undefined).valueOf().toString() ); +Assert.expectEq( "typeof XML(undefined)", "xml", typeof XML(undefined) ); + +// value is not supplied +Assert.expectEq( "XML().valueOf().toString()", "", XML().valueOf().toString() ); +Assert.expectEq( "typeof XML()", "xml", typeof XML() ); + +// value is supplied +Assert.expectEq( "XML(thisXML).valueOf().toString()", thisXML, XML(thisXML).valueOf().toString() ); +Assert.expectEq( "typeof XML(thisXML)", "xml", typeof XML(thisXML) ); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/output.txt new file mode 100644 index 000000000..269aac748 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/output.txt @@ -0,0 +1,17 @@ +1 PASSED! +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +8 PASSED! +9 PASSED! +XML(null).valueOf().toString() PASSED! +typeof XML(null) PASSED! +XML(undefined).valueOf().toString() PASSED! +typeof XML(undefined) PASSED! +XML().valueOf().toString() PASSED! +typeof XML() PASSED! +XML(thisXML).valueOf().toString() PASSED! +typeof XML(thisXML) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/test.swf new file mode 100644 index 000000000..d329c070a Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_1/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/Test.as new file mode 100644 index 000000000..b2a9139a3 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/Test.as @@ -0,0 +1,241 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4.2 - XML Constructor"); + +x1 = new XML(); +TEST(1, "xml", typeof(x1)); +TEST(2, true, x1 instanceof XML); + +correct = + + + + DIS + + +; + +x1 = new XML(correct); +TEST_XML(3, correct.toXMLString(), x1); + +text = +"" + +" " + +" " + +" DIS" + +" " + +" " + +""; + +x1 = new XML(text); +TEST(4, correct, x1); + +// Make sure it's a copy +x1 = + + one +; + +y1 = new XML(x1); + +x1.bravo.prependChild(two); + +correct = + + one +; + +TEST(5, correct, y1); + +// Make text node +x1 = new XML("4"); +TEST_XML(6, "4", x1); + +x1 = new XML(4); +TEST_XML(7, "4", x1); + +// Undefined and null should behave like "" +x1 = new XML(null); +TEST_XML(8, "", x1); + +x1 = new XML(undefined); +TEST_XML(9, "", x1); + +var thisXML = "GiantsSan Francisco"; + +// value is null +Assert.expectEq( "typeof new XML(null)", "xml", typeof new XML(null) ); +Assert.expectEq( "new XML(null) instanceof XML", true, new XML(null) instanceof XML); +Assert.expectEq( "(new XML(null).nodeKind())", "text", (new XML(null)).nodeKind()); +Assert.expectEq( "MYOB = new XML(null); MYOB.toString()", "", + (MYOB = new XML(null), MYOB.toString(), MYOB.toString()) ); + +// value is undefined +Assert.expectEq( "typeof new XML(undefined)", "xml", typeof new XML(undefined) ); +Assert.expectEq( "new XML(undefined) instanceof XML", true, new XML(undefined) instanceof XML); +Assert.expectEq( "(new XML(undefined).nodeKind())", "text", (new XML(undefined)).nodeKind()); +Assert.expectEq( "MYOB = new XML(undefined); MYOB.toString()", "", + (MYOB = new XML(undefined), MYOB.toString(), MYOB.toString()) ); + +// value is not supplied +Assert.expectEq( "typeof new XML()", "xml", typeof new XML() ); +Assert.expectEq( "new XML() instanceof XML", true, new XML() instanceof XML); +Assert.expectEq( "(new XML().nodeKind())", "text", (new XML()).nodeKind()); +Assert.expectEq( "MYOB = new XML(); MYOB.toString()", "", + (MYOB = new XML(), MYOB.toString(), MYOB.toString()) ); + +//value is a number +Assert.expectEq( "typeof new XML(5)", "xml", typeof new XML(5) ); +Assert.expectEq( "new XML(5) instanceof XML", true, new XML(5) instanceof XML); +Assert.expectEq( "(new XML(5).nodeKind())", "text", (new XML(5)).nodeKind()); +Assert.expectEq( "MYOB = new XML(5); MYOB.toString()", "5", + (MYOB = new XML(5), MYOB.toString(), MYOB.toString()) ); + +//value is + +// value is supplied +XML.prettyPrinting = false; +Assert.expectEq( "typeof new XML(thisXML)", "xml", typeof new XML(thisXML) ); +Assert.expectEq( "new XML(thisXML) instanceof XML", true, new XML(thisXML) instanceof XML); +Assert.expectEq( "MYOB = new XML(thisXML); MYOB.toString()", "GiantsSan Francisco", + (MYOB = new XML(thisXML), MYOB.toString(), MYOB.toString()) ); + +// Strongly typed XML objects +var MYXML1:XML = new XML(thisXML); +Assert.expectEq("Strongly typed XML object", new XML(thisXML).toString(), MYXML1.toString()); + +var MYXML2:XML = new XML(GiantsSan Francisco); +Assert.expectEq("var MYXML:XML = new XML(bd);", new XML(thisXML).toString(), MYXML2.toString()); + +var MYXML3:XML = GiantsSan Francisco; +Assert.expectEq("var MYXML:XML = bd;", new XML(thisXML).toString(), MYXML3.toString()); + +var MYXML4:XML = new XML(); +var someXML = new XML(); +var someXML = someXML.toString(); +Assert.expectEq("var MYXML:XML = new XML()", someXML, MYXML4.toString()); + +var MYXML5:XML = new XML(5); +Assert.expectEq("var MYXML:XML = new XML(5)", "5", MYXML5.toString()); + +var a = new XML(" compiled"); + +Assert.expectEq("XML with PI and comments", "compiled", a.toString()); + +try { + var b = new XML(""); + result = b; +} catch(e1) { + result = Utils.typeError(e1.toString()); +} + +Assert.expectEq("new XML(\"\")", "TypeError: Error #1088", result); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/output.txt new file mode 100644 index 000000000..0a1cf1c36 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/output.txt @@ -0,0 +1,35 @@ +1 PASSED! +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +8 PASSED! +9 PASSED! +typeof new XML(null) PASSED! +new XML(null) instanceof XML PASSED! +(new XML(null).nodeKind()) PASSED! +MYOB = new XML(null); MYOB.toString() PASSED! +typeof new XML(undefined) PASSED! +new XML(undefined) instanceof XML PASSED! +(new XML(undefined).nodeKind()) PASSED! +MYOB = new XML(undefined); MYOB.toString() PASSED! +typeof new XML() PASSED! +new XML() instanceof XML PASSED! +(new XML().nodeKind()) PASSED! +MYOB = new XML(); MYOB.toString() PASSED! +typeof new XML(5) PASSED! +new XML(5) instanceof XML PASSED! +(new XML(5).nodeKind()) PASSED! +MYOB = new XML(5); MYOB.toString() PASSED! +typeof new XML(thisXML) PASSED! +new XML(thisXML) instanceof XML PASSED! +MYOB = new XML(thisXML); MYOB.toString() PASSED! +Strongly typed XML object PASSED! +var MYXML:XML = new XML(bd); PASSED! +var MYXML:XML = bd; PASSED! +var MYXML:XML = new XML() PASSED! +var MYXML:XML = new XML(5) PASSED! +XML with PI and comments PASSED! +new XML("") PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/test.swf new file mode 100644 index 000000000..33e2814d5 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_2/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/Test.as new file mode 100644 index 000000000..e92cd5d32 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/Test.as @@ -0,0 +1,276 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.3 - XML Properties"); + +// Test defaults +TEST(1, true, XML.ignoreComments); +TEST(2, true, XML.ignoreProcessingInstructions); +TEST(3, true, XML.ignoreWhitespace); +TEST(4, true, XML.prettyPrinting); +TEST(5, 2, XML.prettyIndent); + +// ignoreComments +x1 = one; + +correct = one; + +TEST(6, correct, x1); + +XML.ignoreComments = false; + +x1 = one; + +correct = +"" + NL() + +" " + NL() + +" one" + NL() + +""; + +TEST_XML(7, correct, x1); + + +// ignoreProcessingInstructions +XML.defaultSettings(); +x1 = +<> + + + one + +; + +correct = + + one +; + +TEST(8, correct, x1); + +XML.ignoreProcessingInstructions = false; + +x1 = +<> + + + one + +; + +correct = +"" + NL() + +" " + NL() + +" one" + NL() + +""; + +TEST_XML(9, correct, x1); + +// ignoreWhitespace +XML.defaultSettings(); +x1 = new XML(" \t\r\n\r\n \t\r\n\r\none \t\r\n\r\n"); + +correct = +"" + NL() + +" one" + NL() + +""; + +TEST_XML(10, correct, x1); + +XML.ignoreWhitespace = false; +XML.prettyPrinting = false; + +correct = " \n\n \n\none \n\n"; +x1 = new XML(correct); + +TEST_XML(11, correct, x1); + +// prettyPrinting +XML.prettyPrinting = true; + +x1 =onetwothreefour; + +correct = "" + NL() + + " one" + NL() + + " two" + NL() + + " " + NL() + + " " + NL() + + " three" + NL() + + " four" + NL() + + " " + NL() + + ""; + +TEST(12, correct, x1.toString()); +TEST(13, correct, x1.toXMLString()); + +XML.prettyPrinting = false; + +correct = "onetwothreefour"; +TEST(14, correct, x1.toString()); +TEST(15, correct, x1.toXMLString()); + +// prettyIndent +XML.prettyPrinting = true; +XML.prettyIndent = 3; + +correct = "" + NL() + + " one" + NL() + + " two" + NL() + + " " + NL() + + " " + NL() + + " three" + NL() + + " four" + NL() + + " " + NL() + + ""; + +TEST(16, correct, x1.toString()); +TEST(17, correct, x1.toXMLString()); + +XML.prettyIndent = 0; + +correct = "" + NL() + + "one" + NL() + + "two" + NL() + + "" + NL() + + "" + NL() + + "three" + NL() + + "four" + NL() + + "" + NL() + + ""; + +TEST(18, correct, x1.toString()); +TEST(19, correct, x1.toXMLString()); + +// settings() +XML.defaultSettings(); +o = XML.settings(); +TEST(20, false, o.ignoreComments); +TEST(21, false, o.ignoreProcessingInstructions); +TEST(22, false, o.ignoreWhitespace); +TEST(23, true, o.prettyPrinting); +TEST(24, 0, o.prettyIndent); + +// setSettings() +o = XML.settings(); +o.ignoreComments = false; +o.ignoreProcessingInstructions = false; +o.ignoreWhitespace = false; +o.prettyPrinting = false; +o.prettyIndent = 7; + +XML.setSettings(o); +o = XML.settings(); +TEST(25, false, o.ignoreComments); +TEST(26, false, o.ignoreProcessingInstructions); +TEST(27, false, o.ignoreWhitespace); +TEST(28, false, o.prettyPrinting); +TEST(29, 7, o.prettyIndent); + +// defaultSettings() +XML.defaultSettings(); +o = XML.settings(); +TEST(30, false, o.ignoreComments); +TEST(31, false, o.ignoreProcessingInstructions); +TEST(32, false, o.ignoreWhitespace); +TEST(33, false, o.prettyPrinting); +TEST(34, 7, o.prettyIndent); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/output.txt new file mode 100644 index 000000000..ce2b685dd --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/output.txt @@ -0,0 +1,34 @@ +1 PASSED! +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +8 PASSED! +9 PASSED! +10 PASSED! +11 PASSED! +12 PASSED! +13 PASSED! +14 PASSED! +15 PASSED! +16 PASSED! +17 PASSED! +18 PASSED! +19 PASSED! +20 PASSED! +21 PASSED! +22 PASSED! +23 PASSED! +24 PASSED! +25 PASSED! +26 PASSED! +27 PASSED! +28 PASSED! +29 PASSED! +30 PASSED! +31 PASSED! +32 PASSED! +33 PASSED! +34 PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/test.swf new file mode 100644 index 000000000..845c9d62d Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/Test.as new file mode 100644 index 000000000..a41ef626a --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/Test.as @@ -0,0 +1,110 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.3.1 - XML.prototype"); + +Assert.expectEq( "typeof XML.prototype", "object", typeof XML.prototype); +Assert.expectEq( "XML.prototype instanceof XML", false, XML.prototype instanceof XML); +Assert.expectEq( "new XML().prototype instanceof XML", false, new XML().prototype instanceof XML); +Assert.expectEq( "typeof (new XML().prototype)", "xml", typeof (new XML().prototype)); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/output.txt new file mode 100644 index 000000000..c75bf523b --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/output.txt @@ -0,0 +1,4 @@ +typeof XML.prototype PASSED! +XML.prototype instanceof XML PASSED! +new XML().prototype instanceof XML PASSED! +typeof (new XML().prototype) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/test.swf new file mode 100644 index 000000000..394a8c364 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_1/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/Test.as new file mode 100644 index 000000000..2f70d19a0 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/Test.as @@ -0,0 +1,139 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.3.2 - XML.ignoreComments"); + +var thisXML = "GiantsSan Francisco" + +XML.prettyPrinting = false; + +// a) initial value of ignoreComments is true + +Assert.expectEq( "XML.ignoreComments", true, XML.ignoreComments); + +// toggling value works ok +Assert.expectEq( "XML.ignoreComments = false, XML.ignoreComments", false, (XML.ignoreComments = false, XML.ignoreComments)); +Assert.expectEq( "XML.ignoreComments = true, XML.ignoreComments", true, (XML.ignoreComments = true, XML.ignoreComments)); + +// b) if ignoreComments is true, XML comments are ignored when construction the new XML objects +Assert.expectEq( "MYXML = new XML(thisXML), MYXML.toString()", "GiantsSan Francisco", + (XML.ignoreComments = true, MYXML = new XML(thisXML), MYXML.toString() )); +Assert.expectEq( "MYXML = new XML(thisXML), MYXML.toString() with ignoreComemnts=false", "GiantsSan Francisco", + (XML.ignoreComments = false, MYXML = new XML(thisXML), MYXML.toString() )); + +// If ignoreComments is true, XML constructor from another XML node ignores comments +XML.ignoreComments = false; +var MYXML = new XML(thisXML); // this XML node has comments +XML.ignoreComments = true; +var xml2 = new XML(MYXML); // this XML tree should not have comments +Assert.expectEq( "xml2 = new XML(MYXML), xml2.toString()", "GiantsSan Francisco", + (xml2.toString()) ); +XML.ignoreComments = false; +var xml3 = new XML(MYXML); // this XML tree will have comments +Assert.expectEq( "xml3 = new XML(MYXML), xml3.toString()", "GiantsSan Francisco", + (xml3.toString()) ); + + +// c) two attributes { DontEnum, DontDelete } +// !!@ + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/output.txt new file mode 100644 index 000000000..d8d3354ad --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/output.txt @@ -0,0 +1,7 @@ +XML.ignoreComments PASSED! +XML.ignoreComments = false, XML.ignoreComments PASSED! +XML.ignoreComments = true, XML.ignoreComments PASSED! +MYXML = new XML(thisXML), MYXML.toString() PASSED! +MYXML = new XML(thisXML), MYXML.toString() with ignoreComemnts=false PASSED! +xml2 = new XML(MYXML), xml2.toString() PASSED! +xml3 = new XML(MYXML), xml3.toString() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/test.swf new file mode 100644 index 000000000..4f7f13500 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_2/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/Test.as new file mode 100644 index 000000000..c2c89876d --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/Test.as @@ -0,0 +1,140 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.3.3 - XML.ignoreProcessingInstructions"); + +// We set this to false so we can more easily compare string output +XML.prettyPrinting = false; + +// xml string with processing instructions +var xmlDoc = "GiantsSan Francisco" + +// a) value of ignoreProcessingInstructions +Assert.expectEq ("XML.ignoreProcessingInstructions", true, (XML.ignoreProcessingInstructions)); +Assert.expectEq( "XML.ignoreProcessingInstructions = false, XML.ignoreProcessingInstructions", false, (XML.ignoreProcessingInstructions = false, XML.ignoreProcessingInstructions)); +Assert.expectEq( "XML.ignoreProcessingInstructions = true, XML.ignoreProcessingInstructions", true, (XML.ignoreProcessingInstructions = true, XML.ignoreProcessingInstructions)); + +// b) if ignoreProcessingInstructions is true, XML processing instructions are ignored when construction the new XML objects +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.toString()", "GiantsSan Francisco", + (XML.ignoreProcessingInstructions = true, MYXML = new XML(xmlDoc), MYXML.toString() )); + +// !!@ note that the "" tag magically disappeared. + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.toString() with ignoreProcessingInstructions=false", + "GiantsSan Francisco", + (XML.ignoreProcessingInstructions = false, MYXML = new XML(xmlDoc), MYXML.toString() )); + + +// If ignoreProcessingInstructions is true, XML constructor from another XML node ignores processing instructions +XML.ignoreProcessingInstructions = false; +var MYXML = new XML(xmlDoc); // this XML node has processing instructions +XML.ignoreProcessingInstructions = true; +var xml2 = new XML(MYXML); // this XML tree should not have processing instructions +Assert.expectEq( "xml2 = new XML(MYXML), xml2.toString()", "GiantsSan Francisco", + (xml2.toString()) ); +XML.ignoreProcessingInstructions = false; +var xml3 = new XML(MYXML); // this XML tree will have processing instructions +Assert.expectEq( "xml3 = new XML(MYXML), xml3.toString()", + "GiantsSan Francisco", + (xml3.toString()) ); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/output.txt new file mode 100644 index 000000000..dd1dbc71f --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/output.txt @@ -0,0 +1,7 @@ +XML.ignoreProcessingInstructions PASSED! +XML.ignoreProcessingInstructions = false, XML.ignoreProcessingInstructions PASSED! +XML.ignoreProcessingInstructions = true, XML.ignoreProcessingInstructions PASSED! +MYXML = new XML(xmlDoc), MYXML.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.toString() with ignoreProcessingInstructions=false PASSED! +xml2 = new XML(MYXML), xml2.toString() PASSED! +xml3 = new XML(MYXML), xml3.toString() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/test.swf new file mode 100644 index 000000000..d752b07f7 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_3/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/Test.as new file mode 100644 index 000000000..31e93b355 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/Test.as @@ -0,0 +1,152 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.3.4 - XML.ignoreWhitespace"); + +// We set this to false so we can more easily compare string output +XML.prettyPrinting = false; + +// xml doc with white space +var xmlDoc = " Giants\u000DSan\u0020Francisco\u000ABaseball\u0009" + + +// a) value of ignoreWhitespace +Assert.expectEq( "XML.ignoreWhitespace = false, XML.ignoreWhitespace", false, (XML.ignoreWhitespace = false, XML.ignoreWhitespace)); +Assert.expectEq( "XML.ignoreWhitespace = true, XML.ignoreWhitespace", true, (XML.ignoreWhitespace = true, XML.ignoreWhitespace)); + + +// b) whitespace is ignored when true, not ignored when false +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.toString()", "GiantsSan FranciscoBaseball", + (XML.ignoreWhitespace = true, MYXML = new XML(xmlDoc), MYXML.toString() )); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.toString() with ignoreWhitespace=false", + " Giants\u000DSan\u0020Francisco\u000ABaseball\u0009", + (XML.ignoreWhitespace = false, MYXML = new XML(xmlDoc), MYXML.toString() )); + +// c) whitespace characters +// tab +xmlDoc = "\ttab"; +Assert.expectEq( "XML with tab and XML.ignoreWhiteSpace = true", "tab", + (XML.ignoreWhitespace = true, MYXML = new XML(xmlDoc), MYXML.toString() )); + +Assert.expectEq( "XML with tab and XML.ignoreWhiteSpace = false", "\ttab", + (XML.ignoreWhitespace = false, MYXML = new XML(xmlDoc), MYXML.toString() )); + +// new line +xmlDoc = "\n\n\ntab\n"; +Assert.expectEq( "XML with new line and XML.ignoreWhiteSpace = true", "tab", + (XML.ignoreWhitespace = true, MYXML = new XML(xmlDoc), MYXML.toString() )); + +xmlDoc = "\r\ntab\r\n"; +Assert.expectEq( "XML with new line and XML.ignoreWhiteSpace = false", "\r\ntab\r\n", + (XML.ignoreWhitespace = false, MYXML = new XML(xmlDoc), MYXML.toString() )); + +// d) attributes + +xmlDoc = "tab"; +Assert.expectEq( "new XML(\"tab\")", "tab", + (XML.ignoreWhitespace = true, MYXML = new XML(xmlDoc), MYXML.toString() )); + +Assert.expectEq( "new XML(\"tab\")", "tab", + (XML.ignoreWhitespace = false, MYXML = new XML(xmlDoc), MYXML.toString() )); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/output.txt new file mode 100644 index 000000000..3a68b34c0 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/output.txt @@ -0,0 +1,10 @@ +XML.ignoreWhitespace = false, XML.ignoreWhitespace PASSED! +XML.ignoreWhitespace = true, XML.ignoreWhitespace PASSED! +MYXML = new XML(xmlDoc), MYXML.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.toString() with ignoreWhitespace=false PASSED! +XML with tab and XML.ignoreWhiteSpace = true PASSED! +XML with tab and XML.ignoreWhiteSpace = false PASSED! +XML with new line and XML.ignoreWhiteSpace = true PASSED! +XML with new line and XML.ignoreWhiteSpace = false PASSED! +new XML("tab") PASSED! +new XML("tab") PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/test.swf new file mode 100644 index 000000000..0591029cc Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_4/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/Test.as new file mode 100644 index 000000000..adfe41a3a --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/Test.as @@ -0,0 +1,129 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.3.5 - XML.prettyPrinting"); + +// xml doc +var xmlDoc = "GiantsSan FranciscoBaseball" + + +// a) value of prettyPrinting +Assert.expectEq( "XML.prettyPrinting = false, XML.prettyPrinting", false, (XML.prettyPrinting = false, XML.prettyPrinting)); +Assert.expectEq( "XML.prettyPrinting = true, XML.prettyPrinting", true, (XML.prettyPrinting = true, XML.prettyPrinting)); + +// b) pretty printing + +Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyPrinting = false; MYOB.toString()", + "GiantsSan FranciscoBaseball", + (MYOB = new XML(xmlDoc), XML.prettyPrinting = false, MYOB.toString())); + +// !!@ very simple example of printing output + +Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString()", + "" + NL() + " Giants" + NL() + " San Francisco" + NL() + " Baseball" + NL() + "", + (MYOB = new XML(xmlDoc), XML.prettyPrinting = true, MYOB.toString())); + + +// c) attributes + +// TODO + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/output.txt new file mode 100644 index 000000000..0ad61400d --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/output.txt @@ -0,0 +1,4 @@ +XML.prettyPrinting = false, XML.prettyPrinting PASSED! +XML.prettyPrinting = true, XML.prettyPrinting PASSED! +MYOB = new XML(xmlDoc); XML.prettyPrinting = false; MYOB.toString() PASSED! +MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/test.swf new file mode 100644 index 000000000..ec9cbf32d Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_5/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/Test.as new file mode 100644 index 000000000..9a8ab5af2 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/Test.as @@ -0,0 +1,153 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.3.6 - XML.prettyIndent"); + +// xml doc +XML.prettyPrinting = true; +var xmlDoc = "GiantsSan FranciscoBaseball" + + +// a) value of prettyIndent +Assert.expectEq( "XML.prettyIndent = 4, XML.prettyIndent", 4, (XML.prettyIndent = 4, XML.prettyIndent)); +Assert.expectEq( "XML.prettyIndent = 2, XML.prettyIndent", 2, (XML.prettyIndent = 2, XML.prettyIndent)); +Assert.expectEq( "XML.prettyIndent = -1, XML.prettyIndent", -1, (XML.prettyIndent = -1, XML.prettyIndent)); + +// b) pretty printing + +Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyIndent = 2; MYOB.toString()", + "" + NL() + " Giants" + NL() + " San Francisco" + NL() + " Baseball" + NL() + "", + (MYOB = new XML(xmlDoc), XML.prettyIndent = 2, MYOB.toString())); + +Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyIdent = 4; MYOB.toString()", + "" + NL() + " Giants" + NL() + " San Francisco" + NL() + " Baseball" + NL() + "", + (MYOB = new XML(xmlDoc), XML.prettyIndent = 4, MYOB.toString())); + +Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyIndent = 1; MYOB.toString()", + "" + NL() + " Giants" + NL() + " San Francisco" + NL() + " Baseball" + NL() + "", + (MYOB = new XML(xmlDoc), XML.prettyIndent = 1, MYOB.toString())); + +// !!@ bad value causes pretty printing to be disabled +Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyIndent = -5; MYOB.toString()", + "GiantsSan FranciscoBaseball", + //"" + NL() + " Giants" + NL() + " San Francisco" + NL() + " Baseball" + NL() + "", + (MYOB = new XML(xmlDoc), XML.prettyIndent = -5, MYOB.toString())); + + + +// !!@ very simple example of printing output +XML.prettyPrinting = true; +XML.prettyIndent = 10; +Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString()", + "" + NL() + " Giants" + NL() + " San Francisco" + NL() + " Baseball" + NL() + "", + (MYOB = new XML(xmlDoc), XML.prettyPrinting = true, MYOB.toString())); + + +// d) attributes + +XML.prettyIndent = 5; +xmlDoc = "GiantsSan FranciscoBaseball" +Assert.expectEq( "MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString()", + "" + NL() + " Giants" + NL() + " San Francisco" + NL() + " Baseball" + NL() + "", + (MYOB = new XML(xmlDoc), XML.prettyPrinting = true, MYOB.toString())); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/output.txt new file mode 100644 index 000000000..4dd55e0c4 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/output.txt @@ -0,0 +1,9 @@ +XML.prettyIndent = 4, XML.prettyIndent PASSED! +XML.prettyIndent = 2, XML.prettyIndent PASSED! +XML.prettyIndent = -1, XML.prettyIndent PASSED! +MYOB = new XML(xmlDoc); XML.prettyIndent = 2; MYOB.toString() PASSED! +MYOB = new XML(xmlDoc); XML.prettyIdent = 4; MYOB.toString() PASSED! +MYOB = new XML(xmlDoc); XML.prettyIndent = 1; MYOB.toString() PASSED! +MYOB = new XML(xmlDoc); XML.prettyIndent = -5; MYOB.toString() PASSED! +MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString() PASSED! +MYOB = new XML(xmlDoc); XML.prettyPrinting = true; MYOB.toString() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/test.swf new file mode 100644 index 000000000..13d6d7930 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_6/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/Test.as new file mode 100644 index 000000000..40605e742 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/Test.as @@ -0,0 +1,149 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.3.7 - XML.settings"); + +// xmlDoc + +var settings = XML.settings(); + +Assert.expectEq( "XML.settings().ignoreComments; ", true, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) ); + +XML.ignoreComments = false; +Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) ); + +XML.ignoreProcessingInstructions = false; +Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) ); + +XML.ignoreWhitespace = false; +Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) ); + +XML.prettyPrinting = false; +Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) ); + +XML.prettyIndent = 4; +Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.settings().prettyIndent; ", 4, (XML.settings().prettyIndent) ); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/output.txt new file mode 100644 index 000000000..fedea2ec2 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/output.txt @@ -0,0 +1,30 @@ +XML.settings().ignoreComments; PASSED! +XML.settings().ignoreProcessingInstructions; PASSED! +XML.settings().ignoreWhitespace; PASSED! +XML.settings().prettyPrinting; PASSED! +XML.settings().prettyIndent; PASSED! +XML.settings().ignoreComments; PASSED! +XML.settings().ignoreProcessingInstructions; PASSED! +XML.settings().ignoreWhitespace; PASSED! +XML.settings().prettyPrinting; PASSED! +XML.settings().prettyIndent; PASSED! +XML.settings().ignoreComments; PASSED! +XML.settings().ignoreProcessingInstructions; PASSED! +XML.settings().ignoreWhitespace; PASSED! +XML.settings().prettyPrinting; PASSED! +XML.settings().prettyIndent; PASSED! +XML.settings().ignoreComments; PASSED! +XML.settings().ignoreProcessingInstructions; PASSED! +XML.settings().ignoreWhitespace; PASSED! +XML.settings().prettyPrinting; PASSED! +XML.settings().prettyIndent; PASSED! +XML.settings().ignoreComments; PASSED! +XML.settings().ignoreProcessingInstructions; PASSED! +XML.settings().ignoreWhitespace; PASSED! +XML.settings().prettyPrinting; PASSED! +XML.settings().prettyIndent; PASSED! +XML.settings().ignoreComments; PASSED! +XML.settings().ignoreProcessingInstructions; PASSED! +XML.settings().ignoreWhitespace; PASSED! +XML.settings().prettyPrinting; PASSED! +XML.settings().prettyIndent; PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/test.swf new file mode 100644 index 000000000..ce882e3cb Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_7/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/Test.as new file mode 100644 index 000000000..26598d521 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/Test.as @@ -0,0 +1,183 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.3.8 - XML.setSettings(settings)"); + +// a) called with a settings object +var settings = XML.settings(); + +settings.ignoreComments = false; +settings.ignoreProcessingInstructions = false; +settings.ignoreWhitespace = false; +settings.prettyPrinting = false; +settings.prettyIndent = 4; + +Assert.expectEq( "XML.settings().ignoreComments; ", true, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) ); + +XML.setSettings (settings); + +Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.settings().prettyIndent; ", 4, (XML.settings().prettyIndent) ); + +// setting null restores defaults +XML.setSettings (null); + +Assert.expectEq( "XML.settings(null); XML.settings().ignoreComments; ", true, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.settings(null); XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.settings(null); XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.settings(null); XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.settings(null); XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) ); + +XML.setSettings (settings); +// does setting a bogus value restore defaults? No. +XML.setSettings ([1, 2, 3, 4]); + +Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.settings().prettyIndent; ", 4, (XML.settings().prettyIndent) ); + +// does setting a bogus value restore defaults? No. +XML.setSettings (5); + +Assert.expectEq( "XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.settings().prettyIndent; ", 4, (XML.settings().prettyIndent) ); + +// does setting a bogus value restore defaults? No. +XML.setSettings (""); + +Assert.expectEq( "XML.setSettings (\"\"); XML.settings().ignoreComments; ", false, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.setSettings (\"\"); XML.settings().ignoreProcessingInstructions; ", false, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.setSettings (\"\"); XML.settings().ignoreWhitespace; ", false, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.setSettings (\"\"); XML.settings().prettyPrinting; ", false, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.setSettings (\"\"); XML.settings().prettyIndent; ", 4, (XML.settings().prettyIndent) ); + +// this restores defaults +XML.setSettings (undefined); + +Assert.expectEq( "XML.setSettings (undefined); XML.settings().ignoreComments; ", true, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.setSettings (undefined); XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.setSettings (undefined); XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.setSettings (undefined); XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.setSettings (undefined); XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) ); + +// this restore defaults +XML.setSettings (settings); +XML.setSettings (); + +Assert.expectEq( "XML.setSettings (); XML.settings().ignoreComments; ", true, (XML.settings().ignoreComments) ); +Assert.expectEq( "XML.setSettings (); XML.settings().ignoreProcessingInstructions; ", true, (XML.settings().ignoreProcessingInstructions) ); +Assert.expectEq( "XML.setSettings (); XML.settings().ignoreWhitespace; ", true, (XML.settings().ignoreWhitespace) ); +Assert.expectEq( "XML.setSettings (); XML.settings().prettyPrinting; ", true, (XML.settings().prettyPrinting) ); +Assert.expectEq( "XML.setSettings (); XML.settings().prettyIndent; ", 2, (XML.settings().prettyIndent) ); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/output.txt new file mode 100644 index 000000000..96e854b41 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/output.txt @@ -0,0 +1,40 @@ +XML.settings().ignoreComments; PASSED! +XML.settings().ignoreProcessingInstructions; PASSED! +XML.settings().ignoreWhitespace; PASSED! +XML.settings().prettyPrinting; PASSED! +XML.settings().prettyIndent; PASSED! +XML.settings().ignoreComments; PASSED! +XML.settings().ignoreProcessingInstructions; PASSED! +XML.settings().ignoreWhitespace; PASSED! +XML.settings().prettyPrinting; PASSED! +XML.settings().prettyIndent; PASSED! +XML.settings(null); XML.settings().ignoreComments; PASSED! +XML.settings(null); XML.settings().ignoreProcessingInstructions; PASSED! +XML.settings(null); XML.settings().ignoreWhitespace; PASSED! +XML.settings(null); XML.settings().prettyPrinting; PASSED! +XML.settings(null); XML.settings().prettyIndent; PASSED! +XML.settings().ignoreComments; PASSED! +XML.settings().ignoreProcessingInstructions; PASSED! +XML.settings().ignoreWhitespace; PASSED! +XML.settings().prettyPrinting; PASSED! +XML.settings().prettyIndent; PASSED! +XML.settings().ignoreComments; PASSED! +XML.settings().ignoreProcessingInstructions; PASSED! +XML.settings().ignoreWhitespace; PASSED! +XML.settings().prettyPrinting; PASSED! +XML.settings().prettyIndent; PASSED! +XML.setSettings (""); XML.settings().ignoreComments; PASSED! +XML.setSettings (""); XML.settings().ignoreProcessingInstructions; PASSED! +XML.setSettings (""); XML.settings().ignoreWhitespace; PASSED! +XML.setSettings (""); XML.settings().prettyPrinting; PASSED! +XML.setSettings (""); XML.settings().prettyIndent; PASSED! +XML.setSettings (undefined); XML.settings().ignoreComments; PASSED! +XML.setSettings (undefined); XML.settings().ignoreProcessingInstructions; PASSED! +XML.setSettings (undefined); XML.settings().ignoreWhitespace; PASSED! +XML.setSettings (undefined); XML.settings().prettyPrinting; PASSED! +XML.setSettings (undefined); XML.settings().prettyIndent; PASSED! +XML.setSettings (); XML.settings().ignoreComments; PASSED! +XML.setSettings (); XML.settings().ignoreProcessingInstructions; PASSED! +XML.setSettings (); XML.settings().ignoreWhitespace; PASSED! +XML.setSettings (); XML.settings().prettyPrinting; PASSED! +XML.setSettings (); XML.settings().prettyIndent; PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/test.swf new file mode 100644 index 000000000..ccb64ea32 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_8/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/Test.as new file mode 100644 index 000000000..a583298dd --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/Test.as @@ -0,0 +1,133 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.3.9 - XML.defaultSettings()"); + +Assert.expectEq( "settings = XML.defaultSettings(), settings.ignoreComments", true, + (settings = XML.defaultSettings(), settings.ignoreComments) ); +Assert.expectEq( "settings = XML.defaultSettings(), settings.ignoreProcessingInstructions", true, + (settings = XML.defaultSettings(), settings.ignoreProcessingInstructions) ); +Assert.expectEq( "settings = XML.defaultSettings(), settings.ignoreWhitespace", true, + (settings = XML.defaultSettings(), settings.ignoreWhitespace) ); +Assert.expectEq( "settings = XML.defaultSettings(), settings.prettyPrinting", true, + (settings = XML.defaultSettings(), settings.prettyPrinting) ); +Assert.expectEq( "settings = XML.defaultSettings(), settings.prettyIndent", 2, + (settings = XML.defaultSettings(), settings.prettyIndent) ); + +var tempSettings = XML.settings(); +tempSettings.ignoreComments = false; +tempSettings.ignoreProcessingInstructions = false; +tempSettings.ignoreWhitespace = false; +tempSettings.prettyPrinting = false; +tempSettings.prettyIndent = 4; + +Assert.expectEq( "XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreComments", true, + (XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreComments) ); +Assert.expectEq( "XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreProcessingInstructions", true, + (XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreProcessingInstructions) ); +Assert.expectEq( "XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreWhitespace", true, + (XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreWhitespace) ); +Assert.expectEq( "XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyPrinting", true, + (XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyPrinting) ); +Assert.expectEq( "XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyIndent", 2, + (XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyIndent) ); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/output.txt new file mode 100644 index 000000000..e8558e241 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/output.txt @@ -0,0 +1,10 @@ +settings = XML.defaultSettings(), settings.ignoreComments PASSED! +settings = XML.defaultSettings(), settings.ignoreProcessingInstructions PASSED! +settings = XML.defaultSettings(), settings.ignoreWhitespace PASSED! +settings = XML.defaultSettings(), settings.prettyPrinting PASSED! +settings = XML.defaultSettings(), settings.prettyIndent PASSED! +XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreComments PASSED! +XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreProcessingInstructions PASSED! +XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.ignoreWhitespace PASSED! +XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyPrinting PASSED! +XML.setSettings(tempSettings), XML.setSettings(XML.defaultSettings()), XML.prettyIndent PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/test.swf new file mode 100644 index 000000000..cd7263bce Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_3_9/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/Test.as new file mode 100644 index 000000000..4be640e55 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/Test.as @@ -0,0 +1,107 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.1 - XML Constructor"); + +Assert.expectEq( "XML.prototype.constructor == XML", true, XML.prototype.constructor == XML); +Assert.expectEq( "XML.prototype.constructor === XML", true, XML.prototype.constructor === XML); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/output.txt new file mode 100644 index 000000000..2bea6214a --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/output.txt @@ -0,0 +1,2 @@ +XML.prototype.constructor == XML PASSED! +XML.prototype.constructor === XML PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/test.swf new file mode 100644 index 000000000..64295db78 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_1/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/Test.as new file mode 100644 index 000000000..f39ece1d2 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/Test.as @@ -0,0 +1,147 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.10 - XML contains()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("contains")); + +emps = + + Jim25 + Joe20 +; + +TEST(2, true, emps.contains(emps)); + +var xmlDoc = "GiantsSan FranciscoPadresSan Diego"; + +// same object, returns true +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.contains(MYMXL)", true, + (MYXML = new XML(xmlDoc), MYXML.contains(MYXML)) ); + +// duplicated object, returns true +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.contains(MYMXL.copy())", true, + (MYXML = new XML(xmlDoc), MYXML.contains(MYXML.copy())) ); + +// identical objects, returns true +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML.contains(MYMXL2)", true, + (MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML.contains(MYXML2)) ); + +// identical objects, returns true +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.contains(MYMXL)", true, + (MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.contains(MYXML)) ); + +// slightly different objects, returns false +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.foo = 'bar', MYXML.contains(MYMXL2)", false, + (MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.foo = 'bar', MYXML.contains(MYXML2)) ); + +// slightly different objects #2, returns false +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.Team[0].foo = 'bar', MYXML.contains(MYMXL2)", false, + (MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.Team[0].foo = 'bar', MYXML.contains(MYXML2)) ); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.Team[0].contains('Giants')", false, + (MYXML = new XML(xmlDoc), MYXML.Team[0].contains('Giants')) ); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.Team[1].contains('Giants')", false, + (MYXML = new XML(xmlDoc), MYXML.Team[1].contains('Giants')) ); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.City.contains('Giants')", false, + (MYXML = new XML(xmlDoc), MYXML.City.contains('Giants')) ); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/output.txt new file mode 100644 index 000000000..06a657c96 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/output.txt @@ -0,0 +1,10 @@ +2 PASSED! +MYXML = new XML(xmlDoc), MYXML.contains(MYMXL) PASSED! +MYXML = new XML(xmlDoc), MYXML.contains(MYMXL.copy()) PASSED! +MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML.contains(MYMXL2) PASSED! +MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.contains(MYMXL) PASSED! +MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.foo = 'bar', MYXML.contains(MYMXL2) PASSED! +MYXML = new XML(xmlDoc), MYXML2 = new XML(xmlDoc), MYXML2.Team[0].foo = 'bar', MYXML.contains(MYMXL2) PASSED! +MYXML = new XML(xmlDoc), MYXML.Team[0].contains('Giants') PASSED! +MYXML = new XML(xmlDoc), MYXML.Team[1].contains('Giants') PASSED! +MYXML = new XML(xmlDoc), MYXML.City.contains('Giants') PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/test.swf new file mode 100644 index 000000000..e79429e61 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_10/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/Test.as new file mode 100644 index 000000000..9adffc512 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/Test.as @@ -0,0 +1,169 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.11 - XML copy()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("copy")); + +emps = + + Jim25 + Joe20 +; + +correct = +Jim25; + +x1 = emps.employee[0].copy(); + +TEST(2, undefined, x1.parent()); +TEST(3, correct, x1); + +// Make sure we're getting a copy, not a ref to orig. +emps = + + Jim25 + Joe20 +; + +correct = +Jim25 + +empCopy = emps.employee[0].copy(); + +emps.employee[0].fname[0] = "Sally"; + +TEST(4, correct, empCopy); + +// Try copying whole XML twice +emps = + + Jim25 + Joe20 +; + +empCopy = emps.copy(); +x1 = empCopy.copy(); + +TEST(5, x1, emps); + +XML.prettyPrinting = false; +var xmlDoc = "GiantsSan FranciscoPadresSan Diego"; + +Assert.expectEq( "MYXML = new XML(xmlDoc), XMLCOPY = MYXML.copy()", xmlDoc, + (MYXML = new XML(xmlDoc), XMLCOPY = MYXML.copy(), XMLCOPY.toString()) ); +Assert.expectEq( "MYXML = new XML(null), XMLCOPY = MYXML.copy()", "", + (MYXML = new XML(null), XMLCOPY = MYXML.copy(), XMLCOPY.toString()) ); +Assert.expectEq( "MYXML = new XML(undefined), XMLCOPY = MYXML.copy()", MYXML.toString(), + (MYXML = new XML(undefined), XMLCOPY = MYXML.copy(), XMLCOPY.toString()) ); +Assert.expectEq( "MYXML = new XML(), XMLCOPY = MYXML.copy()", MYXML.toString(), + (MYXML = new XML(), XMLCOPY = MYXML.copy(), XMLCOPY.toString()) ); +Assert.expectEq( "MYXML = new XML(xmlDoc), XMLCOPY = MYXML.Team.copy()", "Giants" + NL() + "Padres", + (MYXML = new XML(xmlDoc), XMLCOPY = MYXML.Team.copy(), XMLCOPY.toString()) ); + +// Make sure it's a copy +var MYXML = new XML(xmlDoc); +var MYXML2 = MYXML.copy(); +Assert.expectEq ("MYXML == MYXML.copy()", true, (MYXML == MYXML.copy())); +MYXML2.foo = "bar"; +Assert.expectEq ("MYXML == MYXML2 where MYXML2 is a copy that has been changed", false, (MYXML == MYXML2)); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/output.txt new file mode 100644 index 000000000..a6c5a9c2b --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/output.txt @@ -0,0 +1,11 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +MYXML = new XML(xmlDoc), XMLCOPY = MYXML.copy() PASSED! +MYXML = new XML(null), XMLCOPY = MYXML.copy() PASSED! +MYXML = new XML(undefined), XMLCOPY = MYXML.copy() PASSED! +MYXML = new XML(), XMLCOPY = MYXML.copy() PASSED! +MYXML = new XML(xmlDoc), XMLCOPY = MYXML.Team.copy() PASSED! +MYXML == MYXML.copy() PASSED! +MYXML == MYXML2 where MYXML2 is a copy that has been changed PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/test.swf new file mode 100644 index 000000000..f74cca676 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_11/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/Test.as new file mode 100644 index 000000000..961fa7b97 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/Test.as @@ -0,0 +1,169 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.12 - XML descendants"); + +//TEST(1, true, XML.prototype.hasOwnProperty("descendants")); + +x1 = + + one + + two + three + +; + +TEST(2, three, x1.charlie.descendants("bravo")); +TEST(3, new XMLList("onethree"), x1.descendants("bravo")); + +// Test * +correct = new XMLList("oneonetwothreetwothreethree"); + +XML.prettyPrinting = false; +TEST(4, correct, x1.descendants("*")); +TEST(5, correct, x1.descendants()); +XML.prettyPrinting = true; + +XML.prettyPrinting = false; + +var xmlDoc = "barGiantsbarbarSan FranciscoPadresSan Diego"; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.descendants('Team')", "Giantsbar" + NL() + "Padres", + (MYXML = new XML(xmlDoc), MYXML.descendants('Team').toString()) ); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.descendants('Team').length()", 2, + (MYXML = new XML(xmlDoc), MYXML.descendants('Team').length()) ); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.descendants('Team') instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.descendants('Team') instanceof XMLList) ); + +// find multiple levels of descendants +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.descendants('foo')", "bar" + NL() + "bar" + NL() + "bar", + (MYXML = new XML(xmlDoc), MYXML.descendants('foo').toString()) ); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.descendants('foo').length()", 3, + (MYXML = new XML(xmlDoc), MYXML.descendants('foo').length()) ); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.descendants('foo') instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.descendants('foo') instanceof XMLList) ); + +// no matching descendants +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.descendants('nomatch')", "", + (MYXML = new XML(xmlDoc), MYXML.descendants('nomatch').toString()) ); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.descendants('nomatch').length()", 0, + (MYXML = new XML(xmlDoc), MYXML.descendants('nomatch').length()) ); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.descendants('nomatch') instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.descendants('nomatch') instanceof XMLList) ); + +// descendant with hyphen + +e = + + Joe20 + Sue30 + + +correct = +Joe + +Sue; + +names = e.descendants("first-name"); + +Assert.expectEq("Descendant with hyphen", correct.toString(), names.toString()); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/output.txt new file mode 100644 index 000000000..aa22e6d3f --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/output.txt @@ -0,0 +1,14 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +MYXML = new XML(xmlDoc), MYXML.descendants('Team') PASSED! +MYXML = new XML(xmlDoc), MYXML.descendants('Team').length() PASSED! +MYXML = new XML(xmlDoc), MYXML.descendants('Team') instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.descendants('foo') PASSED! +MYXML = new XML(xmlDoc), MYXML.descendants('foo').length() PASSED! +MYXML = new XML(xmlDoc), MYXML.descendants('foo') instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.descendants('nomatch') PASSED! +MYXML = new XML(xmlDoc), MYXML.descendants('nomatch').length() PASSED! +MYXML = new XML(xmlDoc), MYXML.descendants('nomatch') instanceof XMLList PASSED! +Descendant with hyphen PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/test.swf new file mode 100644 index 000000000..dcbc88582 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_12/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/Test.as new file mode 100644 index 000000000..7282c7c69 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/Test.as @@ -0,0 +1,134 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.13 - XML elements()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("elements")); + +var xmlDoc = "GiantsSan FranciscoPadresSan Diego"; + +// !!@ need to verify results of these test cases +// !!@ elements appears to be broken in Rhino + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.elements('Team').toString()", "Giants" + NL() + "Padres", + (MYXML = new XML(xmlDoc), MYXML.elements('Team').toString()) ); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.elements('TEAM').toString()", "", + (MYXML = new XML(xmlDoc), MYXML.elements('TEAM').toString()) ); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.elements('bogus').toString()", "", + (MYXML = new XML(xmlDoc), MYXML.elements('bogus').toString()) ); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.elements()", "Giants" + NL() + "San Francisco" + NL() + "Padres" + NL() + "San Diego", + (MYXML = new XML(xmlDoc), MYXML.elements().toString()) ); + +xmlDoc = "GiantsSan Francisco"; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.elements('City').toString()", "San Francisco", + (MYXML = new XML(xmlDoc), MYXML.elements('City').toString()) ); + +xmlDoc = "GiantsSan FranciscoPadresSan Diego"; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.elements('MLB')", "" + NL() + " Giants" + NL() + " San Francisco" + NL() + " Padres" + NL() + " San Diego" + NL() + "", + (MYXML = new XML(xmlDoc), MYXML.elements('MLB').toString()) ); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/output.txt new file mode 100644 index 000000000..fc207b85a --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/output.txt @@ -0,0 +1,6 @@ +MYXML = new XML(xmlDoc), MYXML.elements('Team').toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.elements('TEAM').toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.elements('bogus').toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.elements() PASSED! +MYXML = new XML(xmlDoc), MYXML.elements('City').toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.elements('MLB') PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/test.swf new file mode 100644 index 000000000..1ce7ae961 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_13/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/Test.as new file mode 100644 index 000000000..66f5debd8 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/Test.as @@ -0,0 +1,144 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.14 - XML hasOwnProperty()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("hasOwnProperty")); + +x1 = + + one + + two + three + four + + +; + +// Returns true for elements/attributes +TEST(2, true, x1.hasOwnProperty("bravo")); +TEST(3, true, x1.hasOwnProperty("@attr1")); +TEST(4, false, x1.hasOwnProperty("foobar")); + +// Test for XML Prototype Object - returns true for XML methods. +TEST(5, true, XML.prototype.hasOwnProperty("toString")); +TEST(6, false, XML.prototype.hasOwnProperty("foobar")); + +var xmlDoc = "JohnWalton25" + +// !!@ we're not supporting prototype properties +// propertyName as a string +Assert.expectEq( "XML.prototype.hasOwnProperty('copy')", true, + (XML.prototype.hasOwnProperty('copy'))); +Assert.expectEq( "XML.prototype.hasOwnProperty('hasSimpleContent')", true, + (XML.prototype.hasOwnProperty('hasSimpleContent'))); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('copy')", false, + (MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('copy'))); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('hasSimpleContent')", false, + (MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('hasSimpleContent'))); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('firstname')", true, + (MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('firstname'))); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('lastname')", true, + (MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('lastname'))); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/output.txt new file mode 100644 index 000000000..bc064f869 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/output.txt @@ -0,0 +1,11 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +XML.prototype.hasOwnProperty('copy') PASSED! +XML.prototype.hasOwnProperty('hasSimpleContent') PASSED! +MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('copy') PASSED! +MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('hasSimpleContent') PASSED! +MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('firstname') PASSED! +MYXML = new XML(xmlDoc), MYXML.hasOwnProperty('lastname') PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/test.swf new file mode 100644 index 000000000..ee9a9fedd Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_14/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/Test.as new file mode 100644 index 000000000..28388ddb4 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/Test.as @@ -0,0 +1,160 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.15 - hasComplexContent()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("hasComplexContent")); + +x1 = + + one + + two + three + four + + + five + + + six + seven + + +; + +TEST(2, true, x1.hasComplexContent()); +TEST(3, false, x1.bravo.hasComplexContent()); +TEST(4, true, x1.charlie.hasComplexContent()); +TEST(5, false, x1.delta.hasComplexContent()); +TEST(6, false, x1.foxtrot.hasComplexContent()); +TEST(7, false, x1.golf.hasComplexContent()); +TEST(8, false, x1.hotel.hasComplexContent()); +TEST(9, false, x1.@attr1.hasComplexContent()); +TEST(10, false, x1.bravo.child(0).hasComplexContent()); +TEST(11, true, x1.india.hasComplexContent()); + +var xmlDoc = "JohnWalton25" + +// propertyName as a string +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.hasComplexContent()", true, + (MYXML = new XML(xmlDoc), MYXML.hasComplexContent())); + +xmlDoc = "John" +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.hasComplexContent()", false, + (MYXML = new XML(xmlDoc), MYXML.hasComplexContent())); + +XML.ignoreComments = false; +xmlDoc = "" +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.hasComplexContent()", false, + (MYXML = new XML(xmlDoc), MYXML.hasComplexContent())); + +XML.ignoreProcessingInstructions = false; +xmlDoc = "" +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.hasComplexContent()", false, + (MYXML = new XML(xmlDoc), MYXML.hasComplexContent())); + +XML.ignoreComments = false; +xmlDoc = "foo" +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.hasComplexContent()", false, + (MYXML = new XML(xmlDoc), MYXML.hasComplexContent())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/output.txt new file mode 100644 index 000000000..2cfe68756 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/output.txt @@ -0,0 +1,15 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +8 PASSED! +9 PASSED! +10 PASSED! +11 PASSED! +MYXML = new XML(xmlDoc), MYXML.hasComplexContent() PASSED! +MYXML = new XML(xmlDoc), MYXML.hasComplexContent() PASSED! +MYXML = new XML(xmlDoc), MYXML.hasComplexContent() PASSED! +MYXML = new XML(xmlDoc), MYXML.hasComplexContent() PASSED! +MYXML = new XML(xmlDoc), MYXML.hasComplexContent() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/test.swf new file mode 100644 index 000000000..85f62c071 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_15/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/Test.as new file mode 100644 index 000000000..0357f4206 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/Test.as @@ -0,0 +1,177 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.16 - XML hasSimpleContent()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("hasSimpleContent")); + +x1 = + + one + + two + three + four + + + five + + + six + seven + + +; + +TEST(2, false, x1.hasSimpleContent()); +TEST(3, true, x1.bravo.hasSimpleContent()); +TEST(4, false, x1.charlie.hasSimpleContent()); +TEST(5, true, x1.delta.hasSimpleContent()); +TEST(6, true, x1.foxtrot.hasSimpleContent()); +TEST(7, true, x1.golf.hasSimpleContent()); +TEST(8, true, x1.hotel.hasSimpleContent()); +TEST(9, true, x1.@attr1.hasSimpleContent()); +TEST(10, true, x1.bravo.child(0).hasSimpleContent()); +TEST(11, false, x1.india.hasSimpleContent()); + +var xmlDoc = "JohnWalton25" + +// propertyName as a string +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.hasSimpleContent()", false, + (MYXML = new XML(xmlDoc), MYXML.hasSimpleContent())); + +xmlDoc = "John" +Assert.expectEq ("MYXML = new XML(xmlDoc), MYXML.children().length()", 1, + (MYXML = new XML(xmlDoc), MYXML.children().length())); +Assert.expectEq ("MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind()", "text", + (MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind())); +Assert.expectEq ("MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind()", "text", + (MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind())); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent()", true, + (MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent())); + +XML.ignoreComments = false; +xmlDoc = "" +Assert.expectEq ("MYXML = new XML(xmlDoc), MYXML.children().length()", 1, + (MYXML = new XML(xmlDoc), MYXML.children().length())); +Assert.expectEq ("MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind()", "comment", + (MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind())); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent()", false, + (MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent())); + +XML.ignoreProcessingInstructions = false; +xmlDoc = "" +Assert.expectEq ("MYXML = new XML(xmlDoc), MYXML.children().length()", 1, + (MYXML = new XML(xmlDoc), MYXML.children().length())); +Assert.expectEq ("MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind()", "processing-instruction", + (MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind())); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent()", false, + (MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent())); + +xmlDoc = "foo" +Assert.expectEq ("MYXML = new XML(xmlDoc), MYXML.children().length()", 1, + (MYXML = new XML(xmlDoc), MYXML.children().length())); +Assert.expectEq ("MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind()", "text", + (MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind())); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent()", true, + (MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/output.txt new file mode 100644 index 000000000..a1fe71db8 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/output.txt @@ -0,0 +1,24 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +8 PASSED! +9 PASSED! +10 PASSED! +11 PASSED! +MYXML = new XML(xmlDoc), MYXML.hasSimpleContent() PASSED! +MYXML = new XML(xmlDoc), MYXML.children().length() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent() PASSED! +MYXML = new XML(xmlDoc), MYXML.children().length() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent() PASSED! +MYXML = new XML(xmlDoc), MYXML.children().length() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent() PASSED! +MYXML = new XML(xmlDoc), MYXML.children().length() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].hasSimpleContent() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/test.swf new file mode 100644 index 000000000..23172eeb1 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_16/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/Test.as new file mode 100644 index 000000000..53fab8a66 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/Test.as @@ -0,0 +1,178 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.17 - XML inScopeNamespaces()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("inScopeNamespaces")); + +x1 = + + one +; + +namespaces = x1.bravo.inScopeNamespaces(); + + +TEST(2, "foo", namespaces[0].prefix); +TEST(3, "http://foo/", namespaces[0].uri); +TEST(4, "bar", namespaces[1].prefix); +TEST(5, "http://bar/", namespaces[1].uri); +//TEST(6, "", namespaces[2].prefix); +//TEST(7, "", namespaces[2].uri); +TEST(8, 2, namespaces.length); + +var n1 = new Namespace('pfx', 'http://w3.org'); +var n2 = new Namespace('http://us.gov'); +var n3 = new Namespace('boo', 'http://us.gov'); +var n4 = new Namespace('boo', 'http://hk.com'); +var xml = "55bird5dinosaur"; + + +Assert.expectEq( "Two namespaces in toplevel scope:", ('http://hk.com'), + ( x1 = new XML(xml), x1.addNamespace(n1), x1.addNamespace(n4), x1.inScopeNamespaces()[1].toString())); + +Assert.expectEq( "Two namespaces in toplevel scope:", ('http://w3.org'), + ( x1 = new XML(xml), x1.addNamespace(n1), x1.addNamespace(n4), x1.inScopeNamespaces()[0].toString())); + +Assert.expectEq( "No namespace:", (''), + ( x1 = new XML(xml), x1.inScopeNamespaces().toString())); + +try { + x1 = new XML(xml); + x1.addNamespace(); + result = "no exception"; +} catch (e1) { + result = "exception"; +} + +Assert.expectEq( "Undefined namespace:", "exception", result); + +Assert.expectEq( "Undefined namespace, length:", 1, + ( x1 = new XML(xml), x1.addNamespace(null), x1.inScopeNamespaces().length)); + +Assert.expectEq( "One namespace w/o prefix, length:", 1, + ( x1 = new XML(xml), x1.addNamespace(n2), x1.inScopeNamespaces().length)); + +Assert.expectEq( "One namespace w/ prefix, length:", 1, + ( x1 = new XML(xml), x1.addNamespace(n1), x1.inScopeNamespaces().length)); + +Assert.expectEq( "One namespace at toplevel, one at child, length at toplevel:", 1, + ( x1 = new XML(xml), x1.addNamespace(n3), x1.b[0].c.addNamespace(n4), x1.inScopeNamespaces().length)); + +Assert.expectEq( "One namespace at toplevel, two at child, length at child:", 2, + ( x1 = new XML(xml), x1.addNamespace(n3), x1.b[1].c.addNamespace(n4), x1.b[1].c.addNamespace(n1), x1.b[1].c.inScopeNamespaces().length)); + +Assert.expectEq( "inScopeNamespaces[0].typeof:", "object", + ( x1 = new XML(xml), x1.addNamespace(n1), x1.addNamespace(n4), typeof x1.inScopeNamespaces()[0])); + +Assert.expectEq( "inScopeNamespaces[1].prefix:", "boo", + ( x1 = new XML(xml), x1.addNamespace(n1), x1.addNamespace(n4), x1.inScopeNamespaces()[1].prefix)); + + +var xmlDoc = "hi"; + +Assert.expectEq( "Reading one toplevel namespace:", (["http://www.w3.org/TR/xsl"]).toString(), + ( x1 = new XML(xmlDoc), x1.inScopeNamespaces().toString())); + +Assert.expectEq( "Reading two namespaces up parent chain:", (["http://www.foo.org/","http://www.w3.org/TR/xsl"]).toString(), + ( x1 = new XML(xmlDoc), x1.b.c.inScopeNamespaces().toString())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/output.txt new file mode 100644 index 000000000..9b2c7488d --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/output.txt @@ -0,0 +1,18 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +8 PASSED! +Two namespaces in toplevel scope: PASSED! +Two namespaces in toplevel scope: PASSED! +No namespace: PASSED! +Undefined namespace: PASSED! +Undefined namespace, length: PASSED! +One namespace w/o prefix, length: PASSED! +One namespace w/ prefix, length: PASSED! +One namespace at toplevel, one at child, length at toplevel: PASSED! +One namespace at toplevel, two at child, length at child: PASSED! +inScopeNamespaces[0].typeof: PASSED! +inScopeNamespaces[1].prefix: PASSED! +Reading one toplevel namespace: PASSED! +Reading two namespaces up parent chain: PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/test.swf new file mode 100644 index 000000000..4bf02b0f6 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_17/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/Test.as new file mode 100644 index 000000000..631a5ab70 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/Test.as @@ -0,0 +1,242 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4.4.18 - XML insertChildAfter()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("insertChildAfter")); + +x1 = + + one + two +; + +correct = + + one + three + two +; + +x1.insertChildAfter(x1.bravo[0], three); + +TEST(2, correct, x1); + +x1 = + + one + two +; + +correct = + + three + one + two +; + +x2 = new XML(); + +x2 = x1.insertChildAfter(null, three); + +TEST(3, correct, x1); + +TEST(4, correct, x2); + +// to simplify string matching +XML.prettyPrinting = false; + +var xmlDoc = ""; +var child1 = new XML("John"); +var child2 = new XML("Sue"); +var child3 = new XML("Bob"); + +var allChildren = new XMLList("JohnSueBob"); +var twoChildren = new XMLList("SueBob"); + +var wholeString = "JohnSueBob"; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.toString()", + "John", + (MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.children()[0].parent() == MYXML", + true, + (MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.children()[0].parent() == MYXML)); + +// The child is equal to child1 (but not the same object) +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.children()[0] == child1", + true, + (MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.children()[0] == child1)); + +// The child is a duplicate of child1 +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.children()[0] === child1", + true, + (MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.children()[0] === child1)); + +var MYXML = new XML(xmlDoc); +MYXML.insertChildAfter(null, child1); + +// !!@ this crashes Rhino's implementation +Assert.expectEq( "MYXML.insertChildAfter(child1, child2), MYXML.toString()", + "JohnSue", + (MYXML.insertChildAfter(child1, child2), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.insertChildAfter(null, child1); + +Assert.expectEq( "MYXML.insertChildAfter(MYXML.children()[0], child2), MYXML.toString()", + "JohnSue", + (MYXML.insertChildAfter(MYXML.children()[0], child2), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.insertChildAfter(null, child1); +MYXML.insertChildAfter(MYXML.children()[0], child2); + +// !!@ this crashes Rhino's implementation +Assert.expectEq( "MYXML.insertChildAfter(child2, child3), MYXML.toString()", + "JohnSueBob", + (MYXML.insertChildAfter(child2, child3), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.insertChildAfter(null, child1); +MYXML.insertChildAfter(MYXML.children()[0], child2); + +Assert.expectEq( "MYXML.insertChildAfter(MYXML.children()[1], child3), MYXML.toString()", + "JohnSueBob", + (MYXML.insertChildAfter(MYXML.children()[1], child3), MYXML.toString())); + + +MYXML = new XML(xmlDoc); + +Assert.expectEq("MYXML.insertChildAfter(null, XMLList), MYXML.toString()", + new XML(wholeString).toString(), + (MYXML.insertChildAfter(null, allChildren), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.insertChildAfter(null, child1); + +Assert.expectEq("MYXML.insertChildAfter(child1, XMLList), MYXML.toString()", + new XML(wholeString).toString(), + (MYXML.insertChildAfter(MYXML.children()[0], twoChildren), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.insertChildAfter(null, child1); + +Assert.expectEq("MYXML.insertChildAfter(child1, \"string\"), MYXML.toString()", + new XML("Johnstring").toString(), + (MYXML.insertChildAfter(MYXML.children()[0], "string"), MYXML.toString())); + + +var a = ; + +try { + a.b.c.insertChildAfter (null, a); + result = a; +} catch (e1) { + result = Utils.typeError(e1.toString()); +} +Assert.expectEq("a = , a.b.c.insertChildAfter(null, a)", "TypeError: Error #1118", result); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/output.txt new file mode 100644 index 000000000..6aa7e77ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/output.txt @@ -0,0 +1,15 @@ +2 PASSED! +3 PASSED! +4 PASSED! +MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.children()[0].parent() == MYXML PASSED! +MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.children()[0] == child1 PASSED! +MYXML = new XML(xmlDoc), MYXML.insertChildAfter(null, child1), MYXML.children()[0] === child1 PASSED! +MYXML.insertChildAfter(child1, child2), MYXML.toString() PASSED! +MYXML.insertChildAfter(MYXML.children()[0], child2), MYXML.toString() PASSED! +MYXML.insertChildAfter(child2, child3), MYXML.toString() PASSED! +MYXML.insertChildAfter(MYXML.children()[1], child3), MYXML.toString() PASSED! +MYXML.insertChildAfter(null, XMLList), MYXML.toString() PASSED! +MYXML.insertChildAfter(child1, XMLList), MYXML.toString() PASSED! +MYXML.insertChildAfter(child1, "string"), MYXML.toString() PASSED! +a = , a.b.c.insertChildAfter(null, a) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/test.swf new file mode 100644 index 000000000..f39d2ca51 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_18/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/Test.as new file mode 100644 index 000000000..6ba72ab73 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/Test.as @@ -0,0 +1,242 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4.4.19 - insertChildBefore()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("insertChildBefore")); + +x1 = + + one + two +; + +correct = + + three + one + two +; + +x1.insertChildBefore(x1.bravo[0], three); + +TEST(2, correct, x1); + +x1 = + + one + two +; + +correct = + + one + two + three +; +x2 = new XML(); + +x2 = x1.insertChildBefore(null, three); + +TEST(3, correct, x1); + +TEST(4, correct, x2); + +// to simplify string matching +XML.prettyPrinting = false; + +var xmlDoc = ""; +var child1 = new XML("John"); +var child2 = new XML("Sue"); +var child3 = new XML("Bob"); + +var allChildren = new XMLList("JohnSueBob"); +var twoChildren = new XMLList("JohnSue"); + +var wholeString = "JohnSueBob"; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.toString()", + "John", + (MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.children()[0].parent() == MYXML", + true, + (MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.children()[0].parent() == MYXML)); + +// The child is equal to child1 (but not the same object) +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.children()[0] == child1", + true, + (MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.children()[0] == child1)); + +// The child is a duplicate of child1 +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.children()[0] === child1", + true, + (MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.children()[0] === child1)); + +var MYXML = new XML(xmlDoc); +MYXML.insertChildBefore(null, child1); + +// !!@ this crashes Rhino's implementation +Assert.expectEq( "MYXML.insertChildBefore(child1, child2), MYXML.toString()", + "SueJohn", + (MYXML.insertChildBefore(child1, child2), MYXML.toString())); + + +var MYXML = new XML(xmlDoc); +MYXML.insertChildBefore(null, child1); + +Assert.expectEq( "MYXML.insertChildBefore(MYXML.children()[0], child2), MYXML.toString()", + "SueJohn", + (MYXML.insertChildBefore(MYXML.children()[0], child2), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.insertChildBefore(null, child2); +MYXML.insertChildBefore(MYXML.children()[0], child1); + +// !!@ this crashes Rhino's implementation +Assert.expectEq( "MYXML.insertChildBefore(child2, child3), MYXML.toString()", + "JohnBobSue", + (MYXML.insertChildBefore(child2, child3), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.insertChildBefore(null, child2); +MYXML.insertChildBefore(MYXML.children()[0], child1); + +Assert.expectEq( "MYXML.insertChildBefore(MYXML.children()[1], child3), MYXML.toString()", + "JohnBobSue", + (MYXML.insertChildBefore(MYXML.children()[1], child3), MYXML.toString())); + +MYXML = new XML(xmlDoc); + +Assert.expectEq("MYXML.insertChildBefore(null, XMLList), MYXML.toString()", + new XML(wholeString).toString(), + (MYXML.insertChildBefore(null, allChildren), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.insertChildBefore(null, child3); + +Assert.expectEq("MYXML.insertChildBefore(child3, XMLList), MYXML.toString()", + new XML(wholeString).toString(), + (MYXML.insertChildBefore(MYXML.children()[0], twoChildren), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.insertChildBefore(null, child1); + +Assert.expectEq("MYXML.insertChildBefore(child1, \"string\"), MYXML.toString()", + new XML("stringJohn").toString(), + (MYXML.insertChildBefore(MYXML.children()[0], "string"), MYXML.toString())); + +var a = ; + +try { + a.b.c.insertChildBefore (null, a); + result = a; +} catch (e1) { + result = Utils.typeError(e1.toString()); +} +Assert.expectEq("a = , a.b.c.insertChildBefore(null,a)", "TypeError: Error #1118", result); + + + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/output.txt new file mode 100644 index 000000000..0893bb9ee --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/output.txt @@ -0,0 +1,15 @@ +2 PASSED! +3 PASSED! +4 PASSED! +MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.children()[0].parent() == MYXML PASSED! +MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.children()[0] == child1 PASSED! +MYXML = new XML(xmlDoc), MYXML.insertChildBefore(null, child1), MYXML.children()[0] === child1 PASSED! +MYXML.insertChildBefore(child1, child2), MYXML.toString() PASSED! +MYXML.insertChildBefore(MYXML.children()[0], child2), MYXML.toString() PASSED! +MYXML.insertChildBefore(child2, child3), MYXML.toString() PASSED! +MYXML.insertChildBefore(MYXML.children()[1], child3), MYXML.toString() PASSED! +MYXML.insertChildBefore(null, XMLList), MYXML.toString() PASSED! +MYXML.insertChildBefore(child3, XMLList), MYXML.toString() PASSED! +MYXML.insertChildBefore(child1, "string"), MYXML.toString() PASSED! +a = , a.b.c.insertChildBefore(null,a) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/test.swf new file mode 100644 index 000000000..a2328ef13 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_19/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/Test.as new file mode 100644 index 000000000..2bcc17b92 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/Test.as @@ -0,0 +1,198 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4.4.2 - XML addNamespace()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("addNamespace")); +//TEST(2, true, XML.prototype.hasOwnProperty("children")); + +e = + + Jim25 + Joe20 +; + +n = "http://foobar/"; +e.addNamespace(n); + +n = new Namespace(); +e.addNamespace(n); + +n = new Namespace("http://foobar/"); +e.addNamespace(n); + +x1 = ; +n = new Namespace("ns", "uri"); +x1.addNamespace(n); +TEST(2, "", x1.toXMLString()); + +var n1 = new Namespace('pfx', 'http://w3.org'); +var n2 = new Namespace('http://us.gov'); +var n3 = new Namespace('boo', 'http://us.gov'); +var n4 = new Namespace('boo', 'http://hk.com'); +var xml = "55bird5dinosaur"; +var xmlwithns = "55bird5dinosaur"; + +Assert.expectEq( "addNamespace with prefix:", "http://w3.org", + ( x1 = new XML(xml), x1.addNamespace(n1), myGetNamespace(x1,'pfx').toString())); + +Assert.expectEq( "addNamespace without prefix:", undefined, + ( x1 = new XML(xml), x1.addNamespace(n2), myGetNamespace(x1, 'blah'))); + +expectedStr = "ArgumentError: Error #1063: Argument count mismatch on XML/addNamespace(). Expected 1, got 0"; +expected = "Error #1063"; +actual = "No error"; + +try { + x1.addNamespace(); +} catch(e1) { + actual = Utils.grabError(e1, e1.toString()); +} + +Assert.expectEq( "addNamespace(): Error. Needs 1 argument", expected, actual); + +Assert.expectEq( "Does namespace w/o prefix change XML object:", true, + ( x1 = new XML(xml), y1 = new XML(xml), x1.addNamespace(n1), (x1 == y1))); + +Assert.expectEq( "Does namespace w/ prefix change XML object:", true, + ( x1 = new XML(xml), y1 = new XML(xml), x1.addNamespace(n2), (x1 == y1))); + +Assert.expectEq( "Adding two different namespaces:", 'http://w3.org', + ( x1 = new XML(xml), x1.addNamespace(n1), x1.addNamespace(n3), myGetNamespace(x1, 'pfx').toString())); + +Assert.expectEq( "Adding two different namespaces:", 'http://us.gov', + ( x1 = new XML(xml), x1.addNamespace(n1), x1.addNamespace(n3), myGetNamespace(x1, 'boo').toString())); + +Assert.expectEq( "Adding namespace with pre-existing prefix:", 'http://hk.com', + ( x1 = new XML(xml), x1.addNamespace(n3), x1.addNamespace(n4), myGetNamespace(x1, 'boo').toString())); + + +Assert.expectEq( "Adding namespace to something other than top node:", 'http://hk.com', + ( x1 = new XML(xml), x1.b[0].d.addNamespace(n4), myGetNamespace(x1.b[0].d, 'boo').toString())); + + +Assert.expectEq( "Adding namespace to XMLList element:", 'http://hk.com', + ( x1 = new XMLList(xml), x1.b[1].addNamespace(n4), myGetNamespace(x1.b[1], 'boo').toString())); + + + +// namespaces with prefixes are preserved + +x2 = text; +x2s = x2.toString(); +correct = '\n text\n'; +Assert.expectEq("Original XML", x2s, correct); + +// Adding a namespace to a node will clear a conflicting prefix +var ns = new Namespace ("ns2", "newuri"); +x2.addNamespace (ns); +x2s = x2.toString(); + +correct = '\n text\n'; + +Assert.expectEq("Adding namespace that previously existed with a different prefix", correct, + x2s); + + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/output.txt new file mode 100644 index 000000000..8ab1106f6 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/output.txt @@ -0,0 +1,14 @@ +2 PASSED! +addNamespace with prefix: PASSED! +addNamespace without prefix: PASSED! +Asserting for ArgumentError PASSED! +addNamespace(): Error. Needs 1 argument PASSED! +Does namespace w/o prefix change XML object: PASSED! +Does namespace w/ prefix change XML object: PASSED! +Adding two different namespaces: PASSED! +Adding two different namespaces: PASSED! +Adding namespace with pre-existing prefix: PASSED! +Adding namespace to something other than top node: PASSED! +Adding namespace to XMLList element: PASSED! +Original XML PASSED! +Adding namespace that previously existed with a different prefix PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/test.swf new file mode 100644 index 000000000..a78c84c4e Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_2/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/Test.as new file mode 100644 index 000000000..c18040bf5 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/Test.as @@ -0,0 +1,145 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.20 - XML length()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("length")); + +x1 = + + one + + two + three + four + + +; + +TEST(2, 1, x1.length()); +TEST(3, 1, x1.bravo.length()); +TEST(4, 1, x1.charlie.length()); +TEST(5, 1, x1.delta.length()); + +var xmlDoc = "JohnWalton25SueDay32" + + +// propertyName as a string +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.length()", 1, + (MYXML = new XML(xmlDoc), MYXML.length())); + +Assert.expectEq( "MYXML = new XML(), MYXML.length()", 1, + (MYXML = new XML(), MYXML.length())); + +Assert.expectEq( "MYXML = new XML(null), MYXML.length()", 1, + (MYXML = new XML(null), MYXML.length())); + +Assert.expectEq( "MYXML = new XML(undefined), MYXML.length()", 1, + (MYXML = new XML(undefined), MYXML.length())); + +Assert.expectEq( "MYXML = new XML('foo'), MYXML.length()", 1, + (MYXML = new XML("foo"), MYXML.length())); + +XML.ignoreComments = false; +Assert.expectEq( "MYXML = new XML(''), MYXML.length()", 1, + (MYXML = new XML(""), MYXML.length())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/output.txt new file mode 100644 index 000000000..2580d1004 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/output.txt @@ -0,0 +1,10 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +MYXML = new XML(xmlDoc), MYXML.length() PASSED! +MYXML = new XML(), MYXML.length() PASSED! +MYXML = new XML(null), MYXML.length() PASSED! +MYXML = new XML(undefined), MYXML.length() PASSED! +MYXML = new XML('foo'), MYXML.length() PASSED! +MYXML = new XML(''), MYXML.length() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/test.swf new file mode 100644 index 000000000..d6bcae4d7 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_20/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/Test.as new file mode 100644 index 000000000..e010ba69b --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/Test.as @@ -0,0 +1,168 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.21 - XML localName()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("localName")); + +x1 = new XML("onetwo"); +var y1; +y1 = x1.localName(); +TEST(2, "string", typeof(y1)); +TEST(3, "alpha", y1); + +y1 = x1.bravo.localName(); +x1.bravo.setNamespace("http://someuri"); +TEST(4, "bravo", y1); + +x1 = + + one +; + +ns = new Namespace("http://foo/"); +y1 = x1.ns::bravo.localName(); +TEST(5, "string", typeof(y1)); +TEST(6, "bravo", y1); + +y1 = x1.ns::bravo.@name.localName(); +TEST(7, "name", y1); + +y1 = x1.ns::bravo.@ns::value.localName(); +TEST(8, "value", y1); + +var xmlDoc = "John California "; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.localName()", + "company", + (MYXML = new XML(xmlDoc), MYXML.localName())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.localName() instanceof QName", + false, + (MYXML = new XML(xmlDoc), MYXML.localName() instanceof QName)); + +// !!@ fails in Rhino?? +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.localName() instanceof String", + true, + (MYXML = new XML(xmlDoc), MYXML.localName() instanceof String)); + +Assert.expectEq( "MYXML = new XML(xmlDoc), typeof(MYXML.localName())", + "string", + (MYXML = new XML(xmlDoc), typeof(MYXML.localName()))); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.children()[0].localName()", + "employee", + (MYXML = new XML(xmlDoc), MYXML.children()[0].localName())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.children()[0].localName() instanceof QName", + false, + (MYXML = new XML(xmlDoc), MYXML.children()[0].localName() instanceof QName)); + +// !!@ fails in Rhino?? +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.children()[0].localName() instanceof String", + true, + (MYXML = new XML(xmlDoc), MYXML.children()[0].localName() instanceof String)); + +Assert.expectEq( "MYXML = new XML(xmlDoc), typeof(MYXML.children()[0].localName())", + "string", + (MYXML = new XML(xmlDoc), typeof(MYXML.children()[0].localName()))); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/output.txt new file mode 100644 index 000000000..fd415992a --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/output.txt @@ -0,0 +1,15 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +8 PASSED! +MYXML = new XML(xmlDoc), MYXML.localName() PASSED! +MYXML = new XML(xmlDoc), MYXML.localName() instanceof QName PASSED! +MYXML = new XML(xmlDoc), MYXML.localName() instanceof String PASSED! +MYXML = new XML(xmlDoc), typeof(MYXML.localName()) PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].localName() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].localName() instanceof QName PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].localName() instanceof String PASSED! +MYXML = new XML(xmlDoc), typeof(MYXML.children()[0].localName()) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/test.swf new file mode 100644 index 000000000..ecaa40741 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_21/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/Test.as new file mode 100644 index 000000000..094cc0f3d --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/Test.as @@ -0,0 +1,171 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.22 - XML name()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("name")); + +x1 = + + one + + two + +; + +y1 = x1.bravo.name(); + +TEST(2, "object", typeof(y1)); +TEST(3, QName("bravo"), y1); + +x1 = + + one +; + +ns = new Namespace("http://foo/"); +y1 = x1.ns::bravo.name(); + +TEST(4, "object", typeof(y1)); +TEST(5, QName("http://foo/", "bravo"), y1); + +y1 = x1.ns::bravo.@name.name(); +TEST(6, QName("name"), y1); + +y1 = x1.ns::bravo.@ns::value.name(); +TEST(7, "http://foo/", y1.uri); +TEST(8, "value", y1.localName); +TEST(9, QName("http://foo/", "value"), y1); + +function convertToString(o:Object){ + return o.toString(); +} + +var xmlDoc = "John California "; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.name()", + convertToString(new QName("company")), + (MYXML = new XML(xmlDoc), MYXML.name()).toString()); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.name() instanceof QName", + true, + (MYXML = new XML(xmlDoc), MYXML.name() instanceof QName)); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.name().toString()", + "company", + (MYXML = new XML(xmlDoc), MYXML.name().toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.children()[0].name()", + + convertToString(new QName("http://colors.com/printer/", "employee")), + + (MYXML = new XML(xmlDoc), MYXML.children()[0].name()).toString() + ); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.children()[0].name() instanceof QName", + true, + (MYXML = new XML(xmlDoc), MYXML.children()[0].name() instanceof QName)); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.children()[0].name().toString()", + "http://colors.com/printer/::employee", + (MYXML = new XML(xmlDoc), MYXML.children()[0].name().toString())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/output.txt new file mode 100644 index 000000000..ec14c8827 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/output.txt @@ -0,0 +1,14 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +8 PASSED! +9 PASSED! +MYXML = new XML(xmlDoc), MYXML.name() PASSED! +MYXML = new XML(xmlDoc), MYXML.name() instanceof QName PASSED! +MYXML = new XML(xmlDoc), MYXML.name().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].name() PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].name() instanceof QName PASSED! +MYXML = new XML(xmlDoc), MYXML.children()[0].name().toString() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/test.swf new file mode 100644 index 000000000..09c6b802d Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_22/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/Test.as new file mode 100644 index 000000000..6a15ac8f6 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/Test.as @@ -0,0 +1,207 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4.4.23 - XML getNamespace()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("getNamespace")); + +// Prefix case +x1 = + + one +; + +//y = x1.getNamespace(); +y1 = myGetNamespace(x1); +TEST(2, "object", typeof(y1)); +TEST(3, Namespace("http://foo/"), y1); + +//y = x1.getNamespace("bar"); +y1 = myGetNamespace(x1, "bar"); +TEST(4, "object", typeof(y1)); +TEST(5, Namespace("http://bar/"), y1); + +// No Prefix Case +x1 = + + one +; + +//y = x1.getNamespace(); +y1 = myGetNamespace(x1); +TEST(6, "object", typeof(y1)); +TEST(7, Namespace("http://foobar/"), y1); + +// No Namespace case +x1 = + + one +; +//TEST(8, Namespace(""), x1.getNamespace()); +TEST(8, Namespace(""), myGetNamespace(x1)); + +// Namespaces of attributes +x1 = + + one +; + +var ns = new Namespace("http://bar"); +//y1 = x1.ns::bravo.@name.getNamespace(); +y1 = myGetNamespace(x1.ns::bravo.@name); +TEST(9, Namespace(""), y1); + +//y1 = x1.ns::bravo.@ns::value.getNamespace(); +y1 = myGetNamespace(x1.ns::bravo.@ns::value); +TEST(10, ns.toString(), y1.toString()); + +var xmlDoc = "hi"; +var ns1 = Namespace ("xsl", "http://www.w3.org/TR/xsl"); +var ns2 = Namespace ("foo", "http://www.foo.org"); + + +function convertToString(o:Object){ + return o.toString(); +} + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.getNamespace()", + "http://www.w3.org/TR/xsl", + (MYXML = new XML(xmlDoc), myGetNamespace(MYXML).toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.getNamespace()", + convertToString(new Namespace("http://www.w3.org/TR/xsl")), + (MYXML = new XML(xmlDoc), myGetNamespace(MYXML)).toString()); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.getNamespace('stylesheet')", + convertToString(new Namespace ("http://www.w3.org/TR/xsl")), + (MYXML = new XML(xmlDoc), myGetNamespace(MYXML, 'xsl')).toString()); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.getNamespace('xsl')", + "http://www.w3.org/TR/xsl", (MYXML = new XML(xmlDoc), + myGetNamespace(MYXML, 'xsl').toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.getNamespace('foo')", + undefined, (MYXML = new XML(xmlDoc), + myGetNamespace(MYXML, 'foo'))); + + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.b.c.getNamespace('foo')", + "http://www.foo.org/", (MYXML = new XML(xmlDoc), + myGetNamespace(MYXML.b.c, 'foo').toString())); + + +x1 = +<> +one +b; + +try { + ns = x1.namespace(); + result = ns; +} catch (e1) { + result = Utils.typeError(e1.toString()); +} + +Assert.expectEq("Calling namespace on list with two items", "TypeError: Error #1086", result); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/output.txt new file mode 100644 index 000000000..b2a237b36 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/output.txt @@ -0,0 +1,16 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +8 PASSED! +9 PASSED! +10 PASSED! +MYXML = new XML(xmlDoc), MYXML.getNamespace() PASSED! +MYXML = new XML(xmlDoc), MYXML.getNamespace() PASSED! +MYXML = new XML(xmlDoc), MYXML.getNamespace('stylesheet') PASSED! +MYXML = new XML(xmlDoc), MYXML.getNamespace('xsl') PASSED! +MYXML = new XML(xmlDoc), MYXML.getNamespace('foo') PASSED! +MYXML = new XML(xmlDoc), MYXML.b.c.getNamespace('foo') PASSED! +Calling namespace on list with two items PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/test.swf new file mode 100644 index 000000000..dbffd8c2c Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_23/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/Test.as new file mode 100644 index 000000000..879a84f29 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/Test.as @@ -0,0 +1,181 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.24 - XML namespaceDeclarations()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("namespaceDeclarations")); + +x1 = + + one +; + +y1 = x1.namespaceDeclarations(); + +TEST(2, 2, y1.length); +TEST(3, "object", typeof(y1[0])); +TEST(4, "object", typeof(y1[1])); +TEST(5, "foo", y1[0].prefix); +TEST(6, Namespace("http://foo/"), y1[0]); +TEST(7, "bar", y1[1].prefix); +TEST(8, Namespace("http://bar/"), y1[1]); + +var n1 = new Namespace('pfx', 'http://w3.org'); +var n2 = new Namespace('http://us.gov'); +var n3 = new Namespace('boo', 'http://us.gov'); +var n4 = new Namespace('boo', 'http://hk.com'); +var xml1 = "55bird5dinosaur"; + +//Assert.expectEq( "Undefined declaration:", (''), +// ( x1 = new XML(xml1), x1.addNamespace(), x1.namespaceDeclarations().toString())); + +Assert.expectEq( "Undefined declaration, length:", 0, + ( x1 = new XML(xml1), x1.addNamespace(null), x1.namespaceDeclarations().length)); + +Assert.expectEq( "Two declarations in toplevel scope:", ('http://hk.com'), + ( x1 = new XML(xml1), x1.addNamespace(n1), x1.addNamespace(n4), x1.namespaceDeclarations()[1].toString())); + +Assert.expectEq( "Two declarations in toplevel scope:", ('http://w3.org'), + ( x1 = new XML(xml1), x1.addNamespace(n1), x1.addNamespace(n4), x1.namespaceDeclarations()[0].toString())); + +Assert.expectEq( "No declaration:", (''), + ( x1 = new XML(xml1), x1.namespaceDeclarations().toString())); + +Assert.expectEq( "One declaration w/o prefix, length:", 0, + ( x1 = new XML(xml1), x1.addNamespace(n2), x1.namespaceDeclarations().length)); + +Assert.expectEq( "One declaration w/ prefix, length:", 1, + ( x1 = new XML(xml1), x1.addNamespace(n1), x1.namespaceDeclarations().length)); + +Assert.expectEq( "One declaration at toplevel, one at child, length at toplevel:", 1, + ( x1 = new XML(xml1), x1.addNamespace(n3), x1.b[0].c.addNamespace(n4), x1.namespaceDeclarations().length)); + +Assert.expectEq( "One declaration at toplevel, two at child, length at child:", 2, + ( x1 = new XML(xml1), x1.addNamespace(n3), x1.b[1].c.addNamespace(n4), x1.b[1].c.addNamespace(n1), x1.b[1].c.namespaceDeclarations().length)); + +Assert.expectEq( "namespaceDeclarations[1].typeof:", "object", + ( x1 = new XML(xml1), x1.addNamespace(n1), x1.addNamespace(n4), typeof x1.namespaceDeclarations()[1])); + +Assert.expectEq( "namespaceDeclarations[1].prefix:", "boo", + ( x1 = new XML(xml1), x1.addNamespace(n1), x1.addNamespace(n4), x1.namespaceDeclarations()[1].prefix)); + + +var xml1Doc = "hi"; + +Assert.expectEq( "Reading one toplevel declaration:", "http://www.w3.org/TR/xsl", + ( x1 = new XML(xml1Doc), x1.namespaceDeclarations().toString())); + +Assert.expectEq( "Another declaration up parent chain:", "http://www.foo.org/", + ( x1 = new XML(xml1Doc), x1.b.c.namespaceDeclarations().toString())); + +// Adding because of Mozilla bug https://bugzilla.mozilla.org/show_bug.cgi?id=278112 + +var xhtml1NS = new Namespace('http://www.w3.org/1999/xhtml'); +var xhtml = ; + +Assert.expectEq("namespaceDeclarations before setNamespace()", 0, xhtml.namespaceDeclarations().length); + +xhtml.setNamespace(xhtml1NS); + +Assert.expectEq("namespaceDeclarations after setNamespace()", 0, xhtml.namespaceDeclarations().length); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/output.txt new file mode 100644 index 000000000..40f4aa6e0 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/output.txt @@ -0,0 +1,21 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +8 PASSED! +Undefined declaration, length: PASSED! +Two declarations in toplevel scope: PASSED! +Two declarations in toplevel scope: PASSED! +No declaration: PASSED! +One declaration w/o prefix, length: PASSED! +One declaration w/ prefix, length: PASSED! +One declaration at toplevel, one at child, length at toplevel: PASSED! +One declaration at toplevel, two at child, length at child: PASSED! +namespaceDeclarations[1].typeof: PASSED! +namespaceDeclarations[1].prefix: PASSED! +Reading one toplevel declaration: PASSED! +Another declaration up parent chain: PASSED! +namespaceDeclarations before setNamespace() PASSED! +namespaceDeclarations after setNamespace() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/test.swf new file mode 100644 index 000000000..0cd860573 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_24/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/Test.as new file mode 100644 index 000000000..cfc400690 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/Test.as @@ -0,0 +1,169 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.25 - XML nodeKind()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("nodeKind")); + +x1 = + + one +; + +TEST(2, "element", x1.bravo.nodeKind()); +TEST(3, "attribute", x1.@attr1.nodeKind()); + +// Non-existant node type is text +x1 = new XML(); +TEST(4, "text", x1.nodeKind()); +//TEST(5, "text", XML.prototype.nodeKind()); + +var xmlDoc = "John California "; + + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.nodeKind()", + "element", + (MYXML = new XML(xmlDoc), MYXML.nodeKind())); + +Assert.expectEq( "MYXML = new XML(null), MYXML.nodeKind()", + "text", + (MYXML = new XML(null), MYXML.nodeKind())); + +Assert.expectEq( "MYXML = new XML(undefined), MYXML.nodeKind()", + "text", + (MYXML = new XML(undefined), MYXML.nodeKind())); + +Assert.expectEq( "MYXML = new XML(), MYXML.nodeKind()", + "text", + (MYXML = new XML(), MYXML.nodeKind())); + +Assert.expectEq( "MYXML = new XML(), MYXML.children()[0].nodeKind()", + "element", + (MYXML = new XML(xmlDoc), MYXML.children()[0].nodeKind())); + +Assert.expectEq( "MYXML = new XML(), MYXML.children()[0].attributes()[0].nodeKind()", + "attribute", + (MYXML = new XML(xmlDoc), MYXML.children()[0].attributes()[0].nodeKind())); + +Assert.expectEq( "MYXML = new XML(), MYXML.children()[0].name1.children()[0].nodeKind()", + "text", + (MYXML = new XML(xmlDoc), MYXML.children()[0].name1.children()[0].nodeKind())); + +XML.ignoreComments = false +Assert.expectEq( "MYXML = new XML(\"\"), MYXML.nodeKind()", + "element", + (MYXML = new XML(""), MYXML.nodeKind())); + +Assert.expectEq( "MYXML = new XML(\"\"), MYXML.children()[0].nodeKind()", + "comment", + (MYXML = new XML(""), MYXML.children()[0].nodeKind())); + +XML.ignoreProcessingInstructions = false +Assert.expectEq( "MYXML = new XML(\"\"), MYXML.nodeKind()", + "element", + (MYXML = new XML(""), MYXML.nodeKind())); + +Assert.expectEq( "MYXML = new XML(\"\"), MYXML.children()[0].nodeKind()", + "processing-instruction", + (MYXML = new XML(""), MYXML.children()[0].nodeKind())); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/output.txt new file mode 100644 index 000000000..2531bd98a --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/output.txt @@ -0,0 +1,14 @@ +2 PASSED! +3 PASSED! +4 PASSED! +MYXML = new XML(xmlDoc), MYXML.nodeKind() PASSED! +MYXML = new XML(null), MYXML.nodeKind() PASSED! +MYXML = new XML(undefined), MYXML.nodeKind() PASSED! +MYXML = new XML(), MYXML.nodeKind() PASSED! +MYXML = new XML(), MYXML.children()[0].nodeKind() PASSED! +MYXML = new XML(), MYXML.children()[0].attributes()[0].nodeKind() PASSED! +MYXML = new XML(), MYXML.children()[0].name1.children()[0].nodeKind() PASSED! +MYXML = new XML(""), MYXML.nodeKind() PASSED! +MYXML = new XML(""), MYXML.children()[0].nodeKind() PASSED! +MYXML = new XML(""), MYXML.nodeKind() PASSED! +MYXML = new XML(""), MYXML.children()[0].nodeKind() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/test.swf new file mode 100644 index 000000000..a7fd90719 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_25/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/Test.as new file mode 100644 index 000000000..b12f3e5e3 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/Test.as @@ -0,0 +1,155 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.26 - XML normalize()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("normalize")); + +XML.ignoreWhitespace = false; +XML.prettyPrinting = false; + +x1 = + one ; + +TEST_XML(2, " one ", x1); +x1.normalize(); +TEST_XML(3, " one ", x1); + +x1 = + + one +; + +x1.normalize(); +TEST_XML(5, " one ", x1); + +XML.prettyPrinting = true; +var xml = new XML(""); +var a = new XML("zero"); +var b = new XML("one"); +var c = new XML("two"); +var d = new XML("two"); + +xml.appendChild (a); +xml.appendChild (b); +xml.appendChild (c); +xml.appendChild (d); + +Assert.expectEq( "xml has multiple text nodes, xml.normalize(), xml.toString()", + "" + NL() + " zeroonetwo" + NL() + " two" + NL() + "", + (xml.normalize(), xml.toString())); + +xml = new XMLList("b"); +a = new XMLList("one"); +b = new XMLList("two"); +c = new XMLList(""); +d = new XMLList("three"); + +xml.appendChild (a); +xml.appendChild (b); +xml.appendChild (c); +xml.appendChild (d); + +Assert.expectEq( "xml has multiple text nodes, xml.normalize(), xml.toString()", + "" + NL() + " bonetwo" + NL() + " " + NL() + " three" + NL() + "", +(xml.normalize(), xml.toString())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/output.txt new file mode 100644 index 000000000..6fbd23b32 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/output.txt @@ -0,0 +1,5 @@ +2 PASSED! +3 PASSED! +5 PASSED! +xml has multiple text nodes, xml.normalize(), xml.toString() PASSED! +xml has multiple text nodes, xml.normalize(), xml.toString() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/test.swf new file mode 100644 index 000000000..acea53ce1 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_26/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/Test.as new file mode 100644 index 000000000..f4b27477e --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/Test.as @@ -0,0 +1,161 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.27 - XML parent()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("parent")); + +var x1 = + + one + + two + +; + +var y1 = x1.bravo; + +TEST(2, x1, y1.parent()); + +TEST(3, undefined, x1.parent()); + +x1 = new XML(""); +var a = new XML("text node"); +var b = new XML("bar"); + +Assert.expectEq ("MYXML = new(''), MYXML.parent()", undefined, x1.parent()); +Assert.expectEq ("MYXML = new('text node'), MYXML.parent()", undefined, a.parent()); +Assert.expectEq ("MYXML = new('bar'), MYXML.parent()", undefined, b.parent()); + +x1.appendChild (a); +x1.appendChild (b); + + +// Text node is a special case +Assert.expectEq ("a - orphan node after x.appendChild, a.parent()", undefined, a.parent()); +Assert.expectEq ("b - orphan node after x.appendChild, b.parent()", x1, b.parent()); + +Assert.expectEq ("x1.children()[0].parent()", x1, x1.children()[0].parent()); +Assert.expectEq ("x1.children()[1].parent()", x1, x1.children()[0].parent()); +Assert.expectEq ("x1.children()[0].parent() === x1", true, (x1.children()[0].parent() === x1)); +Assert.expectEq ("x1.children()[1].parent() === x1", true, (x1.children()[0].parent() === x1)); + +var xDoc = "John California Mary Texas "; + +Assert.expectEq( "x1 = new XML(xDoc), x1.employee[0].parent() == x1", true, (x1 = new XML(xDoc), x1.employee[0].parent() == x1)); +Assert.expectEq( "x1 = new XML(xDoc), x1.employee.name1[0].parent() == x1.employee[0]", true, (x1 = new XML(xDoc), x1.employee.name1[0].parent() == x1.employee[0])); +Assert.expectEq( "x1 = new XML(xDoc), x1.employee[0].attribute('id').parent() === x1.employee[0]", true, (x1 = new XML(xDoc), x1.employee[0].attribute('id').parent() === x1.employee[0])); + +Assert.expectEq( "x1 = new XML(xDoc), x1.employee[1].parent() == x1", true, (x1 = new XML(xDoc), x1.employee[1].parent() == x1)); +Assert.expectEq( "x1 = new XML(xDoc), x1.employee.name1[1].parent() == x1.employee[0]", true, (x1 = new XML(xDoc), x1.employee.name1[1].parent() == x1.employee[1])); +Assert.expectEq( "x1 = new XML(xDoc), x1.employee[1].attribute('id').parent() === x1.employee[1]", true, (x1 = new XML(xDoc), x1.employee[1].attribute('id').parent() === x1.employee[1])); + +XML.ignoreComments = false; +XML.ignoreProcessingInstructions = false; +xDoc = ""; + +// Tests comments and PI nodes +Assert.expectEq( "x1 = new XML(xDoc), x1.children()[0].parent() == x1", true, (x1 = new XML(xDoc), x1.children()[0].parent() == x1)); +Assert.expectEq( "x1 = new XML(xDoc), x1.children()[1].parent() == x1", true, (x1 = new XML(xDoc), x1.children()[1].parent() == x1)); +Assert.expectEq( "x1 = new XML(xDoc), x1.children().parent() == x1", true, (x1 = new XML(xDoc), x1.children().parent() == x1)); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/output.txt new file mode 100644 index 000000000..b3861066d --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/output.txt @@ -0,0 +1,20 @@ +2 PASSED! +3 PASSED! +MYXML = new(''), MYXML.parent() PASSED! +MYXML = new('text node'), MYXML.parent() PASSED! +MYXML = new('bar'), MYXML.parent() PASSED! +a - orphan node after x.appendChild, a.parent() PASSED! +b - orphan node after x.appendChild, b.parent() PASSED! +x1.children()[0].parent() PASSED! +x1.children()[1].parent() PASSED! +x1.children()[0].parent() === x1 PASSED! +x1.children()[1].parent() === x1 PASSED! +x1 = new XML(xDoc), x1.employee[0].parent() == x1 PASSED! +x1 = new XML(xDoc), x1.employee.name1[0].parent() == x1.employee[0] PASSED! +x1 = new XML(xDoc), x1.employee[0].attribute('id').parent() === x1.employee[0] PASSED! +x1 = new XML(xDoc), x1.employee[1].parent() == x1 PASSED! +x1 = new XML(xDoc), x1.employee.name1[1].parent() == x1.employee[0] PASSED! +x1 = new XML(xDoc), x1.employee[1].attribute('id').parent() === x1.employee[1] PASSED! +x1 = new XML(xDoc), x1.children()[0].parent() == x1 PASSED! +x1 = new XML(xDoc), x1.children()[1].parent() == x1 PASSED! +x1 = new XML(xDoc), x1.children().parent() == x1 PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/test.swf new file mode 100644 index 000000000..c4c6adeae Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_27/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/Test.as new file mode 100644 index 000000000..46f88f954 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/Test.as @@ -0,0 +1,210 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + + +function writeTestCaseResult(d,e,a) +{ + trace("writeTestCaseResult: " + d + ", expected " + e + ", got " + a ); +} + + +function test(... rest:Array) { + + if( rest.length == 0 ){ + // no args sent, use default test + for ( var tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description +" = "+ testcases[tc].actual ); + testcases[tc].reason += checkReason(testcases[tc].passed); + } + } else { + // we need to use a specialized call to writeTestCaseResult + if( rest[0] == "no actual" ){ + for ( var tc=0; tc < testcases.length; tc++ ) { + testcases[tc].passed = writeTestCaseResult( + testcases[tc].expect, + testcases[tc].actual, + testcases[tc].description ); + testcases[tc].reason += checkReason(testcases[tc].passed); + } + } + } + // stopTest(); + return ( testcases ); +} + + +START("13.4.4.28 - processingInsructions()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("processingInstructions")); + +XML.ignoreProcessingInstructions = false; + +// test generic PI +var x1 = new XML("one"); + +var correct = new XMLList(""); + +TEST(2, correct, x1.processingInstructions()); +TEST(3, correct, x1.processingInstructions("*")); + +correct = ""; + +TEST_XML(4, correct, x1.processingInstructions("xyz")); + +// test XML-decl +// Un-comment these tests when we can read in doc starting with PI. +x1 = new XML("one"); + +correct = new XMLList(""); + +test(5, correct, x1.processingInstructions()); +test(6, correct, x1.processingInstructions("*")); +test(7, correct, x1.processingInstructions("xml")); + +// extra whitespace is on purpose for at the end of this string +var xmlDoc = "JohnWalton25 SueDay32" + +// propertyName as a string +XML.ignoreProcessingInstructions = true; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.processingInstructions().toString()", "", + (MYXML = new XML(xmlDoc), MYXML.processingInstructions().toString())); + +XML.ignoreProcessingInstructions = false; + +Assert.expectEq( "ignorePI = false, MYXML = new XML(xmlDoc), MYXML.processingInstructions().toString()", + "\n", + (MYXML = new XML(xmlDoc), MYXML.processingInstructions().toXMLString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.processingInstructions('*')", + "\n", + (MYXML = new XML(xmlDoc), MYXML.processingInstructions("*").toXMLString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.processingInstructions('xml-stylesheet')", + "", + (MYXML = new XML(xmlDoc), MYXML.processingInstructions("xml-stylesheet").toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.processingInstructions(new QName('xml-stylesheet'))", + "", + (MYXML = new XML(xmlDoc), MYXML.processingInstructions(new QName("xml-stylesheet")).toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.processingInstructions(new QName('foo'))", + "", + (MYXML = new XML(xmlDoc), MYXML.processingInstructions(new QName("foo")).toString())); + +// Attribute name does not match +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.processingInstructions('@xml-stylesheet')", + "", + (MYXML = new XML(xmlDoc), MYXML.processingInstructions("@xml-stylesheet").toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.processingInstructions('xml-foo')", + "", + (MYXML = new XML(xmlDoc), MYXML.processingInstructions("xml-foo").toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.processingInstructions('child-xml')", + "", + (MYXML = new XML(xmlDoc), MYXML.processingInstructions("child-xml").toString())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/output.txt new file mode 100644 index 000000000..274c8276a --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/output.txt @@ -0,0 +1,12 @@ +2 PASSED! +3 PASSED! +4 PASSED! +MYXML = new XML(xmlDoc), MYXML.processingInstructions().toString() PASSED! +ignorePI = false, MYXML = new XML(xmlDoc), MYXML.processingInstructions().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.processingInstructions('*') PASSED! +MYXML = new XML(xmlDoc), MYXML.processingInstructions('xml-stylesheet') PASSED! +MYXML = new XML(xmlDoc), MYXML.processingInstructions(new QName('xml-stylesheet')) PASSED! +MYXML = new XML(xmlDoc), MYXML.processingInstructions(new QName('foo')) PASSED! +MYXML = new XML(xmlDoc), MYXML.processingInstructions('@xml-stylesheet') PASSED! +MYXML = new XML(xmlDoc), MYXML.processingInstructions('xml-foo') PASSED! +MYXML = new XML(xmlDoc), MYXML.processingInstructions('child-xml') PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/test.swf new file mode 100644 index 000000000..3d1438511 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_28/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/Test.as new file mode 100644 index 000000000..e8989a445 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/Test.as @@ -0,0 +1,310 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4.4.29 - XML prependChild()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("prependChild")); + +x1 = + + + one + +; + +correct = + + + bar + one + +; + +x1.bravo.prependChild(bar); + +TEST(2, correct, x1); + +emps = + + + John + + + Sue + + + +correct = + + + Mr. + John + + + Sue + + + +emps.employee.(name == "John").prependChild(Mr.); + +TEST(3, correct, emps); + +XML.prettyPrinting = false; +var xmlDoc = ""; +var child1 = new XML("John"); +var child2 = new XML("Sue"); +var child3 = new XML("Bob"); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.prependChild(child1), MYXML.toString()", + "John", + (MYXML = new XML(xmlDoc), MYXML.prependChild(child1), MYXML.toString())); + +var MYXML = new XML(xmlDoc); +MYXML.prependChild(child2); + +Assert.expectEq( "MYXML.prependChild(child1), MYXML.toString()", + "JohnSue", + (MYXML.prependChild(child1), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); + +Assert.expectEq ("Making sure child added is a duplicate", true, (child2 === MYXML.children()[0])); +Assert.expectEq ("Making sure child added is a true copy", true, (child2 == MYXML.children()[0])); + +Assert.expectEq( "MYXML.prependChild(child1), MYXML.toString()", + "JohnSueBob", + (MYXML.prependChild(child1), MYXML.toString())); + +Assert.expectEq( "MYXML.prependChild('simple text string'), MYXML.toString()", + "simple text stringJohnSueBob", + (MYXML.prependChild("simple text string"), MYXML.toString())); + +// !!@ test cases for adding comment nodes, PI nodes + +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); +MYXML.prependChild(child1); + +var expectedResult; +expectedResult = '<!-- comment -->JohnSueBob'; + +Assert.expectEq( "MYXML.prependChild(''), MYXML.toString()", + expectedResult, + (MYXML.prependChild(""), MYXML.toString())); + +XML.ignoreComments = false; +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); +MYXML.prependChild(child1); + +expectedResult = '<!-- comment -->JohnSueBob'; + +Assert.expectEq( "MYXML.prependChild(''), MYXML.toString()", + expectedResult, + (MYXML.prependChild(""), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); +MYXML.prependChild(child1); + +expectedResult = '<?xml-stylesheet href="classic.xsl" type="text/xml"?>JohnSueBob'; + +Assert.expectEq( "MYXML.prependChild(''), MYXML.toString()", + expectedResult, + (MYXML.prependChild(""), MYXML.toString())); + +XML.ignoreProcessingInstructions = false; +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); +MYXML.prependChild(child1); + +var expected = "TypeError: error: XML declaration may only begin entities."; +var result = "error, exception not thrown"; + +expectedResult = '<?xml-stylesheet href="classic.xsl" type="text/xml"?>JohnSueBob'; + +Assert.expectEq( "MYXML.prependChild(''), MYXML.toString()", + expectedResult, + (MYXML.prependChild(""), MYXML.toString())); + +try{ + +MYXML.prependChild(""); + +} catch( e1 ){ + +result = e1.toString(); + +} +//Taking test out because bug 108406 has been deferred. +//Assert.expectEq("OPEN BUG: 108406 - MYXML.prependChild(\"\")", expected, result); + +// !!@ setting a property that starts with an "@" that implies an attribute name?? +// Rhino throws an error + +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); +MYXML.prependChild(child1); + +expectedResult = '<@notanattribute>hi</@notanattribute>JohnSueBob'; + +Assert.expectEq( "MYXML.prependChild(\"<@notanattribute>hi\"), MYXML.toString()", + expectedResult, + (MYXML.prependChild("<@notanattribute>hi"), MYXML.toString())); + +MYXML = new XML(''); +x1 = new XMLList('GiantsRobots'); +MYXML.prependChild(x1); + +Assert.expectEq( "Prepend XMLList", + 'GiantsRobots', + (MYXML.toString()) ); + +MYXML = new XML(''); +x1 = "poltergeist"; +MYXML.MOVIE.prependChild(x1); + +Assert.expectEq( "Prepend a string to child node", + 'poltergeist', + (MYXML.toString()) ); + +// I believe the following two test cases are wrong. See bug 145184. + +MYXML = new XML(''); +x1 = "poltergeist"; +MYXML.prependChild(x1); + +Assert.expectEq( "Prepend a string to top node", + 'poltergeist', + (MYXML.toString()) ); + +MYXML = new XML(''); +x1 = new XML("poltergeist"); +MYXML.prependChild(x1); + +Assert.expectEq( "Prepend a node to child node", + 'poltergeist', + (MYXML.toString()) ); + +var a = ; + +try { + a.b.prependChild (a); + result = a; +} catch (e1) { + result = Utils.typeError(e1.toString()); +} + +Assert.expectEq("a = , a.b.prependChild(a)", "TypeError: Error #1118", result); + + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/config.xml new file mode 100644 index 000000000..8ab0a16ac --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/config.xml @@ -0,0 +1,14 @@ + + + + . + ../../../../lib + + false + false + false + false + + 10 + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/output.txt new file mode 100644 index 000000000..48d4c4825 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/output.txt @@ -0,0 +1,18 @@ +2 PASSED! +3 PASSED! +MYXML = new XML(xmlDoc), MYXML.prependChild(child1), MYXML.toString() PASSED! +MYXML.prependChild(child1), MYXML.toString() PASSED! +Making sure child added is a duplicate PASSED! +Making sure child added is a true copy PASSED! +MYXML.prependChild(child1), MYXML.toString() PASSED! +MYXML.prependChild('simple text string'), MYXML.toString() PASSED! +MYXML.prependChild(''), MYXML.toString() PASSED! +MYXML.prependChild(''), MYXML.toString() PASSED! +MYXML.prependChild(''), MYXML.toString() PASSED! +MYXML.prependChild(''), MYXML.toString() PASSED! +MYXML.prependChild("<@notanattribute>hi"), MYXML.toString() PASSED! +Prepend XMLList PASSED! +Prepend a string to child node PASSED! +Prepend a string to top node PASSED! +Prepend a node to child node PASSED! +a = , a.b.prependChild(a) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/test.swf new file mode 100644 index 000000000..c19108537 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v10/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/Test.as new file mode 100644 index 000000000..aca681feb --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/Test.as @@ -0,0 +1,310 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4.4.29 - XML prependChild()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("prependChild")); + +x1 = + + + one + +; + +correct = + + + bar + one + +; + +x1.bravo.prependChild(bar); + +TEST(2, correct, x1); + +emps = + + + John + + + Sue + + + +correct = + + + Mr. + John + + + Sue + + + +emps.employee.(name == "John").prependChild(Mr.); + +TEST(3, correct, emps); + +XML.prettyPrinting = false; +var xmlDoc = ""; +var child1 = new XML("John"); +var child2 = new XML("Sue"); +var child3 = new XML("Bob"); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.prependChild(child1), MYXML.toString()", + "John", + (MYXML = new XML(xmlDoc), MYXML.prependChild(child1), MYXML.toString())); + +var MYXML = new XML(xmlDoc); +MYXML.prependChild(child2); + +Assert.expectEq( "MYXML.prependChild(child1), MYXML.toString()", + "JohnSue", + (MYXML.prependChild(child1), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); + +Assert.expectEq ("Making sure child added is a duplicate", true, (child2 === MYXML.children()[0])); +Assert.expectEq ("Making sure child added is a true copy", true, (child2 == MYXML.children()[0])); + +Assert.expectEq( "MYXML.prependChild(child1), MYXML.toString()", + "JohnSueBob", + (MYXML.prependChild(child1), MYXML.toString())); + +Assert.expectEq( "MYXML.prependChild('simple text string'), MYXML.toString()", + "simple text stringJohnSueBob", + (MYXML.prependChild("simple text string"), MYXML.toString())); + +// !!@ test cases for adding comment nodes, PI nodes + +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); +MYXML.prependChild(child1); + +var expectedResult; +expectedResult = 'JohnSueBob'; + +Assert.expectEq( "MYXML.prependChild(''), MYXML.toString()", + expectedResult, + (MYXML.prependChild(""), MYXML.toString())); + +XML.ignoreComments = false; +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); +MYXML.prependChild(child1); + +expectedResult = 'JohnSueBob'; + +Assert.expectEq( "MYXML.prependChild(''), MYXML.toString()", + expectedResult, + (MYXML.prependChild(""), MYXML.toString())); + +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); +MYXML.prependChild(child1); + +expectedResult = 'JohnSueBob'; + +Assert.expectEq( "MYXML.prependChild(''), MYXML.toString()", + expectedResult, + (MYXML.prependChild(""), MYXML.toString())); + +XML.ignoreProcessingInstructions = false; +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); +MYXML.prependChild(child1); + +var expected = "TypeError: error: XML declaration may only begin entities."; +var result = "error, exception not thrown"; + +expectedResult = 'JohnSueBob'; + +Assert.expectEq( "MYXML.prependChild(''), MYXML.toString()", + expectedResult, + (MYXML.prependChild(""), MYXML.toString())); + +try{ + +MYXML.prependChild(""); + +} catch( e1 ){ + +result = e1.toString(); + +} +//Taking test out because bug 108406 has been deferred. +//Assert.expectEq("OPEN BUG: 108406 - MYXML.prependChild(\"\")", expected, result); + +// !!@ setting a property that starts with an "@" that implies an attribute name?? +// Rhino throws an error + +MYXML = new XML(xmlDoc); +MYXML.prependChild(child3); +MYXML.prependChild(child2); +MYXML.prependChild(child1); + +expectedResult = '<@notanattribute>hiJohnSueBob'; + +Assert.expectEq( "MYXML.prependChild(\"<@notanattribute>hi\"), MYXML.toString()", + expectedResult, + (MYXML.prependChild("<@notanattribute>hi"), MYXML.toString())); + +MYXML = new XML(''); +x1 = new XMLList('GiantsRobots'); +MYXML.prependChild(x1); + +Assert.expectEq( "Prepend XMLList", + 'GiantsRobots', + (MYXML.toString()) ); + +MYXML = new XML(''); +x1 = "poltergeist"; +MYXML.MOVIE.prependChild(x1); + +Assert.expectEq( "Prepend a string to child node", + 'poltergeist', + (MYXML.toString()) ); + +// I believe the following two test cases are wrong. See bug 145184. + +MYXML = new XML(''); +x1 = "poltergeist"; +MYXML.prependChild(x1); + +Assert.expectEq( "Prepend a string to top node", + 'poltergeist', + (MYXML.toString()) ); + +MYXML = new XML(''); +x1 = new XML("poltergeist"); +MYXML.prependChild(x1); + +Assert.expectEq( "Prepend a node to child node", + 'poltergeist', + (MYXML.toString()) ); + +var a = ; + +try { + a.b.prependChild (a); + result = a; +} catch (e1) { + result = Utils.typeError(e1.toString()); +} + +Assert.expectEq("a = , a.b.prependChild(a)", "TypeError: Error #1118", result); + + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/config.xml new file mode 100644 index 000000000..691a43965 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/config.xml @@ -0,0 +1,14 @@ + + + + . + ../../../../lib + + false + false + false + false + + 9 + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/output.txt new file mode 100644 index 000000000..48d4c4825 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/output.txt @@ -0,0 +1,18 @@ +2 PASSED! +3 PASSED! +MYXML = new XML(xmlDoc), MYXML.prependChild(child1), MYXML.toString() PASSED! +MYXML.prependChild(child1), MYXML.toString() PASSED! +Making sure child added is a duplicate PASSED! +Making sure child added is a true copy PASSED! +MYXML.prependChild(child1), MYXML.toString() PASSED! +MYXML.prependChild('simple text string'), MYXML.toString() PASSED! +MYXML.prependChild(''), MYXML.toString() PASSED! +MYXML.prependChild(''), MYXML.toString() PASSED! +MYXML.prependChild(''), MYXML.toString() PASSED! +MYXML.prependChild(''), MYXML.toString() PASSED! +MYXML.prependChild("<@notanattribute>hi"), MYXML.toString() PASSED! +Prepend XMLList PASSED! +Prepend a string to child node PASSED! +Prepend a string to top node PASSED! +Prepend a node to child node PASSED! +a = , a.b.prependChild(a) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/test.swf new file mode 100644 index 000000000..83905b87a Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_29/v9/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/Test.as new file mode 100644 index 000000000..5220fae29 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/Test.as @@ -0,0 +1,253 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4.4.3 - XML appendChild()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("appendChild")); + +// Add new employee to list +emps = + + Jim25 + Joe20 + ; + +correct = + + Jim25 + Joe20 + Sue30 + ; + +newEmp = Sue30; + +emps.appendChild(newEmp); +TEST(2, correct, emps); + +// Add a new child element to the end of Jim's employee element +emps = + + Jim25 + Joe20 + ; + +correct = + + Jim25snorkeling + Joe20 + ; + +emps.employee.(name == "Jim").appendChild(snorkeling); +TEST(3, correct, emps); + +XML.prettyPrinting = false; +var xmlDoc = "GiantsPadres"; + +var expectedResult; +expectedResult = 'GiantsPadres<TEAM>Red Sox</TEAM>'; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.appendChild('Red Sox'), MYXML.toXMLString()", + expectedResult, + (MYXML = new XML(xmlDoc), MYXML.appendChild('Red Sox'), MYXML.toXMLString()) ); + +expectedResult = 'Giants<City>San Francisco</City>Padres'; +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.TEAM[0].appendChild ('San Francisco')), MYXML.toXMLString()", + expectedResult, + (MYXML = new XML(xmlDoc), MYXML.TEAM[0].appendChild ('San Francisco'), MYXML.toXMLString()) ); + + +// Weird behavior of new XML(null) vs XML() + +var child = new XML("Giants"); +var xml = new XML("foo"); + +Assert.expectEq( "MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind()", + "text", + (MYXML = new XML(null), MYXML.appendChild(new XML("Giants")), MYXML.nodeKind()) ); + +Assert.expectEq( "MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.toString()", + "", + (MYXML = new XML(null), MYXML.appendChild(new XML("Giants")), MYXML.toString()) ); + +// This has weird behavior of seemingly replacing the XML() node with the appended child. It somehow +// converts the "text" (really "empty") node into a element node +// 03/07/05 [vfleisch] NOT ANYMORE. Updated test case to assert for text, instead of element. +Assert.expectEq( "MYXML = new XML(), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind()", + "text", + (MYXML = new XML(), MYXML.appendChild(new XML("Giants")), MYXML.nodeKind()) ); + +MYXML = new XML(); +MYXML.appendChild(new XML("Giants")); + +var MYXML = new XML(''); +var x1 = new XML('Giants'); +MYXML.appendChild(x1); + +Assert.expectEq( "duplicate child node - MYXML.appendChild(new XML('Giants')), MYXML.toString()", + "GiantsGiants", + (MYXML.appendChild(x1), MYXML.toString()) ); + +MYXML = new XML(''); +x1 = new XML('Giants'); +MYXML.appendChild(x1); + +Assert.expectEq( "true duplicate child node - MYXML.appendChild(MYXML.child(0)[0]), MYXML.toString()", + "GiantsGiants", + (MYXML.appendChild(MYXML.child(0)[0]), MYXML.toString()) ); + +expectedResult = 'a'; + +MYXML = new XML(''); +Assert.expectEq( "MYXML = new XML(''); MYXML.appendChild(\"a\"), MYXML.toString()", + expectedResult, + (MYXML.appendChild("a"), MYXML.toString())); + +MYXML = new XML(''); +x1 = new XMLList('GiantsRobots'); +MYXML.appendChild(x1); + +Assert.expectEq( "Append XMLList", + 'GiantsRobots', + (MYXML.toString()) ); + +MYXML = new XML(''); +x1 = "poltergeist"; +MYXML.MOVIE.appendChild(x1); + +Assert.expectEq( "Append a string to child node", + 'poltergeist', + (MYXML.toString()) ); + + +MYXML = new XML(''); +x1 = "poltergeist"; +MYXML.appendChild(x1); + +expectedResult = 'poltergeist'; + +Assert.expectEq( "Append a string to top node", + expectedResult, + (MYXML.toString()) ); + +MYXML = new XML(''); +x1 = new XML("poltergeist"); +MYXML.appendChild(x1); + +Assert.expectEq( "Append a node to child node", + 'poltergeist', + (MYXML.toString()) ); + +var a = ; + +try { + a.appendChild (a); + result = a; +} catch (e1) { + result = Utils.typeError(e1.toString()); +} + +Assert.expectEq("a = , a.appendChild(a)", "TypeError: Error #1118", result); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/config.xml new file mode 100644 index 000000000..8ab0a16ac --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/config.xml @@ -0,0 +1,14 @@ + + + + . + ../../../../lib + + false + false + false + false + + 10 + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/output.txt new file mode 100644 index 000000000..ec92e88fd --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/output.txt @@ -0,0 +1,15 @@ +2 PASSED! +3 PASSED! +MYXML = new XML(xmlDoc), MYXML.appendChild('Red Sox'), MYXML.toXMLString() PASSED! +MYXML = new XML(xmlDoc), MYXML.TEAM[0].appendChild ('San Francisco')), MYXML.toXMLString() PASSED! +MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind() PASSED! +MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.toString() PASSED! +MYXML = new XML(), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind() PASSED! +duplicate child node - MYXML.appendChild(new XML('Giants')), MYXML.toString() PASSED! +true duplicate child node - MYXML.appendChild(MYXML.child(0)[0]), MYXML.toString() PASSED! +MYXML = new XML(''); MYXML.appendChild("a"), MYXML.toString() PASSED! +Append XMLList PASSED! +Append a string to child node PASSED! +Append a string to top node PASSED! +Append a node to child node PASSED! +a = , a.appendChild(a) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/test.swf new file mode 100644 index 000000000..2c3da0487 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v10/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/Test.as new file mode 100644 index 000000000..b973cb603 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/Test.as @@ -0,0 +1,253 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4.4.3 - XML appendChild()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("appendChild")); + +// Add new employee to list +emps = + + Jim25 + Joe20 + ; + +correct = + + Jim25 + Joe20 + Sue30 + ; + +newEmp = Sue30; + +emps.appendChild(newEmp); +TEST(2, correct, emps); + +// Add a new child element to the end of Jim's employee element +emps = + + Jim25 + Joe20 + ; + +correct = + + Jim25snorkeling + Joe20 + ; + +emps.employee.(name == "Jim").appendChild(snorkeling); +TEST(3, correct, emps); + +XML.prettyPrinting = false; +var xmlDoc = "GiantsPadres"; + +var expectedResult; +expectedResult = 'GiantsPadres<TEAM>Red Sox</TEAM>'; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.appendChild('Red Sox'), MYXML.toXMLString()", + expectedResult, + (MYXML = new XML(xmlDoc), MYXML.appendChild('Red Sox'), MYXML.toXMLString()) ); + +expectedResult = 'Giants<City>San Francisco</City>Padres'; +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.TEAM[0].appendChild ('San Francisco')), MYXML.toXMLString()", + expectedResult, + (MYXML = new XML(xmlDoc), MYXML.TEAM[0].appendChild ('San Francisco'), MYXML.toXMLString()) ); + + +// Weird behavior of new XML(null) vs XML() + +var child = new XML("Giants"); +var xml = new XML("foo"); + +Assert.expectEq( "MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind()", + "text", + (MYXML = new XML(null), MYXML.appendChild(new XML("Giants")), MYXML.nodeKind()) ); + +Assert.expectEq( "MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.toString()", + "", + (MYXML = new XML(null), MYXML.appendChild(new XML("Giants")), MYXML.toString()) ); + +// This has weird behavior of seemingly replacing the XML() node with the appended child. It somehow +// converts the "text" (really "empty") node into a element node +// 03/07/05 [vfleisch] NOT ANYMORE. Updated test case to assert for text, instead of element. +Assert.expectEq( "MYXML = new XML(), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind()", + "text", + (MYXML = new XML(), MYXML.appendChild(new XML("Giants")), MYXML.nodeKind()) ); + +MYXML = new XML(); +MYXML.appendChild(new XML("Giants")); + +var MYXML = new XML(''); +var x1 = new XML('Giants'); +MYXML.appendChild(x1); + +Assert.expectEq( "move child node - MYXML.appendChild(new XML('Giants')), MYXML.toString()", + "Giants", + (MYXML.appendChild(x1), MYXML.toString()) ); + +MYXML = new XML(''); +x1 = new XML('Giants'); +MYXML.appendChild(x1); + +Assert.expectEq( "true move child node - MYXML.appendChild(MYXML.child(0)[0]), MYXML.toString()", + "Giants", + (MYXML.appendChild(MYXML.child(0)[0]), MYXML.toString()) ); + +expectedResult = 'a'; + +MYXML = new XML(''); +Assert.expectEq( "MYXML = new XML(''); MYXML.appendChild(\"a\"), MYXML.toString()", + expectedResult, + (MYXML.appendChild("a"), MYXML.toString())); + +MYXML = new XML(''); +x1 = new XMLList('GiantsRobots'); +MYXML.appendChild(x1); + +Assert.expectEq( "Append XMLList", + 'GiantsRobots', + (MYXML.toString()) ); + +MYXML = new XML(''); +x1 = "poltergeist"; +MYXML.MOVIE.appendChild(x1); + +Assert.expectEq( "Append a string to child node", + 'poltergeist', + (MYXML.toString()) ); + + +MYXML = new XML(''); +x1 = "poltergeist"; +MYXML.appendChild(x1); + +expectedResult = 'poltergeist'; + +Assert.expectEq( "Append a string to top node", + expectedResult, + (MYXML.toString()) ); + +MYXML = new XML(''); +x1 = new XML("poltergeist"); +MYXML.appendChild(x1); + +Assert.expectEq( "Append a node to child node", + 'poltergeist', + (MYXML.toString()) ); + +var a = ; + +try { + a.appendChild (a); + result = a; +} catch (e1) { + result = Utils.typeError(e1.toString()); +} + +Assert.expectEq("a = , a.appendChild(a)", "TypeError: Error #1118", result); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/config.xml new file mode 100644 index 000000000..73dd3470b --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/config.xml @@ -0,0 +1,14 @@ + + + + . + ../../../../lib + + false + false + false + false + + 21 + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/output.txt new file mode 100644 index 000000000..215920c6e --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/output.txt @@ -0,0 +1,15 @@ +2 PASSED! +3 PASSED! +MYXML = new XML(xmlDoc), MYXML.appendChild('Red Sox'), MYXML.toXMLString() PASSED! +MYXML = new XML(xmlDoc), MYXML.TEAM[0].appendChild ('San Francisco')), MYXML.toXMLString() PASSED! +MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind() PASSED! +MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.toString() PASSED! +MYXML = new XML(), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind() PASSED! +move child node - MYXML.appendChild(new XML('Giants')), MYXML.toString() PASSED! +true move child node - MYXML.appendChild(MYXML.child(0)[0]), MYXML.toString() PASSED! +MYXML = new XML(''); MYXML.appendChild("a"), MYXML.toString() PASSED! +Append XMLList PASSED! +Append a string to child node PASSED! +Append a string to top node PASSED! +Append a node to child node PASSED! +a = , a.appendChild(a) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/test.swf new file mode 100644 index 000000000..c312cdf79 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v21/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/Test.as new file mode 100644 index 000000000..241cb1809 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/Test.as @@ -0,0 +1,253 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4.4.3 - XML appendChild()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("appendChild")); + +// Add new employee to list +emps = + + Jim25 + Joe20 + ; + +correct = + + Jim25 + Joe20 + Sue30 + ; + +newEmp = Sue30; + +emps.appendChild(newEmp); +TEST(2, correct, emps); + +// Add a new child element to the end of Jim's employee element +emps = + + Jim25 + Joe20 + ; + +correct = + + Jim25snorkeling + Joe20 + ; + +emps.employee.(name == "Jim").appendChild(snorkeling); +TEST(3, correct, emps); + +XML.prettyPrinting = false; +var xmlDoc = "GiantsPadres"; + +var expectedResult; +expectedResult = 'GiantsPadresRed Sox'; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.appendChild('Red Sox'), MYXML.toXMLString()", + expectedResult, + (MYXML = new XML(xmlDoc), MYXML.appendChild('Red Sox'), MYXML.toXMLString()) ); + +expectedResult = 'GiantsSan FranciscoPadres'; +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.TEAM[0].appendChild ('San Francisco')), MYXML.toXMLString()", + expectedResult, + (MYXML = new XML(xmlDoc), MYXML.TEAM[0].appendChild ('San Francisco'), MYXML.toXMLString()) ); + + +// Weird behavior of new XML(null) vs XML() + +var child = new XML("Giants"); +var xml = new XML("foo"); + +Assert.expectEq( "MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind()", + "text", + (MYXML = new XML(null), MYXML.appendChild(new XML("Giants")), MYXML.nodeKind()) ); + +Assert.expectEq( "MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.toString()", + "", + (MYXML = new XML(null), MYXML.appendChild(new XML("Giants")), MYXML.toString()) ); + +// This has weird behavior of seemingly replacing the XML() node with the appended child. It somehow +// converts the "text" (really "empty") node into a element node +// 03/07/05 [vfleisch] NOT ANYMORE. Updated test case to assert for text, instead of element. +Assert.expectEq( "MYXML = new XML(), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind()", + "text", + (MYXML = new XML(), MYXML.appendChild(new XML("Giants")), MYXML.nodeKind()) ); + +MYXML = new XML(); +MYXML.appendChild(new XML("Giants")); + +var MYXML = new XML(''); +var x1 = new XML('Giants'); +MYXML.appendChild(x1); + +Assert.expectEq( "duplicate child node - MYXML.appendChild(new XML('Giants')), MYXML.toString()", + "GiantsGiants", + (MYXML.appendChild(x1), MYXML.toString()) ); + +MYXML = new XML(''); +x1 = new XML('Giants'); +MYXML.appendChild(x1); + +Assert.expectEq( "true duplicate child node - MYXML.appendChild(MYXML.child(0)[0]), MYXML.toString()", + "GiantsGiants", + (MYXML.appendChild(MYXML.child(0)[0]), MYXML.toString()) ); + +expectedResult = 'a'; + +MYXML = new XML(''); +Assert.expectEq( "MYXML = new XML(''); MYXML.appendChild(\"a\"), MYXML.toString()", + expectedResult, + (MYXML.appendChild("a"), MYXML.toString())); + +MYXML = new XML(''); +x1 = new XMLList('GiantsRobots'); +MYXML.appendChild(x1); + +Assert.expectEq( "Append XMLList", + 'GiantsRobots', + (MYXML.toString()) ); + +MYXML = new XML(''); +x1 = "poltergeist"; +MYXML.MOVIE.appendChild(x1); + +Assert.expectEq( "Append a string to child node", + 'poltergeist', + (MYXML.toString()) ); + + +MYXML = new XML(''); +x1 = "poltergeist"; +MYXML.appendChild(x1); + +expectedResult = 'poltergeist'; + +Assert.expectEq( "Append a string to top node", + expectedResult, + (MYXML.toString()) ); + +MYXML = new XML(''); +x1 = new XML("poltergeist"); +MYXML.appendChild(x1); + +Assert.expectEq( "Append a node to child node", + 'poltergeist', + (MYXML.toString()) ); + +var a = ; + +try { + a.appendChild (a); + result = a; +} catch (e1) { + result = Utils.typeError(e1.toString()); +} + +Assert.expectEq("a = , a.appendChild(a)", "TypeError: Error #1118", result); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/config.xml new file mode 100644 index 000000000..691a43965 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/config.xml @@ -0,0 +1,14 @@ + + + + . + ../../../../lib + + false + false + false + false + + 9 + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/output.txt new file mode 100644 index 000000000..ec92e88fd --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/output.txt @@ -0,0 +1,15 @@ +2 PASSED! +3 PASSED! +MYXML = new XML(xmlDoc), MYXML.appendChild('Red Sox'), MYXML.toXMLString() PASSED! +MYXML = new XML(xmlDoc), MYXML.TEAM[0].appendChild ('San Francisco')), MYXML.toXMLString() PASSED! +MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind() PASSED! +MYXML = new XML(null), MYXML.appendChild(new XML('Giants')), MYXML.toString() PASSED! +MYXML = new XML(), MYXML.appendChild(new XML('Giants')), MYXML.nodeKind() PASSED! +duplicate child node - MYXML.appendChild(new XML('Giants')), MYXML.toString() PASSED! +true duplicate child node - MYXML.appendChild(MYXML.child(0)[0]), MYXML.toString() PASSED! +MYXML = new XML(''); MYXML.appendChild("a"), MYXML.toString() PASSED! +Append XMLList PASSED! +Append a string to child node PASSED! +Append a string to top node PASSED! +Append a node to child node PASSED! +a = , a.appendChild(a) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/test.swf new file mode 100644 index 000000000..e0045065a Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_3/v9/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/Test.as new file mode 100644 index 000000000..3acf110f3 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/Test.as @@ -0,0 +1,131 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.30 - propertyIsEnumerable()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("propertyIsEnumerable")); + +// All properties accessible by Get are enumerable +x1 = + + one +; + +TEST(2, true, x1.propertyIsEnumerable("0")); +TEST(3, true, x1.propertyIsEnumerable(0)); +TEST(5, false, x1.propertyIsEnumerable("bravo")); +TEST(6, false, x1.propertyIsEnumerable()); +TEST(7, false, x1.propertyIsEnumerable(undefined)); +TEST(8, false, x1.propertyIsEnumerable(null)); + +var xmlDoc = "JohnWalton25SueDay32" + +// propertyName as a string +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable(0)", true, + (MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable('0'))); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable(1)", false, + (MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable('1'))); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable(2)", false, + (MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable('2'))); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable('employee')", false, + (MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable('employee'))); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/output.txt new file mode 100644 index 000000000..cf3fd8d07 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/output.txt @@ -0,0 +1,10 @@ +2 PASSED! +3 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +8 PASSED! +MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable(0) PASSED! +MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable(1) PASSED! +MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable(2) PASSED! +MYXML = new XML(xmlDoc), MYXML.propertyIsEnumerable('employee') PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/test.swf new file mode 100644 index 000000000..14f912061 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_30/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/Test.as new file mode 100644 index 000000000..e141a063e --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/Test.as @@ -0,0 +1,180 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.31 - XML removeNamespace()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("removeNamespace")); + +x1 = + + one +; + +correct = + + one +; + +// TEST(1.5, correct, x1); +TEST(1.6, false, (correct.toString() == x1.toString())); + +x1.removeNamespace("http://foo/"); + +TEST(2, correct.toString(), x1.toString()); + +TEST(2.5, correct, x1); + +// Shouldn't remove namespace if referenced +x1 = + + one +; + +correct = + + one +; + +x1.removeNamespace("http://foo/"); + +// TEST(3, correct, x1); + + +var xmlDoc = "hi"; +var ns1 = Namespace ("xsl", "http://www.w3.org/TR/xsl"); +var ns2 = Namespace ("foo", "http://www.foo.org"); + + +// Namespace that is referenced by QName should not be removed +Assert.expectEq( "MYXML.removeNamespace(QName reference)", "http://www.w3.org/TR/xsl", + ( MYXML = new XML(xmlDoc), MYXML.removeNamespace('xsl'), myGetNamespace(MYXML, 'xsl').toString())); + + +// Other namespaces should be removed +Assert.expectEq( "MYXML.removeNamespace(no Qname reference)", undefined, + ( MYXML = new XML(xmlDoc), MYXML.b.c.removeNamespace('foo'), myGetNamespace(MYXML, 'foo')) ); + +var n1 = new Namespace('pfx', 'http://w3.org'); +var n2 = new Namespace('http://us.gov'); +var n3 = new Namespace('boo', 'http://us.gov'); +var n4 = new Namespace('boo', 'http://hk.com'); +var xml = "55bird5dinosaur"; + +Assert.expectEq("Two namespaces in one node", true, + ( x1 = new XML(xml), x1.addNamespace(n1), x1.addNamespace(n3), x1.removeNamespace(n3), + x1.removeNamespace(n1), (myGetNamespace(x1, 'pfx') == myGetNamespace(x1, 'boo'))) ); + +Assert.expectEq("Two namespaces in one node", 1, + ( x1 = new XML(xml), x1.addNamespace(n1), x1.addNamespace(n3), x1.removeNamespace(n3), + x1.removeNamespace(n1), x1.inScopeNamespaces().length) ); + +Assert.expectEq("Two namespace in two different nodes", undefined, + ( x1 = new XML(xml), x1.addNamespace(n3), x1.b[0].c.addNamespace(n1), + x1.removeNamespace(n1), myGetNamespace(x1.b[0].c, 'pfx'))); + +var xml1 = 55bird5dinosaur; +var xml2 = 55bird5dinosaur; + +Assert.expectEq("Remove namespace without prefix: " + xml2, + xml1.removeNamespace(n2), xml1); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/output.txt new file mode 100644 index 000000000..540e286af --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/output.txt @@ -0,0 +1,18 @@ +1.6 PASSED! +2 PASSED! +2.5 PASSED! +MYXML.removeNamespace(QName reference) PASSED! +MYXML.removeNamespace(no Qname reference) PASSED! +Two namespaces in one node PASSED! +Two namespaces in one node PASSED! +Two namespace in two different nodes PASSED! +Remove namespace without prefix: + + 55 + bird + + + 5 + dinosaur + + PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/test.swf new file mode 100644 index 000000000..2adbe2fc3 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_31/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/Test.as new file mode 100644 index 000000000..a9e4777a4 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/Test.as @@ -0,0 +1,193 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package { +public class Test {} +} + +import avmplus.System +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.32 - XML replace()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("replace")); + +// Replace the first employee record with an open staff requisition +emps = + + Jim25 + Joe20 +; + +correct = + + + Joe20 +; + +emps.replace(0, ); + +TEST(2, correct, emps); + +// Replace all children with open staff requisition + +emps = + + Jim25 + Joe20 +; + +correct = + + +; + +emps.replace("*", ); + +TEST(3, correct, emps); + +// Replace all employee elements with open staff requisition + +emps = + + Jim25 + Joe20 +; + +correct = + + +; + +emps.replace("employee", ); + +TEST(4, correct, emps); + +XML.prettyPrinting = false; +var xmlDoc = "JohnWalton25" + +// propertyName as a string +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.replace(0,'Mr. John')", + "Mr. JohnWalton25", + (MYXML = new XML(xmlDoc), MYXML.replace(0,'Mr. John').toString())); + +xmlDoc = "JohnWalton25" + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.replace('phone','542144')", + "JohnWalton25", + (MYXML = new XML(xmlDoc), MYXML.replace('phone','542144').toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.replace('firstname','Johnny')", + "JohnnyWalton25", + (MYXML = new XML(xmlDoc), MYXML.replace('firstname','Johnny').toString())); + +var expectedResult; +expectedResult = '1234567'; + +// This should replace all the children +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.replace('*','1234567')", + expectedResult, + (MYXML = new XML(xmlDoc), MYXML.replace('*',"1234567").toString())); + +// What about using an attribute name as a input parameter +// !!@ Rhino does an attribute addition after id!?!? +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.replace('@phone','7654321')", + "JohnWalton25", + (MYXML = new XML(xmlDoc), MYXML.replace('@phone',"7654321").toString())); + + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/config.xml new file mode 100644 index 000000000..8ab0a16ac --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/config.xml @@ -0,0 +1,14 @@ + + + + . + ../../../../lib + + false + false + false + false + + 10 + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/output.txt new file mode 100644 index 000000000..592021c59 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/output.txt @@ -0,0 +1,8 @@ +2 PASSED! +3 PASSED! +4 PASSED! +MYXML = new XML(xmlDoc), MYXML.replace(0,'Mr. John') PASSED! +MYXML = new XML(xmlDoc), MYXML.replace('phone','542144') PASSED! +MYXML = new XML(xmlDoc), MYXML.replace('firstname','Johnny') PASSED! +MYXML = new XML(xmlDoc), MYXML.replace('*','1234567') PASSED! +MYXML = new XML(xmlDoc), MYXML.replace('@phone','7654321') PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/test.swf new file mode 100644 index 000000000..5e804fee8 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v10/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/Test.as new file mode 100644 index 000000000..8d7bf28c1 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/Test.as @@ -0,0 +1,193 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package { +public class Test {} +} + +import avmplus.System +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.32 - XML replace()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("replace")); + +// Replace the first employee record with an open staff requisition +emps = + + Jim25 + Joe20 +; + +correct = + + + Joe20 +; + +emps.replace(0, ); + +TEST(2, correct, emps); + +// Replace all children with open staff requisition + +emps = + + Jim25 + Joe20 +; + +correct = + + +; + +emps.replace("*", ); + +TEST(3, correct, emps); + +// Replace all employee elements with open staff requisition + +emps = + + Jim25 + Joe20 +; + +correct = + + +; + +emps.replace("employee", ); + +TEST(4, correct, emps); + +XML.prettyPrinting = false; +var xmlDoc = "JohnWalton25" + +// propertyName as a string +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.replace(0,'Mr. John')", + "Mr. JohnWalton25", + (MYXML = new XML(xmlDoc), MYXML.replace(0,'Mr. John').toString())); + +xmlDoc = "JohnWalton25" + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.replace('phone','542144')", + "JohnWalton25", + (MYXML = new XML(xmlDoc), MYXML.replace('phone','542144').toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.replace('firstname','Johnny')", + "JohnnyWalton25", + (MYXML = new XML(xmlDoc), MYXML.replace('firstname','Johnny').toString())); + +var expectedResult; +expectedResult = '1234567'; + +// This should replace all the children +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.replace('*','1234567')", + expectedResult, + (MYXML = new XML(xmlDoc), MYXML.replace('*',"1234567").toString())); + +// What about using an attribute name as a input parameter +// !!@ Rhino does an attribute addition after id!?!? +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.replace('@phone','7654321')", + "JohnWalton25", + (MYXML = new XML(xmlDoc), MYXML.replace('@phone',"7654321").toString())); + + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/config.xml new file mode 100644 index 000000000..691a43965 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/config.xml @@ -0,0 +1,14 @@ + + + + . + ../../../../lib + + false + false + false + false + + 9 + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/output.txt new file mode 100644 index 000000000..592021c59 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/output.txt @@ -0,0 +1,8 @@ +2 PASSED! +3 PASSED! +4 PASSED! +MYXML = new XML(xmlDoc), MYXML.replace(0,'Mr. John') PASSED! +MYXML = new XML(xmlDoc), MYXML.replace('phone','542144') PASSED! +MYXML = new XML(xmlDoc), MYXML.replace('firstname','Johnny') PASSED! +MYXML = new XML(xmlDoc), MYXML.replace('*','1234567') PASSED! +MYXML = new XML(xmlDoc), MYXML.replace('@phone','7654321') PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/test.swf new file mode 100644 index 000000000..cecd0034e Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_32/v9/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/Test.as new file mode 100644 index 000000000..9c735c897 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/Test.as @@ -0,0 +1,155 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.33 - XML setChildren()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("setChildren")); + +x1 = + + one +; + +correct = + + two +; + +x1.setChildren(two); + +TEST(2, correct, x1); + +// Replace the entire contents of Jim's employee element +emps = + + Jim25 + Joe20 +; + +correct = + + John35 + Joe20 +; + +emps.employee.(name == "Jim").setChildren(John + 35); + +TEST(3, correct, emps); + +XML.prettyPrinting = false; +var xmlDoc = "JohnWalton25" +var xmlList = new XMLList ("PaulBetlem35"); + +// propertyName as a string +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setChildren(xmlList)", + "PaulBetlem35", + (MYXML = new XML(xmlDoc), MYXML.setChildren(xmlList).toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setChildren(new XML (\"Fred\"))", + "Fred", + (MYXML = new XML(xmlDoc), MYXML.setChildren(new XML ("Fred")).toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setChildren('simple string')", + "simple string", + (MYXML = new XML(xmlDoc), MYXML.setChildren("simple string").toString())); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/output.txt new file mode 100644 index 000000000..5ecae618b --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/output.txt @@ -0,0 +1,5 @@ +2 PASSED! +3 PASSED! +MYXML = new XML(xmlDoc), MYXML.setChildren(xmlList) PASSED! +MYXML = new XML(xmlDoc), MYXML.setChildren(new XML ("Fred")) PASSED! +MYXML = new XML(xmlDoc), MYXML.setChildren('simple string') PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/test.swf new file mode 100644 index 000000000..b523bd07f Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_33/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/Test.as new file mode 100644 index 000000000..b72e6ebc0 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/Test.as @@ -0,0 +1,204 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4.4.34 - XML setLocalName()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("setLocalName")); + +x1 = + + one +; + +correct = + + one +; + +x1.setLocalName("charlie"); + +TEST(2, correct, x1); + +x1 = + + one +; + +correct = + + one +; + +x1.setLocalName("charlie"); + +TEST(3, correct, x1); + +XML.prettyPrinting = false; +var xmlDoc = "JohnWalton25" + +// propertyName as a string +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setLocalName('newlocalname'),MYXML.localName()", + "newlocalname", + (MYXML = new XML(xmlDoc), MYXML.setLocalName('newlocalname'),MYXML.localName())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setLocalName('newlocalname'),MYXML.toString()", + "JohnWalton25", + (MYXML = new XML(xmlDoc), MYXML.setLocalName('newlocalname'),MYXML.toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setLocalName(new QName('newlocalname')),MYXML.toString()", + "JohnWalton25", + (MYXML = new XML(xmlDoc), MYXML.setLocalName(QName('newlocalname')),MYXML.toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setLocalName(new QName('foo', 'newlocalname')),MYXML.toString()", + "JohnWalton25", + (MYXML = new XML(xmlDoc), MYXML.setLocalName(QName('foo', 'newlocalname')),MYXML.toString())); + +MYXML = new XML(xmlDoc); + +try { + MYXML.setLocalName('@newlocalname'); + result = "no error"; +} catch (e1) { + result = Utils.typeError(e1.toString()); +} + +Assert.expectEq( "setLocalName('@newlocalname')", "TypeError: Error #1117", result); + + +try { + MYXML.setLocalName('*'); + result = "no error"; +} catch (e2) { + result = Utils.typeError(e2.toString()); +} + +Assert.expectEq( "setLocalName('*')", "TypeError: Error #1117", result); + +try { + MYXML.setLocalName('x123=5'); + result = "no error"; +} catch (e3) { + result = Utils.typeError(e3.toString()); +} + +Assert.expectEq( "setLocalName('x123=5')", "TypeError: Error #1117", result); + +try { + MYXML.setLocalName('123'); + result = "no error"; +} catch (e4) { + result = Utils.typeError(e4.toString()); +} + +Assert.expectEq( "setLocalName('123')", "TypeError: Error #1117", result); + +try { + MYXML.setLocalName('!bam'); + result = "no error"; +} catch (e5) { + result = Utils.typeError(e5.toString()); +} + +Assert.expectEq( "setLocalName('!bam')", "TypeError: Error #1117", result); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/output.txt new file mode 100644 index 000000000..5efc983c8 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/output.txt @@ -0,0 +1,11 @@ +2 PASSED! +3 PASSED! +MYXML = new XML(xmlDoc), MYXML.setLocalName('newlocalname'),MYXML.localName() PASSED! +MYXML = new XML(xmlDoc), MYXML.setLocalName('newlocalname'),MYXML.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.setLocalName(new QName('newlocalname')),MYXML.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.setLocalName(new QName('foo', 'newlocalname')),MYXML.toString() PASSED! +setLocalName('@newlocalname') PASSED! +setLocalName('*') PASSED! +setLocalName('x123=5') PASSED! +setLocalName('123') PASSED! +setLocalName('!bam') PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/test.swf new file mode 100644 index 000000000..58cfa884d Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_34/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/Test.as new file mode 100644 index 000000000..11b971f6f --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/Test.as @@ -0,0 +1,255 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +function typeError(){ + // nothing here +} + +START("13.4.4.35 - setName"); + +//TEST(1, true, XML.prototype.hasOwnProperty("setName")); + +x1 = + + one +; + +correct = + + one +; + +x1.setName("charlie"); + +TEST(2, correct, x1); + +x1 = + + one +; + +correct = + + one +; + +x1.setName("charlie"); + +TEST(3, correct, x1); + +x1 = + + one +; + +correct = + + one +; + +x1.setName(new QName("http://foobar/", "charlie")); + +TEST(4, correct, x1); + +XML.prettyPrinting = false; +var xmlDoc = "John California "; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setName('employees'),MYXML.name().toString()", + "employees", + (MYXML = new XML(xmlDoc),MYXML.setName('employees'), MYXML.name().toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setName(new QName('employees')),MYXML.name().toString()", + "employees", + (MYXML = new XML(xmlDoc),MYXML.setName(new QName('employees')), MYXML.name().toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setName(new QName('ns', 'employees')),MYXML.name().toString()", + "ns::employees", + (MYXML = new XML(xmlDoc),MYXML.setName(new QName('ns', 'employees')), MYXML.name().toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setName('employees'),MYXML.toString()", + "JohnCalifornia", + (MYXML = new XML(xmlDoc),MYXML.setName('employees'), MYXML.toString())); + +// Calling setName() on an attribute +Assert.expectEq("MYXML = new XML(xmlDoc), MYXML.employee.@id.setName('num')", "num", (MYXML = new XML(xmlDoc), MYXML.employee.@id.setName("num"), MYXML.employee.@num.name().toString())); + +var TYPEERROR = "TypeError: Error #"; +function typeError( str ){ + return str.slice(0,TYPEERROR.length+4); +} +MYXML = new XML(xmlDoc); +MYXML.employee.@id.setName("num"); + +try { + MYXML.employee.@id.name(); + result = "no error"; +} catch (e1) { + result = typeError(e1.toString()); +} + +Assert.expectEq("MYXML = new XML(xmlDoc), MYXML.employee.@id.setName(\"num\"),MYXML.employee.@id.name())", "TypeError: Error #1086", result); +x1 = + + one +; + +ns = new Namespace("foo", "http://foo/"); +correct = + one +; + +Assert.expectEq("Calling setName() on an attribute with same name as namespace", "|"+correct+"|", "|"+(x1.ns::bravo.@attr.setName("foo"), x1)+"|"); + +// throws Rhino exception - bad name +MYXML = new XML(xmlDoc); +try { + MYXML.setName('@employees'); + result = " no error"; +} catch (e2) { + result = typeError(e2.toString()); +} +Assert.expectEq("MYXML.setName('@employees')", "TypeError: Error #1117", result); + +try { + MYXML.setName('!hi'); + result = " no error"; +} catch (e3) { + result = typeError(e3.toString()); +} +Assert.expectEq("MYXML.setName('!hi')", "TypeError: Error #1117", result); + +try { + MYXML.setName('1+1=5'); + result = " no error"; +} catch (e4) { + result = typeError(e4.toString()); +} +Assert.expectEq("MYXML.setName('1+1=5')", "TypeError: Error #1117", result); + +try { + MYXML.setName('555'); + result = " no error"; +} catch (e5) { + result = typeError(e5.toString()); +} +Assert.expectEq("MYXML.setName('555')", "TypeError: Error #1117", result); + + +try { + MYXML.setName('1love'); + result = " no error"; +} catch (e6) { + result = typeError(e6.toString()); +} +Assert.expectEq("MYXML.setName('1love')", "TypeError: Error #1117", result); + +try { + MYXML.setName('*'); + result = " no error"; +} catch (e7) { + result = typeError(e7.toString()); +} +Assert.expectEq("MYXML.setName('*')", "TypeError: Error #1117", result); + + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/output.txt new file mode 100644 index 000000000..6b43e88e7 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/output.txt @@ -0,0 +1,16 @@ +2 PASSED! +3 PASSED! +4 PASSED! +MYXML = new XML(xmlDoc), MYXML.setName('employees'),MYXML.name().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.setName(new QName('employees')),MYXML.name().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.setName(new QName('ns', 'employees')),MYXML.name().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.setName('employees'),MYXML.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee.@id.setName('num') PASSED! +MYXML = new XML(xmlDoc), MYXML.employee.@id.setName("num"),MYXML.employee.@id.name()) PASSED! +Calling setName() on an attribute with same name as namespace PASSED! +MYXML.setName('@employees') PASSED! +MYXML.setName('!hi') PASSED! +MYXML.setName('1+1=5') PASSED! +MYXML.setName('555') PASSED! +MYXML.setName('1love') PASSED! +MYXML.setName('*') PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/test.swf new file mode 100644 index 000000000..0b0446e84 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_35/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/Test.as new file mode 100644 index 000000000..3e3517c06 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/Test.as @@ -0,0 +1,229 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.36 - setNamespace"); + +//TEST(1, true, XML.prototype.hasOwnProperty("setNamespace")); + +x1 = + + one +; + +correct = + + one +; + +x1.setNamespace("http://bar/"); + +TEST(2, correct, x1); + +XML.prettyPrinting = false; +var xmlDoc = "body" + +// !!@ Rhino comes with with the "ns" prefix for this namespace. I have no idea how that happens. +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setNamespace('http://xyx.org/xml'),MYXML.toString()", + "body", + (MYXML = new XML(xmlDoc), MYXML.setNamespace('http://xyx.org/xml'), MYXML.toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setNamespace('http://xyx.org/xml'),MYXML.getNamespace()", + "http://xyx.org/xml", + (MYXML = new XML(xmlDoc), MYXML.setNamespace('http://xyx.org/xml'), myGetNamespace(MYXML).toString())); + + +xmlDoc = "d"; +MYXML = new XML(xmlDoc); +MYXML.setNamespace('http://foo'); +MYXML.b.c.setNamespace('http://bar'); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.setNamespace('http://zxz.org/xml'),MYXML.toString()", + "d", + (MYXML.toString())); + +var n1 = new Namespace('zzz', 'http://www.zzz.com'); +var n2 = new Namespace('zzz', 'http://www.zzz.org'); +var n3 = new Namespace('abc', 'http://www.zzz.com'); +var n4 = new Namespace('def', 'http://www.zzz.com'); + +xmlDoc = "c"; + +Assert.expectEq("Adding two namespaces by uri", + "c", + (MYXML = new XML(xmlDoc), MYXML.setNamespace('http://www.zzz.com'), MYXML.b.setNamespace('http://www.zzz.org'), MYXML.toString())); + +Assert.expectEq("Adding two namespaces with prefix 'zzz'", + "c", + (MYXML = new XML(xmlDoc), MYXML.setNamespace(n1), MYXML.b.setNamespace(n2), MYXML.toString())); + +Assert.expectEq("Adding two namespaces with prefix 'zzz'", + "c", + (MYXML = new XML(xmlDoc), MYXML.setNamespace(n3), MYXML.b.setNamespace(n4), MYXML.toString())); + + +ns = new Namespace("moo", "http://moo/"); +ns2 = new Namespace("zoo", "http://zoo/"); +ns3 = new Namespace("noo", "http://mootar"); +ns4 = new Namespace("moo", "http://bar/"); +ns5 = new Namespace("poo", "http://moo/"); +x1 = + one +; + +correct = + one +; + +var MYXML = new XML(x1); +MYXML.ns::bravo.@attr.setNamespace(ns2); + +Assert.expectEq("Calling setNamespace() on an attribute", correct.toString(), MYXML.toString()); + +correct = + one +; + +Assert.expectEq("Calling setNamespace() on an attribute with conflicting namespace prefix", correct.toString(), (MYXML = new XML(x1), MYXML.ns::bravo.@attr.setNamespace("zoo"), MYXML.toString())); + +correct = + one +; + +Assert.expectEq("Calling setNamespace() on an attribute with conflicting namespace prefix", correct.toString(), (MYXML = new XML(x1), MYXML.ns::bravo.@attr.setNamespace("moo"), MYXML.toString())); + +correct = + one +; + +Assert.expectEq("Calling setNamespace() on an attribute with conflicting namespace prefix", correct.toString(), (MYXML = new XML(x1), MYXML.ns::bravo.@attr.setNamespace("http://zoo/"), MYXML.toString())); + +correct = + one +; +delete correct; + +Assert.expectEq("Calling setNamespace() on an attribute with conflicting namespace", correct.toString(), (MYXML = new XML(x1), MYXML.ns::bravo.@attr.setNamespace(ns3), MYXML.toString())); + +var correct = + one +; + +Assert.expectEq("Calling setNamespace() on an attribute with conflicting namespace prefix", correct.toString(), (MYXML = new XML(x1), MYXML.ns::bravo.@attr.setNamespace(ns4), MYXML.toString())); + +var correct = + one +; + +Assert.expectEq("Calling setNamespace() on an attribute with conflicting namespace", correct.toString(), (MYXML = new XML(x1), MYXML.ns::bravo.@attr.setNamespace(ns5), MYXML.toString())); + + +x1 = + one +; + +correct = + one +; + +Assert.expectEq("Calling setNamespace() on an attribute with no existing namespace", correct.toString(), (MYXML = new XML(x1), MYXML.bravo.@attr.setNamespace(ns), MYXML.toString())); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/output.txt new file mode 100644 index 000000000..ca29c7701 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/output.txt @@ -0,0 +1,15 @@ +2 PASSED! +MYXML = new XML(xmlDoc), MYXML.setNamespace('http://xyx.org/xml'),MYXML.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.setNamespace('http://xyx.org/xml'),MYXML.getNamespace() PASSED! +MYXML = new XML(xmlDoc), MYXML.setNamespace('http://zxz.org/xml'),MYXML.toString() PASSED! +Adding two namespaces by uri PASSED! +Adding two namespaces with prefix 'zzz' PASSED! +Adding two namespaces with prefix 'zzz' PASSED! +Calling setNamespace() on an attribute PASSED! +Calling setNamespace() on an attribute with conflicting namespace prefix PASSED! +Calling setNamespace() on an attribute with conflicting namespace prefix PASSED! +Calling setNamespace() on an attribute with conflicting namespace prefix PASSED! +Calling setNamespace() on an attribute with conflicting namespace PASSED! +Calling setNamespace() on an attribute with conflicting namespace prefix PASSED! +Calling setNamespace() on an attribute with conflicting namespace PASSED! +Calling setNamespace() on an attribute with no existing namespace PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/test.swf new file mode 100644 index 000000000..9beb5f672 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_36/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/Test.as new file mode 100644 index 000000000..9ddb10fba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/Test.as @@ -0,0 +1,154 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.37 - XML text()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("text")); + +x1 = + + one + + two + +; + +TEST_XML(2, "one", x1.bravo.text()); + +correct = new XMLList(); +correct += new XML("one"); +correct += new XML("two"); +TEST(3, correct, x1..bravo.text()); +TEST_XML(4, "", x1.charlie.text()); +TEST_XML(5, "", x1.foobar.text()); +TEST_XML(6, "one", x1.*.text()); + +XML.prettyPrinting = false; +var xmlDoc = "fooJohnbarWaltonstill25reading" + +// propertyName as a string +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.text().toString()", + "foobarstillreading", + (MYXML = new XML(xmlDoc), MYXML.text().toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.text() instanceof XMLList", + true, + (MYXML = new XML(xmlDoc), MYXML.text() instanceof XMLList)); + +Assert.expectEq( "MYXML = new XML(''), MYXML.text().toString()", + "", + (MYXML = new XML(''), MYXML.text().toString())); + +Assert.expectEq( "MYXML = new XML(''), MYXML.text() instanceof XMLList", + true, + (MYXML = new XML(''), MYXML.text() instanceof XMLList)); + +xmlDoc = b; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.text().toString()", + "b", + (MYXML = new XML(xmlDoc), MYXML.text().toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.text().toString()", + "b", + (MYXML = new XML(xmlDoc), MYXML.setName('c'), MYXML.text().toString())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/output.txt new file mode 100644 index 000000000..fd10f8ef2 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/output.txt @@ -0,0 +1,11 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +MYXML = new XML(xmlDoc), MYXML.text().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.text() instanceof XMLList PASSED! +MYXML = new XML(''), MYXML.text().toString() PASSED! +MYXML = new XML(''), MYXML.text() instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.text().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.text().toString() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/test.swf new file mode 100644 index 000000000..40f392a53 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_37/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/Test.as new file mode 100644 index 000000000..a4e89b100 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/Test.as @@ -0,0 +1,207 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.38 - XML toString()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("toString")); + +XML.prettyPrinting = false; + +x1 = + + one + + two + +; + +TEST(2, "one", x1.bravo.toString()); +TEST(3, "one" + NL() + "two", x1..bravo.toString()); + +x1 = + + one + +; + +TEST(4, "", x1.charlie.toString()); + +x1 = + + one + + two + +; + +TEST(5, "two", x1.charlie.toString()); + +x1 = + + one + + two + + +; + +TEST(5, "two", x1.charlie.toString()); + +x1 = + + + +; + +TEST(6, "" + NL() + "", x1.bravo.toString()); + +x1 = + + one + two +; + +TEST(7, "one" + NL() + "two", x1.bravo.toString()); + +var xmlDoc = "JohnWalton25SueDay32" + + +XML.prettyPrinting = false; +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[0].toString()", + "JohnWalton25", + (MYXML = new XML(xmlDoc), MYXML.employee[0].toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[1].toString()", + "SueDay32", + (MYXML = new XML(xmlDoc), MYXML.employee[1].toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toString()", + "John", + (MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toString()", + "Sue", + (MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toString())); + +XML.prettyPrinting = true; +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[0].toString()", + "" + NL() + " John" + NL() + " Walton" + NL() + " 25" + NL() + "", + (MYXML = new XML(xmlDoc), MYXML.employee[0].toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[1].toString()", + "" + NL() + " Sue" + NL() + " Day" + NL() + " 32" + NL() + "", + (MYXML = new XML(xmlDoc), MYXML.employee[1].toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toString()", + "John", + (MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toString()", + "Sue", + (MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toString())); + +xmlDoc = new XML("foo"); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.toString()", + "foo", + (MYXML = new XML(xmlDoc), MYXML.toString())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/output.txt new file mode 100644 index 000000000..d3a4c20f6 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/output.txt @@ -0,0 +1,16 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[0].toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[1].toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[0].toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[1].toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.toString() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/test.swf new file mode 100644 index 000000000..0178e217c Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_38/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/Test.as new file mode 100644 index 000000000..d1cf775ee --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/Test.as @@ -0,0 +1,236 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.39 - XML toXMLString"); + +//TEST(1, true, XML.prototype.hasOwnProperty("toXMLString")); + +XML.prettyPrinting = false; + +x1 = + + one + + two + +; + +TEST(2, "one", x1.bravo.toXMLString()); +TEST(3, "one" + NL() + "two", x1..bravo.toXMLString()); + +x1 = + + one + +; + +TEST(4, "", x1.charlie.toXMLString()); + +x1 = + + one + + two + +; + +TEST(5, "two", x1.charlie.toXMLString()); + +x1 = + + one + + two + + +; + +TEST(6, "two", x1.charlie.toXMLString()); + +x1 = + + + +; + +TEST(7, "" + NL() + "", x1.bravo.toXMLString()); + +x1 = + + one + two +; + +TEST(8, "one" + NL() + "two", x1.bravo.toXMLString()); + +XML.prettyPrinting = true; + +x1 = + + one + two +; + +copy = x1.bravo.copy(); + +TEST(9, "one", copy.toXMLString()); + +x1 = + + one + + two + +; + +TEST(10, "String contains value one from bravo", "String contains value " + x1.bravo + " from bravo"); + +var xmlDoc = "JohnWalton25SueDay32" + + +// propertyName as a string +XML.prettyPrinting = false; +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[0].toXMLString()", + "JohnWalton25", + (MYXML = new XML(xmlDoc), MYXML.employee[0].toXMLString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[1].toXMLString()", + "SueDay32", + (MYXML = new XML(xmlDoc), MYXML.employee[1].toXMLString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toXMLString()", + "John", + (MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toXMLString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toXMLString()", + "Sue", + (MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toXMLString())); + +// test case containing xml namespaces +var xmlDoc2 = "African Coffee Table80120"; +Assert.expectEq( "MYXML = new XML(xmlDoc2), MYXML.toXMLString()", + "African Coffee Table80120", + (MYXML = new XML(xmlDoc2), MYXML.toXMLString())); + + +XML.prettyPrinting = true; +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[0].toXMLString()", + "" + NL() + " John" + NL() + " Walton" + NL() + " 25" + NL() + "", + (MYXML = new XML(xmlDoc), MYXML.employee[0].toXMLString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[1].toXMLString()", + "" + NL() + " Sue" + NL() + " Day" + NL() + " 32" + NL() + "", + (MYXML = new XML(xmlDoc), MYXML.employee[1].toXMLString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toXMLString()", + "John", + (MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toXMLString())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toXMLString()", + "Sue", + (MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toXMLString())); + +xmlDoc = "foo"; +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.toXMLString()", + "foo", + (MYXML = new XML(xmlDoc), MYXML.toXMLString())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/output.txt new file mode 100644 index 000000000..c6022fd41 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/output.txt @@ -0,0 +1,19 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +6 PASSED! +7 PASSED! +8 PASSED! +9 PASSED! +10 PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[0].toXMLString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[1].toXMLString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toXMLString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toXMLString() PASSED! +MYXML = new XML(xmlDoc2), MYXML.toXMLString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[0].toXMLString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[1].toXMLString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[0].firstname.toXMLString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[1].firstname.toXMLString() PASSED! +MYXML = new XML(xmlDoc), MYXML.toXMLString() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/test.swf new file mode 100644 index 000000000..68438c76a Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_39/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/Test.as new file mode 100644 index 000000000..4b421cfc5 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/Test.as @@ -0,0 +1,175 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.4 - XML attribute()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("attribute")); + +// Get count of employees +emps = + + Jim25 + Joe20 +; + +TEST_XML(2, 2, emps.attribute("count")); + +// Get the id of the employee age 25 +emps = + + Jim25 + Joe20 +; + +TEST_XML(3, 0, emps.employee.(age == "25").attribute("id")); + +// Get the id of the employee named Jim +emps = + + Jim25 + Joe20 +; + +TEST_XML(4, 0, emps.employee.(name == "Jim").attribute("id")); + +var xmlDoc = "Giants"; + +// verify that attribute correct finds one attribute node +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('foo') instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.attribute('foo') instanceof XMLList )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('foo') instanceof XML", false, + (MYXML = new XML(xmlDoc), MYXML.attribute('foo') instanceof XML )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('foo').length()", 1, + (MYXML = new XML(xmlDoc), MYXML.attribute('foo').length() )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('foo').toString()", "bar", + (MYXML = new XML(xmlDoc), MYXML.attribute('foo').toString() )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('foo')[0].nodeKind()", "attribute", + (MYXML = new XML(xmlDoc), MYXML.attribute('foo')[0].nodeKind() )); + +// verify that attribute doesn't find non-existent names +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST') instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST') instanceof XMLList )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST') instanceof XML", false, + (MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST') instanceof XML )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST').length()", 0, + (MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST').length() )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST').toString()", "", + (MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST').toString() )); + +// verify that attribute doesn't find child node names +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('TEAM') instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.attribute('TEAM') instanceof XMLList )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('TEAM') instanceof XML", false, + (MYXML = new XML(xmlDoc), MYXML.attribute('TEAM') instanceof XML )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('TEAM').toString()", "", + (MYXML = new XML(xmlDoc), MYXML.attribute('TEAM').toString() )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attribute('TEAM').length()", 0, + (MYXML = new XML(xmlDoc), MYXML.attribute('TEAM').length() )); + +xl = y; + +Assert.expectEq( "attribute(new QName(\"*\"))", "aatrbatr", + ( q = new QName("*"), xl.attribute(q).toString() )); + +Assert.expectEq( "attribute(new QName(\"@*\"))", "", + ( q = new QName("@*"), xl.attribute(q).toString() )); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/output.txt new file mode 100644 index 000000000..e2e0888e2 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/output.txt @@ -0,0 +1,18 @@ +2 PASSED! +3 PASSED! +4 PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('foo') instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('foo') instanceof XML PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('foo').length() PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('foo').toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('foo')[0].nodeKind() PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST') instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST') instanceof XML PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST').length() PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('DOESNOTEXIST').toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('TEAM') instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('TEAM') instanceof XML PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('TEAM').toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.attribute('TEAM').length() PASSED! +attribute(new QName("*")) PASSED! +attribute(new QName("@*")) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/test.swf new file mode 100644 index 000000000..95044a004 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_4/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/Test.as new file mode 100644 index 000000000..7cf5c76b6 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/Test.as @@ -0,0 +1,147 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.40 - valueOf"); + +//TEST(1, true, XML.prototype.hasOwnProperty("valueOf")); + +x1 = + + one +; + +TEST(2, x1, x1.valueOf()); + +// Make sure they're the same and not copies + +x1 = + + one +; + +y1 = x1.valueOf(); + +x1.bravo = "two"; + +TEST(3, x1, y1); + +var xmlDoc = "JohnWalton25" + + +// propertyName as a string +var MYXML = new XML(xmlDoc); +Assert.expectEq( "MYXML = new XML(xmlDoc),MYXML.valueOf() === MYXML", + true, + (MYXML.valueOf() === MYXML)); +MYXML = new XML(); +Assert.expectEq( "MYXML = new XML(),MYXML.valueOf() === MYXML", + true, + (MYXML.valueOf() === MYXML)); +MYXML = new XML(''); +Assert.expectEq( "MYXML = new XML(''),MYXML.valueOf() === MYXML", + true, + (MYXML.valueOf() === MYXML)); +MYXML = new XML('foo'); +Assert.expectEq( "MYXML = new XML('foo'),MYXML.valueOf() === MYXML", + true, + (MYXML.valueOf() === MYXML)); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/output.txt new file mode 100644 index 000000000..1e47868a5 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/output.txt @@ -0,0 +1,6 @@ +2 PASSED! +3 PASSED! +MYXML = new XML(xmlDoc),MYXML.valueOf() === MYXML PASSED! +MYXML = new XML(),MYXML.valueOf() === MYXML PASSED! +MYXML = new XML(''),MYXML.valueOf() === MYXML PASSED! +MYXML = new XML('foo'),MYXML.valueOf() === MYXML PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/test.swf new file mode 100644 index 000000000..2e4abbf5c Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_40/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/Test.as new file mode 100644 index 000000000..325ee4ff2 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/Test.as @@ -0,0 +1,147 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.5 - XML attributes()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("attributes")); + +x1 = + + one +; + +TEST(2, "xml", typeof(x1.attributes())); + +// Iterate through the attributes of an XML value +x1 = + + one +; + +correct = new Array("value1", "value2", "value3"); +i = 0; + +for each (var a in x1.attributes()) +{ + TEST_XML(i + 3, correct[i], a); + i++; +} + +var xmlDoc = "Giants"; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attributes() instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.attributes() instanceof XMLList )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attributes() instanceof XML", false, + (MYXML = new XML(xmlDoc), MYXML.attributes() instanceof XML )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attributes().length()", 2, + (MYXML = new XML(xmlDoc), MYXML.attributes().length() )); +XML.prettyPrinting = false; +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attributes().toString()", "barsecond", + (MYXML = new XML(xmlDoc), MYXML.attributes().toString() )); +XML.prettyPrinting = true; +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attributes().toString()", "barsecond", + (MYXML = new XML(xmlDoc), MYXML.attributes().toString() )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attributes()[0].nodeKind()", "attribute", + (MYXML = new XML(xmlDoc), MYXML.attributes()[0].nodeKind() )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.attributes()[1].nodeKind()", "attribute", + (MYXML = new XML(xmlDoc), MYXML.attributes()[1].nodeKind() )); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/output.txt new file mode 100644 index 000000000..92ffd5428 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/output.txt @@ -0,0 +1,11 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +MYXML = new XML(xmlDoc), MYXML.attributes() instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.attributes() instanceof XML PASSED! +MYXML = new XML(xmlDoc), MYXML.attributes().length() PASSED! +MYXML = new XML(xmlDoc), MYXML.attributes().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.attributes().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.attributes()[0].nodeKind() PASSED! +MYXML = new XML(xmlDoc), MYXML.attributes()[1].nodeKind() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/test.swf new file mode 100644 index 000000000..5fe55279c Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_5/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/Test.as new file mode 100644 index 000000000..cfd0a1575 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/Test.as @@ -0,0 +1,195 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.6 - XML child()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("child")); + +emps = + + Jim25 + Joe20 +; + +correct = +Jim25 + +Joe20; + + +TEST(2, correct, emps.child("employee")); + +TEST(3, Joe, emps.employee[1].child("name")); + +correct = Joe20; + +TEST(4, correct, emps.child(1)); + +var xmlDoc = "GiantsSan FranciscoPadresSan Diego"; + +// Rhino returns "Giants\nPadres>" + +// propertyName as a string +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child('Team')", "Giants" + NL() + "Padres", + (MYXML = new XML(xmlDoc), MYXML.child('Team').toString() )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child('Team') instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.child('Team') instanceof XMLList )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child('Team') instanceof XML", false, + (MYXML = new XML(xmlDoc), MYXML.child('Team') instanceof XML )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child('Team').length()", 2, + (MYXML = new XML(xmlDoc), MYXML.child('Team').length())); +Assert.expectEq( "MYXML = new XML(null), MYXML.child('Team')", "", + (MYXML = new XML(null), MYXML.child('Team').toString() )); +Assert.expectEq( "MYXML = new XML(undefined), MYXML.child('Team')", "", + (MYXML = new XML(undefined), MYXML.child('Team').toString() )); +Assert.expectEq( "MYXML = new XML(), MYXML.child('Team')", "", + (MYXML = new XML(), MYXML.child('Team').toString() )); + +// propertyName as a numeric index +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child(1) instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.child(1) instanceof XMLList )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child(1)", "San Francisco", + (MYXML = new XML(xmlDoc), MYXML.child(1).toString() )); +Assert.expectEq( "MYXML = new XML(null), MYXML.child(1)", "", + (MYXML = new XML(null), MYXML.child(1).toString() )); +Assert.expectEq( "MYXML = new XML(undefined), MYXML.child(1)", "", + (MYXML = new XML(undefined), MYXML.child(1).toString() )); +Assert.expectEq( "MYXML = new XML(), MYXML.child(1)", "", + (MYXML = new XML(), MYXML.child(1).toString() )); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child(0) instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.child(0) instanceof XMLList )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child(0)", "Giants", + (MYXML = new XML(xmlDoc), MYXML.child(0).toString() )); +Assert.expectEq( "MYXML = new XML(null), MYXML.child(0)", "", + (MYXML = new XML(null), MYXML.child(0).toString() )); +Assert.expectEq( "MYXML = new XML(undefined), MYXML.child(0)", "", + (MYXML = new XML(undefined), MYXML.child(0).toString() )); +Assert.expectEq( "MYXML = new XML(), MYXML.child(0)", "", + (MYXML = new XML(), MYXML.child(0).toString() )); + +// propertyName is invalid + +// invalid propertyName +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child('DoesNotExist') instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.child('DoesNotExist') instanceof XMLList )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child('DoesNotExist')", "", + (MYXML = new XML(xmlDoc), MYXML.child('DoesNotExist').toString() )); +Assert.expectEq( "MYXML = new XML(null), MYXML.child('DoesNotExist')", "", + (MYXML = new XML(null), MYXML.child('DoesNotExist').toString() )); +Assert.expectEq( "MYXML = new XML(undefined), MYXML.child('DoesNotExist')", "", + (MYXML = new XML(undefined), MYXML.child('DoesNotExist').toString() )); +Assert.expectEq( "MYXML = new XML(), MYXML.child('DoesNotExist')", "", + (MYXML = new XML(), MYXML.child('DoesNotExist').toString() )); + +// invalid index +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child(8) instanceof XMLList", true, + (MYXML = new XML(xmlDoc), MYXML.child(8) instanceof XMLList )); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child(8)", "", + (MYXML = new XML(xmlDoc), MYXML.child(8).toString() )); +Assert.expectEq( "MYXML = new XML(null), MYXML.child(8)", "", + (MYXML = new XML(null), MYXML.child(8).toString() )); +Assert.expectEq( "MYXML = new XML(undefined), MYXML.child(8)", "", + (MYXML = new XML(undefined), MYXML.child(8).toString() )); +Assert.expectEq( "MYXML = new XML(), MYXML.child(8)", "", + (MYXML = new XML(), MYXML.child(8).toString() )); + + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/output.txt new file mode 100644 index 000000000..a7c0eb92e --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/output.txt @@ -0,0 +1,30 @@ +2 PASSED! +3 PASSED! +4 PASSED! +MYXML = new XML(xmlDoc), MYXML.child('Team') PASSED! +MYXML = new XML(xmlDoc), MYXML.child('Team') instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.child('Team') instanceof XML PASSED! +MYXML = new XML(xmlDoc), MYXML.child('Team').length() PASSED! +MYXML = new XML(null), MYXML.child('Team') PASSED! +MYXML = new XML(undefined), MYXML.child('Team') PASSED! +MYXML = new XML(), MYXML.child('Team') PASSED! +MYXML = new XML(xmlDoc), MYXML.child(1) instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.child(1) PASSED! +MYXML = new XML(null), MYXML.child(1) PASSED! +MYXML = new XML(undefined), MYXML.child(1) PASSED! +MYXML = new XML(), MYXML.child(1) PASSED! +MYXML = new XML(xmlDoc), MYXML.child(0) instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.child(0) PASSED! +MYXML = new XML(null), MYXML.child(0) PASSED! +MYXML = new XML(undefined), MYXML.child(0) PASSED! +MYXML = new XML(), MYXML.child(0) PASSED! +MYXML = new XML(xmlDoc), MYXML.child('DoesNotExist') instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.child('DoesNotExist') PASSED! +MYXML = new XML(null), MYXML.child('DoesNotExist') PASSED! +MYXML = new XML(undefined), MYXML.child('DoesNotExist') PASSED! +MYXML = new XML(), MYXML.child('DoesNotExist') PASSED! +MYXML = new XML(xmlDoc), MYXML.child(8) instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.child(8) PASSED! +MYXML = new XML(null), MYXML.child(8) PASSED! +MYXML = new XML(undefined), MYXML.child(8) PASSED! +MYXML = new XML(), MYXML.child(8) PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/test.swf new file mode 100644 index 000000000..97034d19b Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_6/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/Test.as new file mode 100644 index 000000000..79d575011 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/Test.as @@ -0,0 +1,133 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.7 - XML childIndex()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("childIndex")); + +emps = + + Jim25 + Joe20 +; + +TEST(2, 0, emps.employee[0].childIndex()); + +// Get the ordinal index of the employee named Joe +TEST(3, 1, emps.employee.(age == "20").childIndex()); +TEST(4, 1, emps.employee.(name == "Joe").childIndex()); + +var xmlDoc = "GiantsSan FranciscoPadresSan Diego"; + +// valid test cases +// MYXML.child(0) returns an XMLList with one node +// The [0] returns the first element in the list which should be child 0 +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child(0)[0].childIndex()", 0, + (MYXML = new XML(xmlDoc), MYXML.child(0)[0].childIndex() )); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.child(1)[0].childIndex()", 1, + (MYXML = new XML(xmlDoc), MYXML.child(1)[0].childIndex() )); + +// what does childIndex return if there is no parent +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.childIndex()", -1, + (MYXML = new XML(xmlDoc), MYXML.childIndex() )); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/output.txt new file mode 100644 index 000000000..b9039f7a7 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/output.txt @@ -0,0 +1,6 @@ +2 PASSED! +3 PASSED! +4 PASSED! +MYXML = new XML(xmlDoc), MYXML.child(0)[0].childIndex() PASSED! +MYXML = new XML(xmlDoc), MYXML.child(1)[0].childIndex() PASSED! +MYXML = new XML(xmlDoc), MYXML.childIndex() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/test.swf new file mode 100644 index 000000000..f20008a02 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_7/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/Test.as new file mode 100644 index 000000000..c6ddaf237 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/Test.as @@ -0,0 +1,140 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.8 - XML children()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("children")); + +emps = + + Jim25 + Joe20 +; + +correct = new XMLList(); +correct += Jim25; +correct += Joe20; + +TEST(2, "xml", typeof(emps.children())); +TEST(3, correct, emps.children()); + +// Get the child elements of the first employee +correct = new XMLList(); +correct += Jim, +correct += 25; + +TEST(4, correct, emps.employee[0].children()); + +var xmlDoc = "John California MaryTexas"; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[0].children().toString()", "John" + NL() + "California", (MYXML = new XML(xmlDoc), MYXML.employee[0].children().toString())); + +// Same results whether or not prettyPrinting is true (XMLList.toString testing) +XML.prettyPrinting = false; +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[0].children().toString()", "John" + NL() + "California", (MYXML = new XML(xmlDoc), MYXML.employee[0].children().toString())); + +//!!@This crashes ASC (because of the (id == '1') code +//!!@This does not work in Rhino +//!!@Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee.(id == '1').children()", "John, California", (MYXML = new XML(xmlDoc), MYXML.employee.(id == '1').children())); + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.employee[1].children().toString()", "Mary" + NL() + "Texas", (MYXML = new XML(xmlDoc), MYXML.employee[1].children().toString())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/output.txt new file mode 100644 index 000000000..cc461d682 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/output.txt @@ -0,0 +1,6 @@ +2 PASSED! +3 PASSED! +4 PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[0].children().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[0].children().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.employee[1].children().toString() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/test.swf new file mode 100644 index 000000000..42e4dc9dd Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/test.toml new file mode 100644 index 000000000..cf6123969 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_8/test.toml @@ -0,0 +1 @@ +num_ticks = 1 diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/Test.as new file mode 100644 index 000000000..cda738439 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/Test.as @@ -0,0 +1,139 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + +START("13.4.4.9 - XML comments()"); + +//TEST(1, true, XML.prototype.hasOwnProperty("comments")); + +XML.ignoreComments = false; + +x1 = new XML("some text"); + +TEST_XML(2, "", x1.comments()); +TEST_XML(3, "", x1..*.comments()); + +x2 = new XML("some text"); + +TEST(4, "\n", x2.comments().toXMLString()); +TEST(5, "\n", x2..*.comments().toXMLString()); + +XML.ignoreComments = true; +var xmlDoc = "John California "; + +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.comments().toString()", "", (MYXML = new XML(xmlDoc), MYXML.comments().toString())); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.comments() instanceof XMLList", true, (MYXML = new XML(xmlDoc), MYXML.comments() instanceof XMLList)); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.comments() instanceof XML", false, (MYXML = new XML(xmlDoc), MYXML.comments() instanceof XML)); +Assert.expectEq( "MYXML = new XML(xmlDoc), MYXML.comments().length()", 0, (MYXML = new XML(xmlDoc), MYXML.comments().length() )); + +XML.prettyPrinting = true; +XML.ignoreComments = false; +Assert.expectEq( "XML.ignoreComments = false, MYXML = new XML(xmlDoc), MYXML.comments().toString()", + "\n", + (XML.ignoreComments = false, MYXML = new XML(xmlDoc), MYXML.comments().toXMLString())); +Assert.expectEq( "XML.ignoreComments = false, MYXML = new XML(xmlDoc), MYXML.comments() instanceof XMLList", true, (MYXML = new XML(xmlDoc), MYXML.comments() instanceof XMLList)); +Assert.expectEq( "XML.ignoreComments = false, MYXML = new XML(xmlDoc), MYXML.comments() instanceof XML", false, (MYXML = new XML(xmlDoc), MYXML.comments() instanceof XML)); +Assert.expectEq( "XML.ignoreComments = false, MYXML = new XML(xmlDoc), MYXML.comments().length()", 2, (MYXML = new XML(xmlDoc), MYXML.comments().length() )); + +Assert.expectEq( "XML.ignoreComments = false, MYXML = new XML(xmlDoc), XML.ignoreComments = true, MYXML.comments().toString()", + "\n", + (XML.ignoreComments = false, MYXML = new XML(xmlDoc), XML.ignoreComments = true, MYXML.comments().toXMLString())); + +END(); diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/output.txt new file mode 100644 index 000000000..b81f1fdc2 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/output.txt @@ -0,0 +1,13 @@ +2 PASSED! +3 PASSED! +4 PASSED! +5 PASSED! +MYXML = new XML(xmlDoc), MYXML.comments().toString() PASSED! +MYXML = new XML(xmlDoc), MYXML.comments() instanceof XMLList PASSED! +MYXML = new XML(xmlDoc), MYXML.comments() instanceof XML PASSED! +MYXML = new XML(xmlDoc), MYXML.comments().length() PASSED! +XML.ignoreComments = false, MYXML = new XML(xmlDoc), MYXML.comments().toString() PASSED! +XML.ignoreComments = false, MYXML = new XML(xmlDoc), MYXML.comments() instanceof XMLList PASSED! +XML.ignoreComments = false, MYXML = new XML(xmlDoc), MYXML.comments() instanceof XML PASSED! +XML.ignoreComments = false, MYXML = new XML(xmlDoc), MYXML.comments().length() PASSED! +XML.ignoreComments = false, MYXML = new XML(xmlDoc), XML.ignoreComments = true, MYXML.comments().toString() PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/test.swf new file mode 100644 index 000000000..771f05b4a Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/e13_4_4_9/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/Test.as new file mode 100644 index 000000000..e4c6fa7c6 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/Test.as @@ -0,0 +1,131 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4 XML Object - Assignment to indexed XML not allowed error"); + +var xml; + +xml = new XML("123"); + +var expectedStr = "TypeError: Error #1087: Assignment to indexed XML is not allowed."; +var expected = "Error #1087"; +var result = "error, exception not thrown"; + + + +try{ + +xml[0] = 5; + +throw "kXMLAssignmentToIndexedXMLNotAllowed error not thrown"; + +} catch( e1 ){ + +result = Utils.grabError(e1, e1.toString()); +} + + +Assert.expectEq("xml[0] = 5", expected, result); + +END(); + diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/output.txt new file mode 100644 index 000000000..ae2eaa430 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/output.txt @@ -0,0 +1,2 @@ +Asserting for TypeError PASSED! +xml[0] = 5 PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/test.swf new file mode 100644 index 000000000..f3349519d Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLAssignmentToIndexedXMLNotAllowedErr/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/Test.as new file mode 100644 index 000000000..c955a9092 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/Test.as @@ -0,0 +1,151 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4 XML Object - XML markup must be well-formed Error"); + +var xml; +var expectedStr = "TypeError: Error #1088: The markup in the document following the root element must be well-formed."; +var expected = "Error #1088"; + +var result = "error, exception not thrown"; + + + +try{ + +xml = new XML("c"); +throw "kXMLMarkupMustBeWellFormed error not thrown"; + +} catch( e1 ){ + +result = Utils.grabError(e1, e1.toString()); + +} + +Assert.expectEq( "new XML(\"c\")", expected, result ); + +expected = "TypeError: Error #1088: XML parser failure: element is malformed"; + +// This needs to be a compiler error test case. +/* +try{ + +xml = + + +; + +throw "element malformed error"; + +} catch( e2 ){ + +result = e2.toString(); + +} + +Assert.expectEq( "new XML(\"\")", expected, result ); +*/ +END(); + diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/output.txt new file mode 100644 index 000000000..0b3c37a2f --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/output.txt @@ -0,0 +1,2 @@ +Asserting for TypeError PASSED! +new XML("c") PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/test.swf new file mode 100644 index 000000000..3007e6d0e Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLMarkupMustBeWellFormedErr/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/Test.as new file mode 100644 index 000000000..a552eb787 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/Test.as @@ -0,0 +1,164 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4 XML Object - XML prefix not bound error"); + +var xml; +expectedStr = "TypeError: Error #1083: The prefix \"ns\" for element \"ns:x\" is not bound."; +expected = "Error #1083"; +result = "error, exception not thrown"; + +try{ + +xml = new XML("123"); +throw new Error("kXMLPrefixNotBound error not thrown"); + +} catch( e1 ){ + +result = Utils.grabError(e1, e1.toString()); + +} + +Assert.expectEq( "x = new XML(var xml = new XML(\"123\")", expected, result ); + + + +expectedStr = "TypeError: Error #1083: The prefix \"ns\" for element \"ns:x\" is not bound."; +expected = "Error #1083"; +result = "error, exception not thrown"; + +try{ + +xml = new XML("123"); +throw new Error("kXMLPrefixNotBound error not thrown"); + +} catch( e2 ){ + +result = Utils.grabError(e2, e2.toString()); + +} + +Assert.expectEq( "x = new XML(var xml = new XML(\"123\")", expected, result ); + + + +expectedStr = "TypeError: Error #1083: The prefix \"as\" for element \"as:a\" is not bound."; +expected = "Error #1083"; +result = "error, exception not thrown"; + +try{ + +xml = new XML("1"); +throw new Error("kXMLPrefixNotBound error not thrown"); + +} catch( e3 ){ + +result = Utils.grabError(e3, e3.toString()); + +} + +Assert.expectEq( "x = new XML(var xml = new XML(\"1\")", expected, result ); + + +END(); + diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/output.txt new file mode 100644 index 000000000..9108437ca --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/output.txt @@ -0,0 +1,6 @@ +Asserting for TypeError PASSED! +x = new XML(var xml = new XML("123") PASSED! +Asserting for TypeError PASSED! +x = new XML(var xml = new XML("123") PASSED! +Asserting for TypeError PASSED! +x = new XML(var xml = new XML("1") PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/test.swf new file mode 100644 index 000000000..79b56bd23 Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLPrefixNotBoundErr/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/Test.as new file mode 100644 index 000000000..bbeb81e62 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/Test.as @@ -0,0 +1,146 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +START("13.4 XML Object - XML Unterminated Element Tag Error"); + +var expectedStr = "TypeError: Error #1085: The element type \"unterminated\" must be terminated by the matching end-tag \"\"."; +expected = "Error #1085"; + +var result = "error, exception not thrown"; + + + +try{ + +var xml = new XML("text"); +throw "kXMLUnterminatedElementTag"; + +} catch( e1 ){ + +result = Utils.grabError(e1, e1.toString()); + +} + + + +Assert.expectEq( "new XML(\"text\")", expected, result ); + + + +try{ + +xml = new XML("text"); +throw "kXMLUnterminatedElementTag"; + +} catch( e2 ){ + +result = Utils.grabError(e2, e2.toString()); + +} + + + +Assert.expectEq( "new XML(\"text\")", expected, result ); + +END(); + diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/config.xml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/config.xml new file mode 100644 index 000000000..18d27f9ba --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/config.xml @@ -0,0 +1,13 @@ + + + + . + ../../../lib + + false + false + false + false + + test.swf + \ No newline at end of file diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/output.txt b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/output.txt new file mode 100644 index 000000000..fde81f7c4 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/output.txt @@ -0,0 +1,4 @@ +Asserting for TypeError PASSED! +new XML("text") PASSED! +Asserting for TypeError PASSED! +new XML("text") PASSED! diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/test.swf b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/test.swf new file mode 100644 index 000000000..4984435ec Binary files /dev/null and b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/test.swf differ diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/test.toml b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/test.toml new file mode 100644 index 000000000..29f3cef79 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/kXMLUnterminatedElementTagErr/test.toml @@ -0,0 +1,2 @@ +num_ticks = 1 +known_failure = true diff --git a/tests/tests/swfs/avm2/from_avmplus/e4x/XML/misc_errors/Test.as b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/misc_errors/Test.as new file mode 100644 index 000000000..75b0221b1 --- /dev/null +++ b/tests/tests/swfs/avm2/from_avmplus/e4x/XML/misc_errors/Test.as @@ -0,0 +1,439 @@ +/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +package { +public class Test {} +} + +import com.adobe.test.Assert; +import com.adobe.test.Utils; + +function START(summary) +{ + // print out bugnumber + + /*if ( BUGNUMBER ) { + writeLineToLog ("BUGNUMBER: " + BUGNUMBER ); + }*/ + XML.setSettings (null); + testcases = new Array(); + + // text field for results + tc = 0; + /*this.addChild ( tf ); + tf.x = 30; + tf.y = 50; + tf.width = 200; + tf.height = 400;*/ + + //_print(summary); + var summaryParts = summary.split(" "); + //_print("section: " + summaryParts[0] + "!"); + //fileName = summaryParts[0]; + +} + +function TEST(section, expected, actual) +{ + AddTestCase(section, expected, actual); +} + + +function TEST_XML(section, expected, actual) +{ + var actual_t = typeof actual; + var expected_t = typeof expected; + + if (actual_t != "xml") { + // force error on type mismatch + TEST(section, new XML(), actual); + return; + } + + if (expected_t == "string") { + + TEST(section, expected, actual.toXMLString()); + } else if (expected_t == "number") { + + TEST(section, String(expected), actual.toXMLString()); + } else { + reportFailure ("", 'Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string'); + } +} + +function reportFailure (section, msg) +{ + trace("~FAILURE: " + section + " | " + msg); +} + +function AddTestCase( description, expect, actual ) { + testcases[tc++] = Assert.expectEq(description, "|"+expect+"|", "|"+actual+"|" ); +} + +function myGetNamespace (obj, ns) { + if (ns != undefined) { + return obj.namespace(ns); + } else { + return obj.namespace(); + } +} + + + + +function NL() +{ + //return java.lang.System.getProperty("line.separator"); + return "\n"; +} + + +function BUG(arg){ + // nothing here +} + +function END() +{ + //test(); +} + + +function grabError(arg1, arg2){ + return arg2; +} + + +START("13.4 XML Object - Miscellaneous errors"); + +function grabError(err, str) { + var typeIndex = str.indexOf("Error:"); + var type = str.substr(0, typeIndex + 5); + if (type == "TypeError") { + Assert.expectEq("Asserting for TypeError", true, (err is TypeError)); + } + var numIndex = str.indexOf("Error #"); + var num = str.substr(numIndex, 11); + return num; +} + +var expected, result; + +// missing quote after third + +expectedStr = "TypeError: Error #1095: XML parser failure: Unterminated attribute"; +expected = "Error #1095"; + +try{ + +var x1 = new XML("Blue TrainLocomotionJohn Coltrane"); +throw "missing \""; + +} catch( e1 ){ + +result = grabError(e1, e1.toString()); + +} + +Assert.expectEq( "missing \" after attribute", expected, result ); + + +// missing quotes around third + +expectedStr = "TypeError: Error #1090: XML parser failure: element is malformed"; +expected = "Error #1090"; + +try{ + +x1 = new XML("Blue TrainLocomotionJohn Coltrane"); +throw "missing quotes around attribute"; + +} catch( e2 ){ + +result = grabError(e2, e2.toString()); + +} + +Assert.expectEq( "missing quotes around attribute", expected, result ); + + +// missing starting quote around third + +expectedStr = "TypeError: Error #1090: XML parser failure: element is malformed"; +expected = "Error #1090"; + +try{ + +x1 = new XML("Blue TrainLocomotionJohn Coltrane"); +throw "missing starting quote for attribute"; + +} catch( e3 ){ + +result = grabError(e3, e3.toString()); + +} + +Assert.expectEq( "missing starting quote for attribute", expected, result ); + + + +// missing ! at start of CDATA section + +expectedStr = "TypeError: Error #1090: XML parser failure: element is malformed"; +expected = "Error #1090"; + +try{ + +x1 = new XML(" <[CDATA[ John Doe ]]> "); +throw "missing ! at start of CDATA section"; + +} catch( e4 ){ + +result = grabError(e4, e4.toString()); + +} + +Assert.expectEq( "missing ! at start of CDATA section", expected, result ); + + +// unterminated CDATA + +expectedStr = "TypeError: Error #1091: XML parser failure: Unterminated CDATA section"; +expected = "Error #1091"; + +try{ + +x1 = new XML(" John Doe ]> "); +throw "unterminated CDATA section"; + +} catch( e5 ){ + +result = grabError(e5, e5.toString()); + +} + +Assert.expectEq( "unterminated CDATA section", expected, result ); + + +// unterminated comment + +expectedStr = "TypeError: Error #1094: XML parser failure: Unterminated comment"; +expected = "Error #1094"; + +try{ + +x1 = new XML("