blob: 7e72443c591c136088bc3fe3d3f3dfd2c87bb1be [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/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')" errorArray="['TypeError: Error #1006:']"/>
<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')" errorArray="['TypeError: Error #1006:']"/>
<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')" errorArray="['TypeError: Error #1006:']"/>
<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')" errorArray="['TypeError: Error #1006:']"/>
<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')" errorArray="['TypeError: Error #1006:']"/>
<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')" errorArray="['TypeError: Error #1006:']"/>
<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')" errorArray="['TypeError: Error #1006:']"/>
<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')" errorArray="['TypeError: Error #1006:']"/>
<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>