You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2012/08/07 19:34:19 UTC
svn commit: r1370380 [4/13] - in
/incubator/flex/trunk/mustella/tests/resources: ./ Integration/
Integration/Compiler/ Integration/FrameworkProperties/ Integration/SWFs/
Integration/SWFs/Assets/ Integration/SWFs/Assets/bundles/
Integration/SWFs/Assets/...
Added: incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getObject.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getObject.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getObject.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getObject.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,393 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<UnitTester testDir="resources/ResourceBundle/Methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ResourceBundleApp.mxml">
+
+ <!-- this set of lines form a template that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+ public static function init(o:DisplayObject):void{}
+ ]]></mx:Script>
+
+ <mx:Metadata><![CDATA[
+ [Mixin]
+ ]]></mx:Metadata>
+
+ <!-- end of set of lines that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+
+ public function testGetObjectError(key:String):String
+ {
+ try
+ {
+ application.resourceBundle.getObject(key);
+ }
+ catch (e:Error)
+ {
+ return e.toString();
+ }
+ return null;
+ }
+
+ public function testGetObject(key:String, expectedValue:*):Boolean
+ {
+ // Special-case logic for when the resource value is NaN,
+ // because you can't use === to check for NaN.
+ if (expectedValue is Number && isNaN(expectedValue))
+ {
+ var resourceValue:* = application.resourceBundle.getObject(key);
+ return resourceValue is Number && isNaN(resourceValue);
+ }
+
+ return application.resourceBundle.getObject(key) === expectedValue;
+ }
+
+ ]]></mx:Script>
+
+ <testCases>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_NO_SUCH_KEY" description="Tests that the getObject() method of ResourceBundle throws an Error when accessing a non-existent resource" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObjectError('NO_SUCH_KEY')" value="Error: Key NO_SUCH_KEY was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING" description="Tests the getObject() method of ResourceBundle for a resource value which is a typical String" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING', 'abc')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_LIST" description="Tests the getObject() method of ResourceBundle for a resource value which is a typical String of comma-separated items" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_LIST', ' abc,def , ghi jil\tmno ')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_EMPTY" description="Tests the getObject() method of ResourceBundle for a resource value which is an empty String" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetObjectError('STRING_EMPTY')" value="Error: Key STRING_EMPTY was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_NULL" description="Tests the getObject() method of ResourceBundle for a resource value which is the String 'null'" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_NULL', 'null')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_UNDEFINED" description="Tests the getObject() method of ResourceBundle for a resource value which is the String 'undefined'" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_UNDEFINED', 'undefined')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_TRUE_LOWERCASE" description="Tests the getObject() method of ResourceBundle for a resource value which is the String 'true'" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_TRUE_LOWERCASE', 'true')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_TRUE_MIXEDCASE" description="Tests the getObject() method of ResourceBundle for a resource value which is the String 'True'" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_TRUE_MIXEDCASE', 'True')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_TRUE_UPPERCASE" description="Tests the getObject() method of ResourceBundle for a resource value which is the String 'TRUE'" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_TRUE_UPPERCASE', 'TRUE')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_FALSE_LOWERCASE" description="Tests the getObject() method of ResourceBundle for a resource value which is the String 'false'" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_FALSE_LOWERCASE', 'false')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_FALSE_MIXEDCASE" description="Tests the getObject() method of ResourceBundle for a resource value which is the String 'False'" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_FALSE_MIXEDCASE', 'False')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_FALSE_UPPERCASE" description="Tests the getObject() method of ResourceBundle for a resource value which is the String 'FALSE'" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_FALSE_UPPERCASE', 'FALSE')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_NAN" description="Tests the getObject() method of ResourceBundle for a resource value which is the String 'NaN'" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_NAN', 'NaN')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_ZERO" description="Tests the getObject() method of ResourceBundle for a resource value which is the String '0'" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_ZERO', '0')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_POSITIVE_INTEGER" description="Tests the getObject() method of ResourceBundle for a resource value which is the String rep of a typical positive integer" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_POSITIVE_INTEGER', '3')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_NEGATIVE_INTEGER" description="Tests the getObject() method of ResourceBundle for a resource value which is the String rep of a typical negative integer" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_NEGATIVE_INTEGER', '-3')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_FIXEDPOINT" description="Tests the getObject() method of ResourceBundle for a resource value which is the String rep of a typical fractional Number" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_FIXEDPOINT', '1.5')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_STRING_FLOATINGPOINT" description="Tests the getObject() method of ResourceBundle for a resource value which is the String rep of a typical fractional Number in exponential notation" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('STRING_FLOATINGPOINT', '5.0e-1')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_NULL" description="Tests the getObject() method of ResourceBundle for a resource value which is null" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetObjectError('NULL')" value="Error: Key NULL was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_UNDEFINED" description="Tests the getObject() method of ResourceBundle for a resource value which is undefined" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetObjectError('UNDEFINED')" value="Error: Key UNDEFINED was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_TRUE" description="Tests the getObject() method of ResourceBundle for a resource value which is true" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('TRUE', true)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_FALSE" description="Tests the getObject() method of ResourceBundle for a resource value which is false" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetObjectError('FALSE')" value="Error: Key FALSE was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_NAN" description="Tests the getObject() method of ResourceBundle for a resource value which is NaN" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetObjectError('NAN')" value="Error: Key NAN was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_ZERO" description="Tests the getObject() method of ResourceBundle for a resource value which is 0" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetObjectError('ZERO')" value="Error: Key ZERO was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_POSITIVE_INTEGER" description="Tests the getObject() method of ResourceBundle for a resource value which is a typical positive integer" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('POSITIVE_INTEGER', 3)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_NEGATIVE_INTEGER" description="Tests the getObject() method of ResourceBundle for a resource value which is a typical negative integer" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('NEGATIVE_INTEGER', -3)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_FIXEDPOINT" description="Tests the getObject() method of ResourceBundle for a resource value which is a typical fractional Number" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('FIXEDPOINT', 1.5)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_FLOATINGPOINT" description="Tests the getObject() method of ResourceBundle for a resource value which is a typical fractional Number in exponential notation" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('FLOATINGPOINT', 5.0e-1)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_CLASS" description="Tests the getObject() method of ResourceBundle for a resource value which is a Class reference" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('CLASS', application.aClass)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_ARRAY" description="Tests the getObject() method of ResourceBundle for a resource value which is an Array of Strings" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('ARRAY', application.anArray)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getObject_OBJECT" description="Tests the getObject() method of ResourceBundle for a resource value which is a plain Object" keywords="[resources,ResourceBundle,getObject]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetObject('OBJECT', application.anObject)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ </testCases>
+
+ <!--
+
+ Note 1: This is peculiar legacy behavior due to bad coding that used !value
+ to try to detect a nonexistent resource.
+ But it doesn't matter, because getObject() is a deprecated method.
+
+ -->
+
+</UnitTester>
+
Added: incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getString.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getString.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getString.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getString.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,385 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<UnitTester testDir="resources/ResourceBundle/Methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ResourceBundleApp.mxml">
+
+ <!-- this set of lines form a template that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+ public static function init(o:DisplayObject):void{}
+ ]]></mx:Script>
+
+ <mx:Metadata><![CDATA[
+ [Mixin]
+ ]]></mx:Metadata>
+
+ <!-- end of set of lines that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+
+ public function testGetStringError(key:String):String
+ {
+ try
+ {
+ application.resourceBundle.getString(key);
+ }
+ catch (e:Error)
+ {
+ return e.toString();
+ }
+ return null;
+ }
+
+ public function testGetString(key:String, expectedValue:String):Boolean
+ {
+ return application.resourceBundle.getString(key) === expectedValue;
+ }
+
+ ]]></mx:Script>
+
+ <testCases>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_NO_SUCH_KEY" description="Tests that the getString() method of ResourceBundle throws an Error when accessing a non-existent resource" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringError('NO_SUCH_KEY')" value="Error: Key NO_SUCH_KEY was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING" description="Tests the getString() method of ResourceBundle for a resource value which is a typical String" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING', 'abc')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_LIST" description="Tests the getString() method of ResourceBundle for a resource value which is a typical String of comma-separated items" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_LIST', ' abc,def , ghi jil\tmno ')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_EMPTY" description="Tests the getString() method of ResourceBundle for a resource value which is an empty String" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringError('STRING_EMPTY')" value="Error: Key STRING_EMPTY was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_NULL" description="Tests the getString() method of ResourceBundle for a resource value which is the String 'null'" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_NULL', 'null')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_UNDEFINED" description="Tests the getString() method of ResourceBundle for a resource value which is the String 'undefined'" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_UNDEFINED', 'undefined')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_TRUE_LOWERCASE" description="Tests the getString() method of ResourceBundle for a resource value which is the String 'true'" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_TRUE_LOWERCASE', 'true')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_TRUE_MIXEDCASE" description="Tests the getString() method of ResourceBundle for a resource value which is the String 'True'" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_TRUE_MIXEDCASE', 'True')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_TRUE_UPPERCASE" description="Tests the getString() method of ResourceBundle for a resource value which is the String 'TRUE'" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_TRUE_UPPERCASE', 'TRUE')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_FALSE_LOWERCASE" description="Tests the getString() method of ResourceBundle for a resource value which is the String 'false'" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_FALSE_LOWERCASE', 'false')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_FALSE_MIXEDCASE" description="Tests the getString() method of ResourceBundle for a resource value which is the String 'False'" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_FALSE_MIXEDCASE', 'False')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_FALSE_UPPERCASE" description="Tests the getString() method of ResourceBundle for a resource value which is the String 'FALSE'" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_FALSE_UPPERCASE', 'FALSE')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_NAN" description="Tests the getString() method of ResourceBundle for a resource value which is the String 'NaN'" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_NAN', 'NaN')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_ZERO" description="Tests the getString() method of ResourceBundle for a resource value which is the String '0'" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_ZERO', '0')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_POSITIVE_INTEGER" description="Tests the getString() method of ResourceBundle for a resource value which is the String rep of a typical positive integer" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_POSITIVE_INTEGER', '3')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_NEGATIVE_INTEGER" description="Tests the getString() method of ResourceBundle for a resource value which is the String rep of a typical negative integer" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_NEGATIVE_INTEGER', '-3')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_FIXEDPOINT" description="Tests the getString() method of ResourceBundle for a resource value which is the String rep of a typical fractional Number" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_FIXEDPOINT', '1.5')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_STRING_FLOATINGPOINT" description="Tests the getString() method of ResourceBundle for a resource value which is the String rep of a typical fractional Number in exponential notation" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('STRING_FLOATINGPOINT', '5.0e-1')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_NULL" description="Tests the getString() method of ResourceBundle for a resource value which is null" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringError('NULL')" value="Error: Key NULL was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_UNDEFINED" description="Tests the getString() method of ResourceBundle for a resource value which is undefined" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringError('UNDEFINED')" value="Error: Key UNDEFINED was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_TRUE" description="Tests the getString() method of ResourceBundle for a resource value which is true" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('TRUE', 'true')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_FALSE" description="Tests the getString() method of ResourceBundle for a resource value which is false" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringError('FALSE')" value="Error: Key FALSE was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_NAN" description="Tests the getString() method of ResourceBundle for a resource value which is NaN" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringError('NAN')" value="Error: Key NAN was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_ZERO" description="Tests the getString() method of ResourceBundle for a resource value which is 0" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringError('ZERO')" value="Error: Key ZERO was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_POSITIVE_INTEGER" description="Tests the getString() method of ResourceBundle for a resource value which is a typical positive integer" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('POSITIVE_INTEGER', '3')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_NEGATIVE_INTEGER" description="Tests the getString() method of ResourceBundle for a resource value which is a typical negative integer" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('NEGATIVE_INTEGER', '-3')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_FIXEDPOINT" description="Tests the getString() method of ResourceBundle for a resource value which is a typical fractional Number" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('FIXEDPOINT', '1.5')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_FLOATINGPOINT" description="Tests the getString() method of ResourceBundle for a resource value which is a typical fractional Number in exponential notation" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('FLOATINGPOINT', '0.5')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_CLASS" description="Tests the getString() method of ResourceBundle for a resource value which is a Class reference" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('CLASS', '[class ResourceBundle]')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_ARRAY" description="Tests the getString() method of ResourceBundle for a resource value which is an Array of Strings" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('ARRAY', 'abc,def')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getString_OBJECT" description="Tests the getString() method of ResourceBundle for a resource value which is a plain Object" keywords="[resources,ResourceBundle,getString]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetString('OBJECT', '[object Object]')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ </testCases>
+
+ <!--
+
+ Note 1: This is peculiar legacy behavior due to bad coding that used !value
+ to try to detect a nonexistent resource.
+ But it doesn't matter, because getString() is a deprecated method.
+
+ -->
+
+</UnitTester>
+
Added: incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getStringArray.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getStringArray.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getStringArray.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getStringArray.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,400 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<UnitTester testDir="resources/ResourceBundle/Methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ResourceBundleApp.mxml">
+
+ <!-- this set of lines form a template that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+ public static function init(o:DisplayObject):void{}
+ ]]></mx:Script>
+
+ <mx:Metadata><![CDATA[
+ [Mixin]
+ ]]></mx:Metadata>
+
+ <!-- end of set of lines that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+
+ public function testGetStringArrayError(key:String):String
+ {
+ try
+ {
+ application.resourceBundle.getStringArray(key);
+ }
+ catch (e:Error)
+ {
+ return e.toString();
+ }
+ return null;
+ }
+
+ public function testGetStringArray(key:String, expectedValue:Array):Boolean
+ {
+ var a1:Array = application.resourceBundle.getStringArray(key);
+ var a2:Array = expectedValue;
+
+ var n1:int = a1.length;
+ var n2:int = a2.length;
+
+ if (n1 != n2)
+ return false;
+
+ for (var i:int = 0; i < n1; i++)
+ {
+ if (a1[i] !== a2[i])
+ return false;
+ }
+
+ return true;
+ }
+
+ ]]></mx:Script>
+
+ <testCases>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_NO_SUCH_KEY" description="Tests that the getStringArray() method of ResourceBundle throws an Error when accessing a non-existent resource" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArrayError('NO_SUCH_KEY')" value="Error: Key NO_SUCH_KEY was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING" description="Tests the getStringArray() method of ResourceBundle for a resource value which is a typical String" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING', [ 'abc' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_LIST" description="Tests the getStringArray() method of ResourceBundle for a resource value which is a typical String of comma-separated items" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_LIST', [ 'abc', 'def', 'ghi jil\tmno' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_EMPTY" description="Tests the getStringArray() method of ResourceBundle for a resource value which is an empty String" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringArrayError('STRING_EMPTY')" value="Error: Key STRING_EMPTY was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_NULL" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String 'null'" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_NULL', [ 'null' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_UNDEFINED" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String 'undefined'" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_UNDEFINED', [ 'undefined' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_TRUE_LOWERCASE" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String 'true'" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_TRUE_LOWERCASE', [ 'true' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_TRUE_MIXEDCASE" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String 'True'" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_TRUE_MIXEDCASE', [ 'True' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_TRUE_UPPERCASE" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String 'TRUE'" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_TRUE_UPPERCASE', [ 'TRUE' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_FALSE_LOWERCASE" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String 'false'" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_FALSE_LOWERCASE', [ 'false' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_FALSE_MIXEDCASE" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String 'False'" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_FALSE_MIXEDCASE', [ 'False' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_FALSE_UPPERCASE" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String 'FALSE'" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_FALSE_UPPERCASE', [ 'FALSE' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_NAN" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String 'NaN'" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_NAN', [ 'NaN' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_ZERO" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String '0'" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_ZERO', [ '0' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_POSITIVE_INTEGER" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String rep of a typical positive integer" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_POSITIVE_INTEGER', [ '3' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_NEGATIVE_INTEGER" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String rep of a typical negative integer" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_NEGATIVE_INTEGER', [ '-3' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_FIXEDPOINT" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String rep of a typical fractional Number" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_FIXEDPOINT', [ '1.5' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_STRING_FLOATINGPOINT" description="Tests the getStringArray() method of ResourceBundle for a resource value which is the String rep of a typical fractional Number in exponential notation" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArray('STRING_FLOATINGPOINT', [ '5.0e-1' ])" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_NULL" description="Tests the getStringArray() method of ResourceBundle for a resource value which is null" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringArrayError('NULL')" value="Error: Key NULL was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_UNDEFINED" description="Tests the getStringArray() method of ResourceBundle for a resource value which is undefined" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringArrayError('UNDEFINED')" value="Error: Key UNDEFINED was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_TRUE" description="Tests the getStringArray() method of ResourceBundle for a resource value which is true" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArrayError('TRUE')" value="TypeError: Error #1006: value is not a function."/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_FALSE" description="Tests the getStringArray() method of ResourceBundle for a resource value which is false" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringArrayError('FALSE')" value="Error: Key FALSE was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_NAN" description="Tests the getStringArray() method of ResourceBundle for a resource value which is NaN" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringArrayError('NAN')" value="Error: Key NAN was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_ZERO" description="Tests the getStringArray() method of ResourceBundle for a resource value which is 0" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <!-- See Note 1 below -->
+ <AssertMethodValue method="value=testGetStringArrayError('ZERO')" value="Error: Key ZERO was not found in resource bundle myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_POSITIVE_INTEGER" description="Tests the getStringArray() method of ResourceBundle for a resource value which is a typical positive integer" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArrayError('POSITIVE_INTEGER')" value="TypeError: Error #1006: value is not a function."/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_NEGATIVE_INTEGER" description="Tests the getStringArray() method of ResourceBundle for a resource value which is a typical negative integer" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArrayError('NEGATIVE_INTEGER')" value="TypeError: Error #1006: value is not a function."/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_FIXEDPOINT" description="Tests the getStringArray() method of ResourceBundle for a resource value which is a typical fractional Number" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArrayError('FIXEDPOINT')" value="TypeError: Error #1006: value is not a function."/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_FLOATINGPOINT" description="Tests the getStringArray() method of ResourceBundle for a resource value which is a typical fractional Number in exponential notation" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArrayError('FLOATINGPOINT')" value="TypeError: Error #1006: value is not a function."/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_CLASS" description="Tests the getStringArray() method of ResourceBundle for a resource value which is a Class reference" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArrayError('CLASS')" value="TypeError: Error #1006: split is not a function."/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_ARRAY" description="Tests the getStringArray() method of ResourceBundle for a resource value which is an Array of Strings" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArrayError('ARRAY')" value="TypeError: Error #1006: split is not a function."/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_getStringArray_OBJECT" description="Tests the getStringArray() method of ResourceBundle for a resource value which is a plain Object" keywords="[resources,ResourceBundle,getStringArray]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetStringArrayError('OBJECT')" value="TypeError: Error #1006: split is not a function."/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ </testCases>
+
+ <!--
+
+ Note 1: This is peculiar legacy behavior due to bad coding that used !value
+ to try to detect a nonexistent resource.
+ But it doesn't matter, because getStringArray() is a deprecated method.
+
+ -->
+
+</UnitTester>
+
Added: incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_bundleName.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_bundleName.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_bundleName.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_bundleName.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<UnitTester testDir="resources/ResourceBundle/Properties/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ResourceBundleApp.mxml">
+
+ <!-- this set of lines form a template that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+ public static function init(o:DisplayObject):void{}
+ ]]></mx:Script>
+
+ <mx:Metadata><![CDATA[
+ [Mixin]
+ ]]></mx:Metadata>
+
+ <!-- end of set of lines that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+
+ import mx.resources.IResourceBundle;
+ import mx.resources.ResourceBundle;
+
+ public var resourceBundle:IResourceBundle;
+
+ public function setup():void
+ {
+ resourceBundle = new ResourceBundle("qa_QA", "myResources");
+ }
+
+ ]]></mx:Script>
+
+ <testCases>
+
+ <TestCase frequency="all" testID="ResourceBundle_bundleName_set_by_constructor" description="Confirms that the 'bundleName' property of ResourceBundle is properly set by constructor" keywords="[resources,ResourceBundle,bundleName,constructor]">
+ <setup>
+ <RunCode code="setup()"/>
+ </setup>
+ <body>
+ <AssertPropertyValue target="script:resourceBundle" propertyName="bundleName" value="myResources"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_bundleName_is_readonly" description="Confirms that the 'bundleName' property of ResourceBundle is readonly" keywords="[resources,ResourceBundle,bundleName,readonly]">
+ <setup>
+ <RunCode code="setup()"/>
+ </setup>
+ <body>
+ <SetProperty target="script:resourceBundle" propertyName="bundleName" value="yourResources"/>
+ <AssertError value="ReferenceError: Error #1074: Illegal write to read-only property bundleName on mx.resources.ResourceBundle."/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ </testCases>
+
+</UnitTester>
+
Added: incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_content.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_content.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_content.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_content.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<UnitTester testDir="resources/ResourceBundle/Properties/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ResourceBundleApp.mxml">
+
+ <!-- this set of lines form a template that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+ public static function init(o:DisplayObject):void{}
+ ]]></mx:Script>
+
+ <mx:Metadata><![CDATA[
+ [Mixin]
+ ]]></mx:Metadata>
+
+ <!-- end of set of lines that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+
+ import mx.resources.IResourceBundle;
+ import mx.resources.ResourceBundle;
+
+ public var resourceBundle:IResourceBundle;
+
+ public function setup():void
+ {
+ resourceBundle = new ResourceBundle("qa_QA", "myResources");
+ }
+
+ ]]></mx:Script>
+
+ <testCases>
+
+ <TestCase frequency="all" testID="ResourceBundle_content_set_by_constructor" description="Confirms that the 'content' property of ResourceBundle is properly set by constructor" keywords="[resources,ResourceBundle,content,constructor]">
+ <setup>
+ <RunCode code="setup()"/>
+ </setup>
+ <body>
+ <AssertPropertyValue target="script:resourceBundle" propertyName="content" value="(Object)#0"/>
+ <!-- Note: value="(Object)#0" is the mustella representation of an empty object, {} -->
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_content_is_readonly" description="Confirms that the 'content' property of ResourceBundle is readonly" keywords="[resources,ResourceBundle,content,readonly]">
+ <setup>
+ <RunCode code="setup()"/>
+ </setup>
+ <body>
+ <SetProperty target="script:resourceBundle" propertyName="content" value="foo"/>
+ <AssertError value="ReferenceError: Error #1074: Illegal write to read-only property content on mx.resources.ResourceBundle."/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ </testCases>
+
+</UnitTester>
+
Added: incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_locale.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_locale.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_locale.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_locale.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<UnitTester testDir="resources/ResourceBundle/Properties/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ResourceBundleApp.mxml">
+
+ <!-- this set of lines form a template that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+ public static function init(o:DisplayObject):void{}
+ ]]></mx:Script>
+
+ <mx:Metadata><![CDATA[
+ [Mixin]
+ ]]></mx:Metadata>
+
+ <!-- end of set of lines that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+
+ import mx.resources.IResourceBundle;
+ import mx.resources.ResourceBundle;
+
+ public var resourceBundle:IResourceBundle;
+
+ public function setup():void
+ {
+ resourceBundle = new ResourceBundle("qa_QA", "myResources");
+ }
+
+ ]]></mx:Script>
+
+ <testCases>
+
+ <TestCase frequency="all" testID="ResourceBundle_locale_set_by_constructor" description="Confirms that the 'locale' property of ResourceBundle is properly set by constructor" keywords="[resources,ResourceBundle,locale,constructor]">
+ <setup>
+ <RunCode code="setup()"/>
+ </setup>
+ <body>
+ <AssertPropertyValue target="script:resourceBundle" propertyName="locale" value="qa_QA"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceBundle_locale_is_readonly" description="Confirms that the 'locale' property of ResourceBundle is readonly" keywords="[resources,ResourceBundle,locale,readonly]">
+ <setup>
+ <RunCode code="setup()"/>
+ </setup>
+ <body>
+ <SetProperty target="script:resourceBundle" propertyName="locale" value="xy_XY"/>
+ <AssertError value="ReferenceError: Error #1074: Illegal write to read-only property locale on mx.resources.ResourceBundle."/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ </testCases>
+
+</UnitTester>
+
Added: incubator/flex/trunk/mustella/tests/resources/ResourceBundle/SWFs/ResourceBundleApp.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceBundle/SWFs/ResourceBundleApp.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceBundle/SWFs/ResourceBundleApp.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceBundle/SWFs/ResourceBundleApp.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<mx:Application backgroundColor="0xFFFFFF" xmlns:mx="http://www.adobe.com/2006/mxml">
+
+ <mx:Script>
+ <![CDATA[
+
+ import mx.resources.ResourceBundle;
+
+ public var resourceBundle:ResourceBundle;
+
+ public var aClass:Class = ResourceBundle;
+ public var anArray:Array = [ "abc", "def" ];
+ public var anObject:Object = { abc: "def" };
+
+ public function setup():void
+ {
+ resourceBundle = new ResourceBundle("qa_QA", "myResources");
+
+ resourceBundle.content["STRING"] = "abc";
+ resourceBundle.content["STRING_LIST"] = " abc,def , ghi jil\tmno ";
+ resourceBundle.content["STRING_EMPTY"] = "";
+ resourceBundle.content["STRING_NULL"] = "null";
+ resourceBundle.content["STRING_UNDEFINED"] = "undefined";
+ resourceBundle.content["STRING_TRUE_LOWERCASE"] = "true";
+ resourceBundle.content["STRING_TRUE_MIXEDCASE"] = "True";
+ resourceBundle.content["STRING_TRUE_UPPERCASE"] = "TRUE";
+ resourceBundle.content["STRING_FALSE_LOWERCASE"] = "false";
+ resourceBundle.content["STRING_FALSE_MIXEDCASE"] = "False";
+ resourceBundle.content["STRING_FALSE_UPPERCASE"] = "FALSE";
+ resourceBundle.content["STRING_NAN"] = "NaN";
+ resourceBundle.content["STRING_ZERO"] = "0";
+ resourceBundle.content["STRING_POSITIVE_INTEGER"] = "3";
+ resourceBundle.content["STRING_NEGATIVE_INTEGER"] = "-3";
+ resourceBundle.content["STRING_FIXEDPOINT"] = "1.5";
+ resourceBundle.content["STRING_FLOATINGPOINT"] = "5.0e-1";
+ resourceBundle.content["NULL"] = null;
+ resourceBundle.content["UNDEFINED"] = undefined;
+ resourceBundle.content["TRUE"] = true;
+ resourceBundle.content["FALSE"] = false;
+ resourceBundle.content["NAN"] = NaN;
+ resourceBundle.content["ZERO"] = 0;
+ resourceBundle.content["POSITIVE_INTEGER"] = 3;
+ resourceBundle.content["NEGATIVE_INTEGER"] = -3;
+ resourceBundle.content["FIXEDPOINT"] = 1.5;
+ resourceBundle.content["FLOATINGPOINT"] = 5.0e-1;
+ resourceBundle.content["CLASS"] = aClass;
+ resourceBundle.content["ARRAY"] = anArray;
+ resourceBundle.content["OBJECT"] = anObject;
+ }
+
+ ]]>
+ </mx:Script>
+
+</mx:Application>
Added: incubator/flex/trunk/mustella/tests/resources/ResourceManager/Events/ResourceManager_Events.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceManager/Events/ResourceManager_Events.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceManager/Events/ResourceManager_Events.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceManager/Events/ResourceManager_Events.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<UnitTester testDir="resources/ResourceManager/Events/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ResourceManagerApp.mxml">
+
+ <!-- this set of lines form a template that must be in each unit test -->
+ <mx:Script><![CDATA[
+ public static function init(o:DisplayObject):void{}
+ ]]></mx:Script>
+
+ <mx:Metadata><![CDATA[
+ [Mixin]
+ ]]></mx:Metadata>
+ <!-- end of set of lines that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+ import mx.resources.ResourceManager;
+ import mx.resources.ResourceBundle;
+ import mx.events.ResourceEvent;
+
+ public var ed1:IEventDispatcher;
+ public var ed2:IEventDispatcher;
+ public var ed3:IEventDispatcher;
+ public var ed4:IEventDispatcher;
+ public var ed5:IEventDispatcher;
+
+ private function clearAllLocaleData():void{
+
+ ResourceManager.getInstance().localeChain = [];
+
+ var numLocales:int = ResourceManager.getInstance().getLocales().length;
+
+ for(var i:int = numLocales; i > 0; --i){
+ ResourceManager.getInstance().removeResourceBundlesForLocale(ResourceManager.getInstance().getLocales()[i-1]);
+ }
+ }
+
+ private function handleErrorEvent(e:ResourceEvent):void{trace("handleErrorEvent: " + e.toString())}
+ private function handleProgressEvent(e:ResourceEvent):void{trace("handleProgressEvent: " + e.toString())}
+ private function handleCompleteEvent(e:ResourceEvent):void{trace("handleCompleteEvent: " + e.toString())}
+
+ ]]></mx:Script>
+
+
+<!--
+General approach:
+ <setup>
+ - Remove all locales.
+ - Clear the locale chain.
+ - Verify that there are no resources left.
+ </setup>
+ <body>
+ - Initiate the loading
+ - Set up event listeners for the returned IEventDispatcher.
+ - Make sure events do (or do not) occur.
+ </body>
+-->
+
+ <testCases>
+
+ <!--
+ It is a bug to wait for 2 error events instead of just one. Bug 203857. Excluding.
+ -->
+ <TestCase frequency="all" testID="RTL_Event_ResourceManagerErrorEvent_ExactlyOne" description="Confirm that loadResourceModule triggers an error event when the parameter is invalid." keywords="[Runtime Localization,loadResourceModule]" >
+ <setup>
+ <RunCode code="clearAllLocaleData()" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="0" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().localeChain.length" value="0" />
+ </setup>
+ <body>
+ <RunCode code="ed1=ResourceManager.getInstance().loadResourceModule('ThisDoesNotExist.swf')" />
+ <RunCode code="ed1.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <AssertEvent target="script:ed1" eventName="error" eventClass="mx.events::ResourceEvent" numExpectedEvents="1" />
+ </body>
+ </TestCase>
+
+ <!--
+ This is just like the above test, except that we don't care how many error events occur. That way we can exclude
+ the above test yet still confirm that an error event will get dispatched.
+ -->
+ <TestCase frequency="all" testID="RTL_Event_ResourceManagerErrorEvent_AtLeastOne" description="Confirm that loadResourceModule triggers an error event when the parameter is invalid." keywords="[Runtime Localization,loadResourceModule]" >
+ <setup>
+ <RunCode code="clearAllLocaleData()" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="0" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().localeChain.length" value="0" />
+ </setup>
+ <body>
+ <RunCode code="ed1=ResourceManager.getInstance().loadResourceModule('ThisDoesNotExist.swf')" />
+ <RunCode code="ed1.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <AssertEvent target="script:ed1" eventName="error" eventClass="mx.events::ResourceEvent" numExpectedEvents="-1" />
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Event_ResourceManagerProgressEvent" description="Confirm that loadResourceModule triggers a progress event when loading." keywords="[Runtime Localization,loadResourceModule]" >
+ <setup>
+ <RunCode code="clearAllLocaleData()" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="0" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().localeChain.length" value="0" />
+ </setup>
+ <body>
+ <RunCode code="ed2=ResourceManager.getInstance().loadResourceModule('assets/bundles/framework/resMod_events_001.swf')" />
+ <RunCode code="ed2.addEventListener(ResourceEvent.PROGRESS, handleProgressEvent)" />
+ <RunCode code="ed2.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed2" eventName="progress" eventClass="mx.events::ResourceEvent" numExpectedEvents="-1" />
+ <AssertEvent target="script:ed2" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Event_ResourceManagerCompleteEvent" description="Confirm that loadResourceModule triggers a complete event when it is done loading." keywords="[Runtime Localization,loadResourceModule]" >
+ <setup>
+ <RunCode code="clearAllLocaleData()" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="0" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().localeChain.length" value="0" />
+ </setup>
+ <body>
+ <RunCode code="ed3=ResourceManager.getInstance().loadResourceModule('assets/bundles/framework/resMod_events_002.swf')" />
+ <RunCode code="ed3.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed3" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Event_ResourceManagerNoCompleteEventWithError" description="Confirm that loadResourceModule() does not trigger a complete event when there is an error." keywords="[Runtime Localization,loadResourceModule]" >
+ <setup>
+ <RunCode code="clearAllLocaleData()" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="0" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().localeChain.length" value="0" />
+ </setup>
+ <body>
+ <RunCode code="ed4=ResourceManager.getInstance().loadResourceModule('ThisDoesNotExist.swf')" />
+ <RunCode code="ed4.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <RunCode code="ed4.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <AssertNoEvent target="script:ed4" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Event_ResourceManagerNoErrorEventWithComplete" description="Confirm that loadResourceModule() does not trigger an error event when loading is successful." keywords="[Runtime Localization,loadResourceModule]" >
+ <setup>
+ <RunCode code="clearAllLocaleData()" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="0" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().localeChain.length" value="0" />
+ </setup>
+ <body>
+ <RunCode code="ed5=ResourceManager.getInstance().loadResourceModule('assets/bundles/framework/resMod_events_003.swf')" />
+ <RunCode code="ed5.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <RunCode code="ed5.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <AssertEvent target="script:ed5" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <AssertNoEvent target="script:ed5" eventName="error" eventClass="mx.events::ResourceEvent" />
+ </body>
+ </TestCase>
+ </testCases>
+</UnitTester>
Added: incubator/flex/trunk/mustella/tests/resources/ResourceManager/Integration/ResourceManager_Integration_UIComponent_resourcesChanged.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceManager/Integration/ResourceManager_Integration_UIComponent_resourcesChanged.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceManager/Integration/ResourceManager_Integration_UIComponent_resourcesChanged.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceManager/Integration/ResourceManager_Integration_UIComponent_resourcesChanged.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+
+<UnitTester testDir="resources/ResourceManager/Integration/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ResourceManagerApp.mxml">
+
+
+
+ <!-- this set of lines form a template that must be in each unit test -->
+
+ <mx:Script><![CDATA[
+
+ public static function init(o:DisplayObject):void{}
+
+ ]]></mx:Script>
+
+
+
+ <mx:Metadata><![CDATA[
+
+ [Mixin]
+
+ ]]></mx:Metadata>
+
+ <!-- end of set of lines that must be in each unit test -->
+
+
+
+ <mx:Script><![CDATA[
+
+ import assets.classes.TestUIComponent;
+
+ import flash.events.Event;
+
+ import mx.events.ResourceEvent;
+
+ import mx.resources.ResourceManager;
+
+
+
+ public var testUIC:TestUIComponent;
+
+ public var ed:IEventDispatcher;
+
+
+
+ private function addTestUIComponent():void{
+
+ testUIC = new TestUIComponent();
+
+ application.addChild(testUIC);
+
+ }
+
+
+
+ private function handleCompleteEvent(e:ResourceEvent):void{trace("handleCompleteEvent");}
+
+
+
+ ]]></mx:Script>
+
+
+
+ <testCases>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_Integration_UIComponent_resourcesChanged_update" description="Override the resourcesChanged method of a custom UIComponent class and be sure it is called after update() is called." keywords="[Runtime Localization,ResourceManager,resourcesChanged]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="addTestUIComponent()" />
+
+ <AssertEvent target="script:application" eventClass="mx.events::FlexEvent" eventName="updateComplete" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().update()" />
+
+ <AssertEvent target="script:testUIC" eventClass="flash.events::Event" eventName="TestUIComponent_resourcesChangedCalled" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <!--
+
+ Note: These next two work by calling update(), which was just tested above. But test anyway to be a little paranoid.
+
+ -->
+
+ <TestCase frequency="all" testID="ResourceManager_Integration_UIComponent_resourcesChanged_loadResourceModule" description="Override the resourcesChanged method of a custom UIComponent class and be sure it is called after loadResourceModule() is called." keywords="[Runtime Localization,ResourceManager,resourcesChanged]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="addTestUIComponent()" />
+
+ <AssertEvent target="script:application" eventClass="mx.events::FlexEvent" eventName="updateComplete" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ed = ResourceManager.getInstance().loadResourceModule('assets/bundles/framework/resMod_framework_jaJP,frFR,deDE.swf')" />
+
+ <RunCode code="ed.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+
+ <AssertEvent target="script:ed" eventName="complete" eventClass="mx.events::ResourceEvent" />
+
+ <AssertEvent target="script:testUIC" eventClass="flash.events::Event" eventName="TestUIComponent_resourcesChangedCalled" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <!-- Be sure to load a resource module swf so we do not RTE when messing with the locale chain! -->
+
+ <TestCase frequency="all" testID="ResourceManager_Integration_UIComponent_resourcesChanged_localeChain" description="Override the resourcesChanged method of a custom UIComponent class and be sure it is called when the locale chain is modified." keywords="[Runtime Localization,ResourceManager,resourcesChanged]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="addTestUIComponent()" />
+
+ <AssertEvent target="script:application" eventClass="mx.events::FlexEvent" eventName="updateComplete" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ed = ResourceManager.getInstance().loadResourceModule('assets/bundles/framework/resMod_framework_jaJP,frFR,deDE_02.swf')" />
+
+ <RunCode code="ed.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+
+ <AssertEvent target="script:ed" eventName="complete" eventClass="mx.events::ResourceEvent" />
+
+ <AssertEvent target="script:testUIC" eventClass="flash.events::Event" eventName="TestUIComponent_resourcesChangedCalled" numExpectedEvents="-1" />
+
+ <RunCode code="ResourceManager.getInstance().localeChain=['ja_JP']" />
+
+ <AssertEvent target="script:testUIC" eventClass="flash.events::Event" eventName="TestUIComponent_resourcesChangedCalled" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ </testCases>
+
+</UnitTester>