| <?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="spark/formatters/NumberFormatter/Properties/" |
| xmlns:mx="http://www.adobe.com/2006/mxml" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns="*" |
| testSWF="NF_digitsType.mxml"> |
| |
| <mx:Script> |
| <![CDATA[ |
| |
| import assets.NFConstants; |
| |
| import flash.globalization.*; |
| |
| public var nfGSLib:flash.globalization.NumberFormatter; |
| |
| public var nfDefaultGSLib1:flash.globalization.NumberFormatter; |
| public var nfDefaultGSLib2:flash.globalization.NumberFormatter; |
| public var nfDefaultGSLib3:flash.globalization.NumberFormatter; |
| public var nfDefaultGSLib4:flash.globalization.NumberFormatter; |
| |
| public static function init(o:DisplayObject):void |
| { |
| } |
| |
| |
| ]]> |
| </mx:Script> |
| |
| <mx:Metadata> |
| <![CDATA[ |
| [Mixin] |
| ]]> |
| </mx:Metadata> |
| |
| <!--This test file is to test digitsType property--> |
| <testCases> |
| <!--test default digitsType--> |
| <TestCase testID="NF_digitsType_defaultValue_test1" description="test default digitsType" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfDefaultGSLib1=new flash.globalization.NumberFormatter('ar-JO')"/> |
| <RunCode code="nfDefaultGSLib2=new flash.globalization.NumberFormatter('zh-CN')"/> |
| <RunCode code="nfDefaultGSLib3=new flash.globalization.NumberFormatter('i-default')"/> |
| <RunCode code="nfDefaultGSLib4=new flash.globalization.NumberFormatter('sr-Cyrl-RS')"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfDefault1" propertyName="digitsType" valueExpression="value=nfDefaultGSLib1.digitsType"/> |
| <AssertPropertyValue target="nfDefault1" propertyName="lastOperationStatus" valueExpression="value=nfDefaultGSLib1.lastOperationStatus"/> |
| <AssertPropertyValue target="nfDefault2" propertyName="digitsType" valueExpression="value=nfDefaultGSLib2.digitsType"/> |
| <AssertPropertyValue target="nfDefault2" propertyName="lastOperationStatus" valueExpression="value=nfDefaultGSLib2.lastOperationStatus"/> |
| <AssertPropertyValue target="nfDefault3" propertyName="digitsType" valueExpression="value=nfDefaultGSLib3.digitsType"/> |
| <AssertPropertyValue target="nfDefault3" propertyName="lastOperationStatus" valueExpression="value=nfDefaultGSLib3.lastOperationStatus"/> |
| <AssertPropertyValue target="nfDefault4" propertyName="digitsType" valueExpression="value=nfDefaultGSLib4.digitsType"/> |
| <AssertPropertyValue target="nfDefault4" propertyName="lastOperationStatus" valueExpression="value=nfDefaultGSLib4.lastOperationStatus"/> |
| </body> |
| </TestCase> |
| |
| <!--Set/Get digitsType as positive value and format numbers--> |
| <TestCase testID="NF_digitsType_setPositiveValue_ARABIC_INDIC_test2" description="Set/Get digitsType as positive value and format numbers" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <RunCode code="nfGSLib.digitsType=NationalDigitsType.ARABIC_INDIC"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <SetProperty target="nfPositive1" propertyName="digitsType" valueExpression="value=NationalDigitsType.ARABIC_INDIC" waitEvent="change"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfPositive1" propertyName="digitsType" valueExpression="value=nfGSLib.digitsType"/> |
| <AssertMethodValue method="value=application.nfPositive1.format(-1234567.89012)" valueExpression="value=nfGSLib.formatNumber(-1234567.89012)" /> |
| <AssertPropertyValue target="nfPositive1" propertyName="lastOperationStatus" valueExpression="value=nfGSLib.lastOperationStatus"/> |
| </body> |
| </TestCase> |
| |
| <!--Set/Get digitsType as positive value and format numbers--> |
| <TestCase testID="NF_digitsType_setPositiveValue_EUROPEAN_test3" description="Set/Get digitsType as positive value and format numbers" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <RunCode code="nfGSLib.digitsType=NationalDigitsType.EUROPEAN"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <SetProperty target="nfPositive2" propertyName="digitsType" valueExpression="value=NationalDigitsType.EUROPEAN" waitEvent="change"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfPositive2" propertyName="digitsType" valueExpression="value=nfGSLib.digitsType"/> |
| <AssertMethodValue method="value=application.nfPositive2.format(-1234567.89012)" valueExpression="value=nfGSLib.formatNumber(-1234567.89012)" /> |
| </body> |
| </TestCase> |
| |
| <!--Set/Get digitsType as positive value and format numbers--> |
| <TestCase testID="NF_digitsType_setPositiveValue_NKO_test4" description="Set/Get digitsType as positive value and format numbers" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <RunCode code="nfGSLib.digitsType=NationalDigitsType.NKO"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <SetProperty target="nfPositive3" propertyName="digitsType" valueExpression="value=NationalDigitsType.NKO" waitEvent="change"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfPositive3" propertyName="digitsType" valueExpression="value=nfGSLib.digitsType"/> |
| <AssertMethodValue method="value=application.nfPositive3.format(-1234567.89012)" valueExpression="value=nfGSLib.formatNumber(-1234567.89012)" /> |
| </body> |
| </TestCase> |
| |
| <!--Set/Get digitsType as positive value and format numbers--> |
| <TestCase testID="NF_digitsType_setPositiveValue_GURMUKHI_test5" description="Set/Get digitsType as positive value and format numbers" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <RunCode code="nfGSLib.digitsType=NationalDigitsType.GURMUKHI"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <SetProperty target="nfPositive4" propertyName="digitsType" valueExpression="value=NationalDigitsType.GURMUKHI" waitEvent="change"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfPositive4" propertyName="digitsType" valueExpression="value=nfGSLib.digitsType"/> |
| <AssertMethodValue method="value=application.nfPositive4.format(-1234567.89012)" valueExpression="value=nfGSLib.formatNumber(-1234567.89012)" /> |
| </body> |
| </TestCase> |
| |
| <!--Set/Get digitsType as positive value and format numbers--> |
| <TestCase testID="NF_digitsTyper_setPositiveValue_OL_CHIKI_test6" description="Set/Get digitsType as positive value and format numbers" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <RunCode code="nfGSLib.digitsType=NationalDigitsType.OL_CHIKI"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <SetProperty target="nfPositive5" propertyName="digitsType" valueExpression="value=NationalDigitsType.OL_CHIKI" waitEvent="change"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfPositive5" propertyName="digitsType" valueExpression="value=nfGSLib.digitsType"/> |
| <AssertMethodValue method="value=application.nfPositive5.format(-1234567.89012)" valueExpression="value=nfGSLib.formatNumber(-1234567.89012)" /> |
| </body> |
| </TestCase> |
| |
| <!--Set/Get Inline digitsType as positive value and format numbers--> |
| <TestCase testID="NF_digitsType_setInlinePositiveValue_CHAM_test7" description="Set/Get Inline digitsType as positive value and format numbers" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <RunCode code="nfGSLib.digitsType=NationalDigitsType.CHAM"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfInline1" propertyName="digitsType" valueExpression="value=nfGSLib.digitsType"/> |
| <AssertMethodValue method="value=application.nfInline1.format(-1234567.89012)" valueExpression="value=nfGSLib.formatNumber(-1234567.89012)" /> |
| </body> |
| </TestCase> |
| |
| <!--Set/Get Inline digitsType as positive value and format numbers--> |
| <TestCase testID="NF_digitsType_setInlinePositiveValue_FULL_WIDTH_test8" description="Set/Get Inline digitsType as positive value and format numbers" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <RunCode code="nfGSLib.digitsType=NationalDigitsType.FULL_WIDTH"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfInline2" propertyName="digitsType" valueExpression="value=nfGSLib.digitsType"/> |
| <AssertMethodValue method="value=application.nfInline2.format(-1234567.89012)" valueExpression="value=nfGSLib.formatNumber(-1234567.89012)" /> |
| </body> |
| </TestCase> |
| |
| <!--Set/Get digitsType within <fx:Sript> --> |
| <TestCase testID="NF_digitsType_setInScript_TAMIL_test9" description="Set/Get digitsType within fx:Sript" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')" /> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <RunCode code="nfGSLib.digitsType=NationalDigitsType.TAMIL" /> |
| <RunCode code="application.setNFdigitsType()"/> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfScript" propertyName="digitsType" valueExpression="value=nfGSLib.digitsType"/> |
| <AssertPropertyValue target="nfScript" propertyName="lastOperationStatus" valueExpression="value=nfGSLib.lastOperationStatus"/> |
| </body> |
| </TestCase> |
| |
| <!--Binding property by lable text--> |
| <TestCase testID="NF_digitsType_binding_test10" description="Binding property by lable text" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')" /> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <RunCode code="nfGSLib.digitsType=NationalDigitsType.LAO" /> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <SetProperty target="nfBinding" propertyName="digitsType" valueExpression="value=NationalDigitsType.LAO" waitEvent="change"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfLabel" propertyName="text" valueExpression="value=nfGSLib.digitsType" /> |
| <AssertPropertyValue target="nfBinding" propertyName="lastOperationStatus" valueExpression="value=nfGSLib.lastOperationStatus"/> |
| </body> |
| </TestCase> |
| |
| <!--Set illegal digitsType properties--> |
| <TestCase testID="NF_digitsType_setIllegalValue_null_test11" description="Set illegal digitsType properties" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')" /> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| </setup> |
| <body> |
| <AssertMethodValue method="value=NFConstants.testArgError(application.nfNegative1,'digitsType',null)" |
| valueExpression="value=NFConstants.testArgError(nfGSLib,'digitsType',null)"/> |
| <AssertPropertyValue target="nfNegative1" propertyName="digitsType" valueExpression="value=nfGSLib.digitsType" /> |
| <AssertPropertyValue target="nfNegative1" propertyName="lastOperationStatus" valueExpression="value=nfGSLib.lastOperationStatus"/> |
| </body> |
| </TestCase> |
| |
| <!--Set illegal digitsType properties--> |
| <TestCase testID="NF_digitsType_setIllegalValue_0xA901_test12" description="Set illegal digitsType properties" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')" /> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| </setup> |
| <body> |
| <AssertMethodValue method="value=NFConstants.testArgError(application.nfNegative2,'digitsType',0xA901)" |
| valueExpression="value=NFConstants.testArgError(nfGSLib,'digitsType',0xA901)"/> |
| <AssertPropertyValue target="nfNegative2" propertyName="digitsType" valueExpression="value=nfGSLib.digitsType" /> |
| <AssertPropertyValue target="nfNegative2" propertyName="lastOperationStatus" valueExpression="value=nfGSLib.lastOperationStatus"/> |
| </body> |
| </TestCase> |
| |
| <!--Binding property when locale change--> |
| <TestCase testID="NF_digitsType_bindingAndChangeLocale_test13" description="Binding property when locale change" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('ar-JO')" /> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <SetStyle target="nfBLocale1" styleName="locale" value="en-US" waitEvent="change"/> |
| </setup> |
| <body> |
| <SetStyle target="nfBLocale1" styleName="locale" value="ar-JO" waitEvent="change"/> |
| <AssertPropertyValue target="nfBLocale1" propertyName="lastOperationStatus" valueExpression="value=nfGSLib.lastOperationStatus"/> |
| <AssertEvent target="nfLa" eventName="updateComplete" eventClass="mx.events::FlexEvent"/> |
| <AssertPropertyValue target="nfLa" propertyName="text" valueExpression="value=nfGSLib.digitsType" /> |
| </body> |
| </TestCase> |
| |
| <!--Binding property when locale change--> |
| <TestCase testID="NF_digitsType_bindingAndChangeLocale_test14" description="Binding property when locale change" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('zh-CN')" /> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| <SetStyle target="nfBLocale2" styleName="locale" value="ar-JO" waitEvent="change"/> |
| </setup> |
| <body> |
| <SetStyle target="nfBLocale2" styleName="locale" value="zh-CN" waitEvent="change"/> |
| <AssertPropertyValue target="nfBLocale2" propertyName="lastOperationStatus" valueExpression="value=nfGSLib.lastOperationStatus"/> |
| <AssertEvent target="nfLb" eventName="updateComplete" eventClass="mx.events::FlexEvent"/> |
| <AssertPropertyValue target="nfLb" propertyName="text" valueExpression="value=nfGSLib.digitsType" /> |
| </body> |
| </TestCase> |
| |
| <!-- test property without setting any locale --> |
| <TestCase testID="NF_digitsType_without_locale_test15" description="test property without setting any locale " keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <RunCode code="nfGSLib=new flash.globalization.NumberFormatter('en-US')" /> |
| <Pause timeout="{NFConstants.pauseTime}"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfNoLocaleInline" propertyName="digitsType" valueExpression="value=48" /> |
| <AssertPropertyValue target="nfNoLocaleInline" propertyName="lastOperationStatus" value="noError"/> |
| |
| <AssertPropertyValue target="nfNoLocaleScript" propertyName="digitsType" valueExpression="value=nfGSLib.digitsType" /> |
| <AssertPropertyValue target="nfNoLocaleScript" propertyName="lastOperationStatus" value="noError"/> |
| </body> |
| </TestCase> |
| |
| <!-- if property digitsType has been set inline, it doesnot change with locale --> |
| <TestCase testID="NF_digitsType_inline_changeLocale_test16" description="if property digitsType has been set inline, it doesnot change with locale" keywords="[NumberFormatter, digitsType]"> |
| <setup> |
| <SetStyle target="nfInline_ChangeLocale" styleName="locale" value="ar-JO" waitEvent="change"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="nfInline_ChangeLocale" propertyName="digitsType" valueExpression="value=NationalDigitsType.EUROPEAN"/> |
| </body> |
| </TestCase> |
| |
| |
| </testCases> |
| </UnitTester> |