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 [8/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/ResourceManager/Methods/ResourceManager_Methods_getUint.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_getUint.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_getUint.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_getUint.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,397 @@
+<?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/Methods/" 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.IResourceManager;
+ import mx.resources.ResourceManager;
+
+ private var resourceManager:IResourceManager = ResourceManager.getInstance();
+
+ public function testGetUint(key:String, expectedValue:uint, locale:String = null):Boolean
+ {
+ return resourceManager.getUint('myResources', key, locale) === expectedValue;
+ }
+
+ ]]></mx:Script>
+
+ <testCases>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_NO_SUCH_KEY" description="Tests that the getUint() method of ResourceManager throws an Error when accessing a non-existent resource" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('NO_SUCH_KEY', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING" description="Tests the getUint() method of ResourceManager for a resource value which is a typical String" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_LIST" description="Tests the getUint() method of ResourceManager for a resource value which is a typical String of comma-separated items" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_LIST', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_EMPTY" description="Tests the getUint() method of ResourceManager for a resource value which is an empty String" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_EMPTY', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_NULL" description="Tests the getUint() method of ResourceManager for a resource value which is the String 'null'" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_NULL', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_UNDEFINED" description="Tests the getUint() method of ResourceManager for a resource value which is the String 'undefined'" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_UNDEFINED', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_TRUE_LOWERCASE" description="Tests the getUint() method of ResourceManager for a resource value which is the String 'true'" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_TRUE_LOWERCASE', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_TRUE_MIXEDCASE" description="Tests the getUint() method of ResourceManager for a resource value which is the String 'True'" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_TRUE_MIXEDCASE', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_TRUE_UPPERCASE" description="Tests the getUint() method of ResourceManager for a resource value which is the String 'TRUE'" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_TRUE_UPPERCASE', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_FALSE_LOWERCASE" description="Tests the getUint() method of ResourceManager for a resource value which is the String 'false'" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_FALSE_LOWERCASE', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_FALSE_MIXEDCASE" description="Tests the getUint() method of ResourceManager for a resource value which is the String 'False'" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_FALSE_MIXEDCASE', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_FALSE_UPPERCASE" description="Tests the getUint() method of ResourceManager for a resource value which is the String 'FALSE'" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_FALSE_UPPERCASE', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_NAN" description="Tests the getUint() method of ResourceManager for a resource value which is the String 'NaN'" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_NAN', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_ZERO" description="Tests the getUint() method of ResourceManager for a resource value which is the String '0'" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_ZERO', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_POSITIVE_INTEGER" description="Tests the getUint() method of ResourceManager for a resource value which is the String rep of a typical positive integer" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_POSITIVE_INTEGER', 3)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_NEGATIVE_INTEGER" description="Tests the getUint() method of ResourceManager for a resource value which is the String rep of a typical negative integer" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_NEGATIVE_INTEGER', 4294967293)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_FIXEDPOINT" description="Tests the getUint() method of ResourceManager for a resource value which is the String rep of a typical fractional Number" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_FIXEDPOINT', 1)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_STRING_FLOATINGPOINT" description="Tests the getUint() method of ResourceManager for a resource value which is the String rep of a typical fractional Number in exponential notation" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('STRING_FLOATINGPOINT', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_NULL" description="Tests the getUint() method of ResourceManager for a resource value which is null" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('NULL', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_UNDEFINED" description="Tests the getUint() method of ResourceManager for a resource value which is undefined" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('UNDEFINED', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_TRUE" description="Tests the getUint() method of ResourceManager for a resource value which is true" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('TRUE', 1)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_FALSE" description="Tests the getUint() method of ResourceManager for a resource value which is false" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('FALSE', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_NAN" description="Tests the getUint() method of ResourceManager for a resource value which is NaN" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('NAN', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_ZERO" description="Tests the getUint() method of ResourceManager for a resource value which is 0" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('ZERO', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_POSITIVE_INTEGER" description="Tests the getUint() method of ResourceManager for a resource value which is a typical positive integer" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('POSITIVE_INTEGER', 3)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_NEGATIVE_INTEGER" description="Tests the getUint() method of ResourceManager for a resource value which is a typical negative integer" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('NEGATIVE_INTEGER', 4294967293)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_FIXEDPOINT" description="Tests the getUint() method of ResourceManager for a resource value which is a typical fractional Number" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('FIXEDPOINT', 1)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_FLOATINGPOINT" description="Tests the getUint() method of ResourceManager for a resource value which is a typical fractional Number in exponential notation" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('FLOATINGPOINT', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_CLASS" description="Tests the getUint() method of ResourceManager for a resource value which is a Class reference" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('CLASS', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_ARRAY" description="Tests the getUint() method of ResourceManager for a resource value which is an Array of Strings" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('ARRAY', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_OBJECT" description="Tests the getUint() method of ResourceManager for a resource value which is a plain Object" keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <AssertMethodValue method="value=testGetUint('OBJECT', 0)" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_localeParam_firstInLocaleChain_true" description="Tests the getUint() method of ResourceManager for the ability to specify the locale." keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <RunCode code="ResourceManager.getInstance().localeChain=['fr_FR','ja_JP']" />
+ <AssertMethodValue method="value=testGetUint('POSITIVE_INTEGER', 3, 'fr_FR')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_localeParam_notFirstInLocaleChain_true" description="Tests the getUint() method of ResourceManager for the ability to specify the locale." keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <RunCode code="ResourceManager.getInstance().localeChain=['fr_FR','ja_JP']" />
+ <AssertMethodValue method="value=testGetUint('POSITIVE_INTEGER', 2, 'ja_JP')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="ResourceManager_getUint_localeParam_localeMissing" description="Tests the getUint() method of ResourceManager for the ability to specify the locale." keywords="[resources,ResourceManager,getUint]">
+ <setup>
+ <RunCode code="application.setup()"/>
+ </setup>
+ <body>
+ <RunCode code="ResourceManager.getInstance().localeChain=['fr_FR','ja_JP']" />
+ <AssertMethodValue method="value=testGetUint('POSITIVE_INTEGER', 0, 'fu_BR')" value="true"/>
+ <Pause timeout="1"/>
+ </body>
+ </TestCase>
+
+
+ </testCases>
+
+</UnitTester>
+
Added: incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_loadResourceModule.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_loadResourceModule.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_loadResourceModule.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_loadResourceModule.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,373 @@
+<?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/Methods/" 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.controls.Alert;
+ import mx.utils.*;
+ import mx.resources.IResourceManager
+ import mx.resources.ResourceManager;
+ import mx.resources.ResourceBundle;
+ import mx.events.ResourceEvent;
+ import mx.managers.PopUpManager;
+
+ public var rm:IResourceManager = ResourceManager.getInstance();
+ public var curAlert:Alert = null;
+
+ // There is very funky behavior when reusing the same variable for the returned IEventDispatchers. Bug 203869.
+ public var ed1:IEventDispatcher;
+ public var ed2:IEventDispatcher;
+ public var ed3:IEventDispatcher;
+ public var ed4:IEventDispatcher;
+ public var ed5:IEventDispatcher;
+ public var ed6:IEventDispatcher;
+ public var ed7:IEventDispatcher;
+ public var ed8:IEventDispatcher;
+ public var ed9:IEventDispatcher;
+ public var ed10:IEventDispatcher;
+// public var ed11:IEventDispatcher;
+// public var ed12:IEventDispatcher;
+// public var ed13:IEventDispatcher;
+ public var ed14:IEventDispatcher;
+ public var ed15:IEventDispatcher;
+// public var ed16:IEventDispatcher;
+// public var ed17:IEventDispatcher;
+ public var ed18:IEventDispatcher;
+// public var ed19:IEventDispatcher;
+// public var ed20:IEventDispatcher;
+// public var ed21:IEventDispatcher;
+// public var ed22:IEventDispatcher;
+ public var ed23: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]);
+ }
+ }
+
+ // Try calling loadResourceModule and add the event listeners in the same block of AS.
+ // ed15, ed18, and ed23 aren't anything yet, so we can't pass them in, and we can't pass
+ // by reference in Actionscript.
+ private function setUpEventDispatcher(ed:int, url:String):void{
+ var ied:IEventDispatcher;
+
+ switch(ed){
+ case 15:
+ ed15 = ResourceManager.getInstance().loadResourceModule(url);
+ ied = ed15;
+ break;
+ case 18:
+ ed18 = ResourceManager.getInstance().loadResourceModule(url);
+ ied = ed18;
+ break;
+ case 23:
+ ed23 = ResourceManager.getInstance().loadResourceModule(url);
+ ied = ed23;
+ break;
+
+ }
+
+ ied.addEventListener(ResourceEvent.PROGRESS, handleProgressEvent);
+ ied.addEventListener(ResourceEvent.ERROR, handleErrorEvent);
+ ied.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent);
+ }
+
+ 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.
+ - Load bundles, add event listeners (e.g. add an error event listener to avoid RTEs, which slow down mustella) for setup.
+ </setup>
+ <body>
+ - Verify.
+ </body>
+-->
+
+ <testCases>
+ <TestCase frequency="all" testID="RTL_Method_loadResourceModule_ReturnType" description="Confirm that loadResourceModule returns the correct type." 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>
+ <AssertMethodValue method="value=ResourceManager.getInstance().loadResourceModule('assets/bundles/custom/resMod_loadResourceModule_enUS_bundle1_001.swf') is IEventDispatcher" value="true" />
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Method_loadResourceModule_OneLocaleOneBundle" description="Be sure loadResourceModule loads the locale and resources for a bundle." 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" />
+ <RunCode code="ResourceManager.getInstance().localeChain=['en_US']" />
+ </setup>
+ <body>
+ <RunCode code="ed1=ResourceManager.getInstance().loadResourceModule('assets/bundles/custom/resMod_loadResourceModule_enUS_bundle1_002.swf')" />
+ <RunCode code="ed1.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <RunCode code="ed1.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed1" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="1" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales()[0]" value="en_US" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1','SHUTDOWN')" value="Shut down" />
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Method_loadResourceModule_OneLocaleThreeBundles" description="Be sure loadResourceModule loads the locale and resources for three bundles." 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" />
+ <RunCode code="ResourceManager.getInstance().localeChain=['en_US']" />
+ </setup>
+ <body>
+ <RunCode code="ed8=ResourceManager.getInstance().loadResourceModule('assets/bundles/custom/resMod_loadResourceModule_enUS_bundles1,2,3_001.swf')" />
+ <RunCode code="ed8.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <RunCode code="ed8.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed8" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="1" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales()[0]" value="en_US" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1','SHUTDOWN')" value="Shut down" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle2','BUNDLETWOSTRING')" value="BundleTwoString, en_US" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle3','BUNDLETHREESTRING')" value="BundleThreeString, en_US" />
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Method_loadResourceModule_SameLocaleAdditionalBundle" description="Be sure loadResourceModule works correctly when adding a bundle to an existing locale." 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" />
+ <RunCode code="ResourceManager.getInstance().localeChain=['en_US']" />
+ </setup>
+ <body>
+ <RunCode code="ed2=ResourceManager.getInstance().loadResourceModule('assets/bundles/custom/resMod_loadResourceModule_enUS_bundle1_003.swf')" />
+ <RunCode code="ed2.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <RunCode code="ed2.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed2" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <RunCode code="ed3=ResourceManager.getInstance().loadResourceModule('assets/bundles/custom/resMod_loadResourceModule_enUS_bundles1,2,3_002.swf')" />
+ <RunCode code="ed3.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <RunCode code="ed3.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed3" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="1" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales()[0]" value="en_US" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1','SHUTDOWN')" value="Shut down" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle2','BUNDLETWOSTRING')" value="BundleTwoString, en_US" />
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Method_loadResourceModule_SameLocaleSameBundle" description="Be sure loadResourceModule works correctly when adding resources to an existing locale and bundle. Note that in this case, no additional information should be added to a bundle in a locale which is already present." 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" />
+ <RunCode code="ResourceManager.getInstance().localeChain=['en_US']" />
+ </setup>
+ <body>
+ <RunCode code="ed4=ResourceManager.getInstance().loadResourceModule('assets/bundles/custom/resMod_loadResourceModule_enUS_bundle1_004.swf')" />
+ <RunCode code="ed4.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <RunCode code="ed4.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed4" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <RunCode code="ed5=ResourceManager.getInstance().loadResourceModule('assets/bundles/custom2/resMod_loadResourceModule_enUS_bundle1_005.swf')" />
+ <RunCode code="ed5.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <RunCode code="ed5.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed5" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="1" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales()[0]" value="en_US" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1','SHUTDOWN')" value="Shut down" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1', 'SHUTDOWN2')" valueExpression="value=null" />
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Method_loadResourceModule_AdditionalLocale1Bundle" description="Be sure loadResourceModule works correctly when adding one additional locale with one new bundle." 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" />
+ <RunCode code="ResourceManager.getInstance().localeChain=['en_US','fr_FR']" />
+ </setup>
+ <body>
+ <RunCode code="ed6=ResourceManager.getInstance().loadResourceModule('assets/bundles/custom/resMod_loadResourceModule_enUS_bundle1_006.swf')" />
+ <RunCode code="ed6.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <RunCode code="ed6.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed6" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <RunCode code="ed7=ResourceManager.getInstance().loadResourceModule('assets/bundles/custom/resMod_loadResourceModule_frFR_bundle2.swf')" />
+ <RunCode code="ed7.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <RunCode code="ed7.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed7" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="2" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('en_US') != -1" value="true" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('fr_FR') != -1" value="true" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1','SHUTDOWN')" value="Shut down" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle2','BUNDLETWOSTRING')" value="BundleTwoString, fr_FR" />
+ </body>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Method_loadResourceModule_AdditionalLocales3Bundles" description="Be sure loadResourceModule works correctly when adding two additional locales and two additional bundles." 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" />
+ <RunCode code="ResourceManager.getInstance().localeChain=['en_US','fr_FR','ja_JP']" />
+ </setup>
+ <body>
+ <RunCode code="ed9=ResourceManager.getInstance().loadResourceModule('assets/bundles/custom/resMod_loadResourceModule_enUS_bundle1_007.swf')" />
+ <RunCode code="ed9.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <RunCode code="ed9.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed9" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <RunCode code="ed10=ResourceManager.getInstance().loadResourceModule('assets/bundles/custom/resMod_loadResourceModule_enUS,frFR,jaJP_bundles1,2,3.swf')" />
+ <RunCode code="ed10.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <RunCode code="ed10.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed10" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="3" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('en_US') != -1" value="true" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('fr_FR') != -1" value="true" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('ja_JP') != -1" value="true" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1','SHUTDOWN')" value="Shut down" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle2','BUNDLETWOSTRING')" value="BundleTwoString, en_US" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle3','BUNDLETHREESTRING')" value="BundleThreeString, en_US" />
+ <RunCode code="ResourceManager.getInstance().localeChain=['fr_FR','en_US','ja_JP']" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1','SHUTDOWN')" value="Arrêté" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle2','BUNDLETWOSTRING')" value="BundleTwoString, fr_FR" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle3','BUNDLETHREESTRING')" value="BundleThreeString, fr_FR" />
+ <RunCode code="ResourceManager.getInstance().localeChain=['ja_JP','fr_FR','en_US']" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1','SHUTDOWN')" value="ã·ã£ãããã¦ã³ããã¦ãã¾ã" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle2','BUNDLETWOSTRING')" value="BundleTwoString, ja_JP" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle3','BUNDLETHREESTRING')" value="BundleThreeString, ja_JP" />
+ </body>
+ </TestCase>
+
+<!--
+ These next four are excluded - bug SDK-9607
+-->
+ <TestCase frequency="all" testID="RTL_Method_loadResourceModule_OneFrameworkLocale" description="Test using loadResourceModule() to load one framework locale (Japanese)." 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="ed14=ResourceManager.getInstance().loadResourceModule('assets/bundles/framework/resMod_loadResourceModule_jaJP_framework.swf')" />
+ <RunCode code="ed14.addEventListener(ResourceEvent.ERROR, handleErrorEvent)" />
+ <RunCode code="ed14.addEventListener(ResourceEvent.COMPLETE, handleCompleteEvent)" />
+ <AssertEvent target="script:ed14" eventName="complete" eventClass="mx.events::ResourceEvent" />
+
+ <RunCode code="ResourceManager.getInstance().localeChain=['ja_JP']" />
+ <RunCode code="curAlert=Alert.show('The buttons should be in Japanese.', 'Alert Test', mx.controls.Alert.YES|mx.controls.Alert.NO)" />
+ <WaitForEffectsToEnd />
+ <AssertPropertyValue target="script:curAlert.mx_internal:alertForm.mx_internal:buttons.0" propertyName="label" value="ã¯ã" />
+ </body>
+ <cleanup>
+ <DispatchKeyEvent key="TAB" />
+ <DispatchKeyEvent key="ESCAPE" />
+ <WaitForEffectsToEnd />
+ </cleanup>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Method_loadResourceModule_SeveralFrameworkLocales_1of3" description="Test using loadResourceModule() to load multiple framework locales (Japanese, French, German)." 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" />
+ <RunCode code="ResourceManager.getInstance().localeChain=['ja_JP','fr_FR','de_DE']" />
+ </setup>
+ <body>
+ <RunCode code="setUpEventDispatcher(15, 'assets/bundles/framework/resMod_loadResourceModule_jaJP,frFR,deDE_framework_001.swf')" />
+ <AssertEvent target="script:ed15" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <RunCode code="curAlert=Alert.show('The buttons should be in Japanese.', 'Alert Test', mx.controls.Alert.YES|mx.controls.Alert.NO)" />
+ <WaitForEffectsToEnd />
+ <AssertPropertyValue target="script:curAlert.mx_internal:alertForm.mx_internal:buttons.0" propertyName="label" value="ã¯ã" />
+ </body>
+ <cleanup>
+ <DispatchKeyEvent key="TAB" />
+ <DispatchKeyEvent key="ESCAPE" />
+ <WaitForEffectsToEnd />
+ </cleanup>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Method_loadResourceModule_SeveralFrameworkLocales_2of3" description="Test using loadResourceModule() to load multiple framework locales (Japanese, French, German)." keywords="[Runtime Localization,loadResourceModule]" >
+ <setup>
+ <RunCode code="curAlert=null" />
+ <RunCode code="clearAllLocaleData()" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="0" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().localeChain.length" value="0" />
+ <RunCode code="ResourceManager.getInstance().localeChain=['fr_FR','de_DE','ja_JP']" />
+ </setup>
+ <body>
+ <RunCode code="setUpEventDispatcher(18, 'assets/bundles/framework/resMod_loadResourceModule_jaJP,frFR,deDE_framework_002.swf')" />
+ <AssertEvent target="script:ed18" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <RunCode code="curAlert=Alert.show('The buttons should be in French.', 'Alert Test', mx.controls.Alert.YES|mx.controls.Alert.NO)" />
+ <WaitForEffectsToEnd />
+ <AssertPropertyValue target="script:curAlert.mx_internal:alertForm.mx_internal:buttons.0" propertyName="label" value="FYes" />
+ </body>
+ <cleanup>
+ <RunCode code="PopUpManager.removePopUp(curAlert)" />
+ <WaitForEffectsToEnd />
+ </cleanup>
+ </TestCase>
+
+ <TestCase frequency="all" testID="RTL_Method_loadResourceModule_SeveralFrameworkLocales_3of3" description="Test using loadResourceModule() to load multiple framework locales (Japanese, French, German)." keywords="[Runtime Localization,loadResourceModule]" >
+ <setup>
+ <RunCode code="curAlert=null" />
+ <RunCode code="clearAllLocaleData()" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="0" />
+ <AssertMethodValue method="value=ResourceManager.getInstance().localeChain.length" value="0" />
+ <RunCode code="ResourceManager.getInstance().localeChain=['de_DE','fr_FR','ja_JP']" />
+ </setup>
+ <body>
+ <RunCode code="setUpEventDispatcher(23, 'assets/bundles/framework/resMod_loadResourceModule_jaJP,frFR,deDE_framework_003.swf')" />
+ <AssertEvent target="script:ed23" eventName="complete" eventClass="mx.events::ResourceEvent" />
+ <RunCode code="curAlert=Alert.show('The buttons should be in German.', 'Alert Test', mx.controls.Alert.YES|mx.controls.Alert.NO)" />
+ <WaitForEffectsToEnd />
+ <AssertPropertyValue target="script:curAlert.mx_internal:alertForm.mx_internal:buttons.0" propertyName="label" value="GYes" />
+ </body>
+ <cleanup>
+ <DispatchKeyEvent key="TAB" />
+ <DispatchKeyEvent key="ESCAPE" />
+ <WaitForEffectsToEnd />
+ </cleanup>
+ </TestCase>
+
+ </testCases>
+</UnitTester>
Added: incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_removeResourceBundle.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_removeResourceBundle.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_removeResourceBundle.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_removeResourceBundle.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,369 @@
+<?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/Methods/" 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.IResourceManager;
+
+ import mx.resources.ResourceBundle;
+
+ import mx.resources.IResourceBundle;
+
+ ]]></mx:Script>
+
+
+
+ <testCases>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundle_1Locale1Bundle" description="Use removeResourceBundle() to remove the only bundle from a locale. Be sure the bundle is removed, the locale is removed, and the locale chain is untouched." keywords="[Runtime Localization,ResourceManager,removeResourceBundle]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ <RunCode code="ResourceManager.getInstance().localeChain=['fr_FR']" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundle('fr_FR', 'bundle1')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').length" value="0" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="0" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().localeChain.toString()" value="fr_FR" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundle_1Locale3Bundles_Remove1st" description="Use removeResourceBundle() to remove the 1st of three bundles for a locale." keywords="[Runtime Localization,ResourceManager,removeResourceBundle]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle2')" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle3')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundle('fr_FR', 'bundle1')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').length" value="2" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').indexOf('bundle1')" value="-1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').indexOf('bundle2') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').indexOf('bundle3') != -1" value="true" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundle_1Locale3Bundles_Remove2nd" description="Use removeResourceBundle() to remove the 2nd of three bundles for a locale." keywords="[Runtime Localization,ResourceManager,removeResourceBundle]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle2')" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle3')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundle('fr_FR', 'bundle2')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').length" value="2" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').indexOf('bundle2')" value="-1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').indexOf('bundle1') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').indexOf('bundle3') != -1" value="true" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundle_1Locale3Bundles_Remove3rd" description="Use removeResourceBundle() to remove the 3rd of three bundles for a locale." keywords="[Runtime Localization,ResourceManager,removeResourceBundle]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle2')" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle3')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundle('fr_FR', 'bundle3')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').length" value="2" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').indexOf('bundle3')" value="-1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').indexOf('bundle1') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').indexOf('bundle2') != -1" value="true" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundle_3LocalesVariousBundles_RemoveOnlyBundleFromOne" description="Be sure removeResourceBundle() removes from the correct locale when there are several." keywords="[Runtime Localization,ResourceManager,removeResourceBundle]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1_frFR')" />
+
+ <RunCode code="application.doAddResourceBundle('ja_JP', 'bundle1_jaJP')" />
+
+ <RunCode code="application.doAddResourceBundle('ja_JP', 'bundle2_jaJP')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle1_deDE')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle2_deDE')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle3_deDE')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundle('fr_FR', 'bundle1_frFR')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="2" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('fr_FR')" value="-1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('ja_JP') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('de_DE') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('ja_JP').length" value="2" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('ja_JP').indexOf('bundle1_jaJP') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('ja_JP').indexOf('bundle2_jaJP') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('de_DE').length" value="3" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('de_DE').indexOf('bundle1_deDE') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('de_DE').indexOf('bundle2_deDE') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('de_DE').indexOf('bundle3_deDE') != -1" value="true" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundle_3LocalesVariousBundles_RemoveOneOfSeveralFromOne" description="Be sure removeResourceBundle() removes from the correct locale when there are several." keywords="[Runtime Localization,ResourceManager,removeResourceBundle]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1_frFR')" />
+
+ <RunCode code="application.doAddResourceBundle('ja_JP', 'bundle1_jaJP')" />
+
+ <RunCode code="application.doAddResourceBundle('ja_JP', 'bundle2_jaJP')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle1_deDE')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle2_deDE')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle3_deDE')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundle('de_DE', 'bundle2_deDE')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="3" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('fr_FR') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('ja_JP') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('fr_FR') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').length" value="1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').indexOf('bundle1_frFR') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('ja_JP').length" value="2" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('ja_JP').indexOf('bundle1_jaJP') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('ja_JP').indexOf('bundle2_jaJP') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('de_DE').length" value="2" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('de_DE').indexOf('bundle1_deDE') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('de_DE').indexOf('bundle2_deDE')" value="-1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('de_DE').indexOf('bundle3_deDE') != -1" value="true" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundle_NonexistantBundle" description="Call removeResourceBundle() for a nonexistant bundle." keywords="[Runtime Localization,ResourceManager,removeResourceBundle]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundle('fr_FR', 'bundle2')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').length" value="1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR')[0]" value="bundle1" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundle_NonexistantLocale" description="Call removeResourceBundle() for a nonexistant locale." keywords="[Runtime Localization,ResourceManager,removeResourceBundle]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ </setup>
+
+ <body>
+
+ <AssertMethodValue method="try{ ResourceManager.getInstance().removeResourceBundle('aa_BB', 'bundle1'); } catch(e:Error){ value=e.message; }" value="Error #1010: A term is undefined and has no properties." />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').length" value="1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR')[0]" value="bundle1" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <!--
+
+ Call this mainly to be sure something crazy doesn't happen.
+
+ -->
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundle_NoLocalesPresent" description="Call removeResourceBundle() when there are no locales." keywords="[Runtime Localization,ResourceManager,removeResourceBundle]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ </setup>
+
+ <body>
+
+ <AssertMethodValue method="try{ ResourceManager.getInstance().removeResourceBundle('fr_FR', 'bundle1'); } catch(e:Error){ value=e.message; }" value="Error #1010: A term is undefined and has no properties." />
+
+ </body>
+
+ </TestCase>
+
+
+
+ </testCases>
+
+</UnitTester>
Added: incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_removeResourceBundlesForLocale.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_removeResourceBundlesForLocale.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_removeResourceBundlesForLocale.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_removeResourceBundlesForLocale.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,231 @@
+<?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/Methods/" 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.IResourceManager;
+
+ import mx.resources.ResourceBundle;
+
+ import mx.resources.IResourceBundle;
+
+ ]]></mx:Script>
+
+
+
+ <testCases>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundlesForLocale_1Locale" description="Call removeResourceBundlesForLocale() when there is one locale." keywords="[Runtime Localization,ResourceManager,removeResourceBundlesForLocale]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundlesForLocale('fr_FR')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="0" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundlesForLocale_3Locales_1" description="Call removeResourceBundlesForLocale() to remove the first of three locales." keywords="[Runtime Localization,ResourceManager,removeResourceBundlesForLocale]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('ja_JP', 'bundle1')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundlesForLocale('fr_FR')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="2" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('fr_FR')" value="-1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('de_DE') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('ja_JP') != -1" value="true" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundlesForLocale_3Locales_2" description="Call removeResourceBundlesForLocale() to remove the last of three locales." keywords="[Runtime Localization,ResourceManager,removeResourceBundlesForLocale]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('ja_JP', 'bundle1')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundlesForLocale('ja_JP')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="2" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('ja_JP')" value="-1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('fr_FR') != -1" value="true" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().indexOf('de_DE') != -1" value="true" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundlesForLocale_3Locales_3" description="Call removeResourceBundlesForLocale() to remove all locales when several are present." keywords="[Runtime Localization,ResourceManager,removeResourceBundlesForLocale]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('ja_JP', 'bundle1')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundlesForLocale('fr_FR')" />
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundlesForLocale('de_DE')" />
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundlesForLocale('ja_JP')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="0" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundlesForLocale_NonexistantLocale" description="Call removeResourceBundlesForLocale() for a locale which does not exist." keywords="[Runtime Localization,ResourceManager,removeResourceBundlesForLocale]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundlesForLocale('aa_BB')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales().length" value="1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getLocales()[0]" value="fr_FR" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_removeResourceBundlesForLocale_RecreatedLocale" description="Call removeResourceBundlesForLocale(), re-add the locale, and be sure the old values are not hanging around." keywords="[Runtime Localization,ResourceManager,removeResourceBundlesForLocale]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ </setup>
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().removeResourceBundlesForLocale('fr_FR')" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle2')" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR').length" value="1" />
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getBundleNamesForLocale('fr_FR')[0]" value="bundle2" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ </testCases>
+
+</UnitTester>
Added: incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_update.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_update.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_update.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_update.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,81 @@
+<?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/Methods/" 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.IResourceManager;
+
+
+
+ public var rm:IResourceManager = ResourceManager.getInstance();
+
+
+
+ ]]></mx:Script>
+
+
+
+ <testCases>
+
+
+
+ <TestCase frequency="all" testID="RTL_ResourceManager_Method_update" description="Be sure update() dispatches the appropriate event." keywords="[Runtime Localization,ResourceManager,update]" >
+
+ <body>
+
+ <RunCode code="ResourceManager.getInstance().update()" />
+
+ <AssertEvent target="script:rm" eventName="change" eventClass="flash.events::Event" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ </testCases>
+
+</UnitTester>
Added: incubator/flex/trunk/mustella/tests/resources/ResourceManager/Properties/ResourceManager_Properties_localeChain.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/resources/ResourceManager/Properties/ResourceManager_Properties_localeChain.mxml?rev=1370380&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/resources/ResourceManager/Properties/ResourceManager_Properties_localeChain.mxml (added)
+++ incubator/flex/trunk/mustella/tests/resources/ResourceManager/Properties/ResourceManager_Properties_localeChain.mxml Tue Aug 7 17:34:13 2012
@@ -0,0 +1,240 @@
+<?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/Properties/" 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.IResourceManager;
+
+ import mx.resources.ResourceBundle;
+
+ import mx.resources.IResourceBundle;
+
+
+
+ public var rm:IResourceManager = ResourceManager.getInstance();
+
+
+
+ ]]></mx:Script>
+
+
+
+ <testCases>
+
+
+
+ <!-- A few setter/getter tests. Yes, we go beyond this further down! -->
+
+ <TestCase frequency="all" testID="ResourceManager_Property_localeChain_null" description="Setter/getter for null localeChain." keywords="[Runtime Localization,ResourceManager,localeChain]" >
+
+ <body>
+
+ <SetProperty target="script:rm" propertyName="localeChain" valueExpression="value=null" />
+
+ <AssertPropertyValue target="script:rm" propertyName="localeChain" valueExpression="value=null" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_Property_localeChain_empty" description="Setter/getter for empty localeChain." keywords="[Runtime Localization,ResourceManager,localeChain]" >
+
+ <body>
+
+ <SetProperty target="script:rm" propertyName="localeChain" valueExpression="value=[]" />
+
+ <AssertPropertyValue target="script:rm.localeChain" propertyName="length" value="0" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_Property_localeChain_valid" description="Setter/getter for valid locale chain." keywords="[Runtime Localization,ResourceManager,localeChain]" >
+
+ <body>
+
+ <SetProperty target="script:rm" propertyName="localeChain" valueExpression="value=['fr_FR','en_US','ja_JP']" />
+
+ <AssertPropertyValue target="script:rm.localeChain" propertyName="length" value="3" />
+
+ <AssertMethodValue method="value = ResourceManager.getInstance().localeChain.indexOf('fr_FR') != -1" value="true" />
+
+ <AssertMethodValue method="value = ResourceManager.getInstance().localeChain.indexOf('en_US') != -1" value="true" />
+
+ <AssertMethodValue method="value = ResourceManager.getInstance().localeChain.indexOf('ja_JP') != -1" value="true" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <!-- Basic functionality -->
+
+ <TestCase frequency="all" testID="ResourceManager_Property_localeChain_TriggersChangeEvent" description="Changing the localeChain triggers a change event" keywords="[Runtime Localization,ResourceManager,localeChain]" >
+
+ <body>
+
+ <SetProperty target="script:rm" propertyName="localeChain" value="['fr_FR']" />
+
+ <AssertEvent target="script:rm" eventName="change" eventClass="flash.events::Event" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_Property_localeChain_NoFallThrough" description="Ensure that a resource is retrieved from the first item in the locale chain." keywords="[Runtime Localization,ResourceManager,localeChain]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle1')" />
+
+ <RunCode code="ResourceManager.getInstance().localeChain = ['de_DE','fr_FR']" />
+
+ </setup>
+
+ <body>
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1', 'OPEN')" value="de_DE_bundle1_Open" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_Property_localeChain_FallThrough_BundleMissing" description="" keywords="[Runtime Localization,ResourceManager,localeChain]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle2')" />
+
+ <RunCode code="ResourceManager.getInstance().localeChain = ['fr_FR', 'de_DE']" />
+
+ </setup>
+
+ <body>
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle2', 'OPEN')" value="de_DE_bundle2_Open" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_Property_localeChain_FallThrough_ResourceMissing" description="" keywords="[Runtime Localization,ResourceManager,localeChain]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1', false)" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle1')" />
+
+ <RunCode code="ResourceManager.getInstance().localeChain = ['fr_FR', 'de_DE']" />
+
+ </setup>
+
+ <body>
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1', 'CLOSE')" value="de_DE_bundle1_Close" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ <TestCase frequency="all" testID="ResourceManager_Property_localeChain_NoFallThrough_ResourcePresentButEmpty" description="" keywords="[Runtime Localization,ResourceManager,localeChain]" >
+
+ <setup>
+
+ <RunCode code="application.clearLocales()" />
+
+ <RunCode code="application.doAddResourceBundle('fr_FR', 'bundle1')" />
+
+ <RunCode code="application.doAddResourceBundle('de_DE', 'bundle1')" />
+
+ <RunCode code="ResourceManager.getInstance().getResourceBundle('fr_FR', 'bundle1').content['GREETING']=''" />
+
+ <RunCode code="ResourceManager.getInstance().getResourceBundle('de_DE', 'bundle1').content['GREETING']='Hello'" />
+
+ <RunCode code="ResourceManager.getInstance().localeChain = ['fr_FR', 'de_DE']" />
+
+ </setup>
+
+ <body>
+
+ <AssertMethodValue method="value=ResourceManager.getInstance().getString('bundle1', 'GREETING')" value="" />
+
+ </body>
+
+ </TestCase>
+
+
+
+ </testCases>
+
+</UnitTester>
+