blob: 7ba3989906cc42dd47fc8ad12d836ff43a89df7e [file] [log] [blame]
<?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 testGetInt(key:String, expectedValue:int, locale:String = null):Boolean
{
return resourceManager.getInt('myResources', key, locale) === expectedValue;
}
]]></mx:Script>
<testCases>
<TestCase frequency="all" testID="ResourceManager_getInt_NO_SUCH_KEY" description="Tests that the getInt() method of ResourceManager throws an Error when accessing a non-existent resource" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('NO_SUCH_KEY', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING" description="Tests the getInt() method of ResourceManager for a resource value which is a typical String" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_LIST" description="Tests the getInt() method of ResourceManager for a resource value which is a typical String of comma-separated items" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_LIST', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_EMPTY" description="Tests the getInt() method of ResourceManager for a resource value which is an empty String" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_EMPTY', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_NULL" description="Tests the getInt() method of ResourceManager for a resource value which is the String 'null'" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_NULL', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_UNDEFINED" description="Tests the getInt() method of ResourceManager for a resource value which is the String 'undefined'" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_UNDEFINED', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_TRUE_LOWERCASE" description="Tests the getInt() method of ResourceManager for a resource value which is the String 'true'" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_TRUE_LOWERCASE', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_TRUE_MIXEDCASE" description="Tests the getInt() method of ResourceManager for a resource value which is the String 'True'" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_TRUE_MIXEDCASE', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_TRUE_UPPERCASE" description="Tests the getInt() method of ResourceManager for a resource value which is the String 'TRUE'" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_TRUE_UPPERCASE', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_FALSE_LOWERCASE" description="Tests the getInt() method of ResourceManager for a resource value which is the String 'false'" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_FALSE_LOWERCASE', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_FALSE_MIXEDCASE" description="Tests the getInt() method of ResourceManager for a resource value which is the String 'False'" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_FALSE_MIXEDCASE', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_FALSE_UPPERCASE" description="Tests the getInt() method of ResourceManager for a resource value which is the String 'FALSE'" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_FALSE_UPPERCASE', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_NAN" description="Tests the getInt() method of ResourceManager for a resource value which is the String 'NaN'" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_NAN', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_ZERO" description="Tests the getInt() method of ResourceManager for a resource value which is the String '0'" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_ZERO', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_POSITIVE_INTEGER" description="Tests the getInt() method of ResourceManager for a resource value which is the String rep of a typical positive integer" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_POSITIVE_INTEGER', 3)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_NEGATIVE_INTEGER" description="Tests the getInt() method of ResourceManager for a resource value which is the String rep of a typical negative integer" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_NEGATIVE_INTEGER', -3)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_FIXEDPOINT" description="Tests the getInt() method of ResourceManager for a resource value which is the String rep of a typical fractional Number" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_FIXEDPOINT', 1)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_STRING_FLOATINGPOINT" description="Tests the getInt() method of ResourceManager for a resource value which is the String rep of a typical fractional Number in exponential notation" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('STRING_FLOATINGPOINT', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_NULL" description="Tests the getInt() method of ResourceManager for a resource value which is null" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('NULL', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_UNDEFINED" description="Tests the getInt() method of ResourceManager for a resource value which is undefined" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('UNDEFINED', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_TRUE" description="Tests the getInt() method of ResourceManager for a resource value which is true" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('TRUE', 1)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_FALSE" description="Tests the getInt() method of ResourceManager for a resource value which is false" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('FALSE', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_NAN" description="Tests the getInt() method of ResourceManager for a resource value which is NaN" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('NAN', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_ZERO" description="Tests the getInt() method of ResourceManager for a resource value which is 0" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('ZERO', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_POSITIVE_INTEGER" description="Tests the getInt() method of ResourceManager for a resource value which is a typical positive integer" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('POSITIVE_INTEGER', 3)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_NEGATIVE_INTEGER" description="Tests the getInt() method of ResourceManager for a resource value which is a typical negative integer" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('NEGATIVE_INTEGER', -3)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_FIXEDPOINT" description="Tests the getInt() method of ResourceManager for a resource value which is a typical fractional Number" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('FIXEDPOINT', 1)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_FLOATINGPOINT" description="Tests the getInt() method of ResourceManager for a resource value which is a typical fractional Number in exponential notation" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('FLOATINGPOINT', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_CLASS" description="Tests the getInt() method of ResourceManager for a resource value which is a Class reference" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('CLASS', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_ARRAY" description="Tests the getInt() method of ResourceManager for a resource value which is an Array of Strings" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('ARRAY', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_OBJECT" description="Tests the getInt() method of ResourceManager for a resource value which is a plain Object" keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<AssertMethodValue method="value=testGetInt('OBJECT', 0)" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_localeParam_firstInLocaleChain_true" description="Tests the getInt() method of ResourceManager for the ability to specify the locale." keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<RunCode code="ResourceManager.getInstance().localeChain=['fr_FR','ja_JP']" />
<AssertMethodValue method="value=testGetInt('POSITIVE_INTEGER', 3, 'fr_FR')" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_localeParam_notFirstInLocaleChain_true" description="Tests the getInt() method of ResourceManager for the ability to specify the locale." keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<RunCode code="ResourceManager.getInstance().localeChain=['fr_FR','ja_JP']" />
<AssertMethodValue method="value=testGetInt('POSITIVE_INTEGER', 2, 'ja_JP')" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
<TestCase frequency="all" testID="ResourceManager_getInt_localeParam_localeMissing" description="Tests the getInt() method of ResourceManager for the ability to specify the locale." keywords="[resources,ResourceManager,getInt]">
<setup>
<RunCode code="application.setup()"/>
</setup>
<body>
<RunCode code="ResourceManager.getInstance().localeChain=['fr_FR','ja_JP']" />
<AssertMethodValue method="value=testGetInt('POSITIVE_INTEGER', 0, 'fu_BR')" value="true"/>
<Pause timeout="1"/>
</body>
</TestCase>
</testCases>
</UnitTester>