You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2020/03/08 05:58:43 UTC
[royale-asjs] branch develop updated: Added cover for XMLList
for-each iteration of attributes(), children() etc,
newly added support to the compiler
This is an automated email from the ASF dual-hosted git repository.
gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 2dc85f5 Added cover for XMLList for-each iteration of attributes(), children() etc, newly added support to the compiler
new 4033370 Merge branch 'develop' of https://github.com/apache/royale-asjs into develop
2dc85f5 is described below
commit 2dc85f5b61f54d6285ee209887945847968fd2c7
Author: greg-dove <gr...@gmail.com>
AuthorDate: Sun Mar 8 18:14:16 2020 +1300
Added cover for XMLList for-each iteration of attributes(), children() etc, newly added support to the compiler
---
.../XML/src/test/royale/flexUnitTests/XMLTester.as | 2 +
.../xml/XMLListTesterIterationlTest.as | 141 +++++++++++++++++++++
2 files changed, 143 insertions(+)
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/XMLTester.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/XMLTester.as
index 7057fe8..17b01f1 100644
--- a/frameworks/projects/XML/src/test/royale/flexUnitTests/XMLTester.as
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/XMLTester.as
@@ -47,6 +47,8 @@ package flexUnitTests
public var xmlQNameTest:XMLQNameTest;
public var xmlNamespaceQueries:XMLTesterNamespaceQueries;
+
+ public var xmllistInterationTests:XMLListTesterIterationlTest;
}
}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLListTesterIterationlTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLListTesterIterationlTest.as
new file mode 100644
index 0000000..0decfab
--- /dev/null
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLListTesterIterationlTest.as
@@ -0,0 +1,141 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests.xml
+{
+ import org.apache.royale.test.asserts.*;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class XMLListTesterIterationlTest
+ {
+ public static var isJS:Boolean = COMPILE::JS;
+
+
+ private var settings:Object;
+
+
+ [Before]
+ public function setUp():void
+ {
+ settings = XML.settings();
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ XML.setSettings(settings);
+ }
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+
+ [Test]
+ public function testXMLListIteration():void
+ {
+
+ var contentString:String = '<size description="Medium" xmlns:fx="http://ns.adobe.com/mxml/2009" >\n' +
+ ' <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+ ' <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+ '</size>\n' +
+ '<size description="Large" xmlns:fx="http://ns.adobe.com/mxml/2009" >\n' +
+ ' <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+ ' <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+ '</size>\n' +
+ '<size description="Small" xmlns:fx="http://ns.adobe.com/mxml/2009" >\n' +
+ ' <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+ ' <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>\n' +
+ ' <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+ '</size>\n' +
+ '<size description="Medium" xmlns:fx="http://ns.adobe.com/mxml/2009" >\n' +
+ ' <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+ ' <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>\n' +
+ ' <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+ ' <color_swatch image="black_cardigan.jpg">Black</color_swatch>\n' +
+ '</size>\n' +
+ '<size description="Large" xmlns:fx="http://ns.adobe.com/mxml/2009" >\n' +
+ ' <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>\n' +
+ ' <color_swatch image="black_cardigan.jpg">Black</color_swatch>\n' +
+ '</size>\n' +
+ '<size description="Extra Large" xmlns:fx="http://ns.adobe.com/mxml/2009" >\n' +
+ ' <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+ ' <color_swatch image="black_cardigan.jpg">Black</color_swatch>\n' +
+ '</size>';
+
+ var xmllist:XMLList = XMLList(contentString);
+ var count:uint = 0;
+ for each(var xml:XML in xmllist) {
+ count++;
+ }
+
+ assertEquals(count, 6, 'unexpected list count');
+
+ }
+
+
+ [Test]
+ public function testAttributeXMLListIteration():void
+ {
+
+ var xml:XML = <TextFlow blockProgression="tb" color="0x0" columnCount="inherit" columnGap="inherit" columnWidth="inherit" direction="ltr" fontFamily="Arial" fontSize="12" fontStyle="normal" fontWeight="normal" kerning="auto" lineBreak="inherit" lineHeight="120%" locale="en" paddingBottom="inherit" paddingLeft="inherit" paddingRight="inherit" paddingTop="inherit" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="start" [...]
+
+ var count:int;
+ for each(var att:XML in xml[0].attributes()) {
+ count++;
+ }
+
+ assertEquals(count, 31, 'unexpected list count');
+ count=0;
+ for each(att in xml.attributes()) {
+ count++;
+ }
+ assertEquals(count, 31, 'unexpected list count');
+
+ }
+
+
+ [Test]
+ public function testChildrenXMLListIteration():void
+ {
+
+ var xml:XML = <monkeys><Mandrill/><Spidery/><Proboscis/><PygmyMarmoset/><RhesusMacaque/><Gibbon/><Howler/><Baboon/><Capuchin/></monkeys>
+ var count:int;
+ for each(var att:XML in xml[0].children()) {
+ count++;
+ }
+
+ assertEquals(count, 9, 'unexpected list count');
+ count=0;
+ for each(att in xml.children()) {
+ count++;
+ }
+ assertEquals(count, 9, 'unexpected list count');
+
+ }
+
+ }
+}