| <?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="CompiletimeLocalization/ResourceBundlesClass_methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="CTL_main_en.mxml"> |
| <!-- this set of lines form a template that must be in each unit test --> |
| <mx:Script> |
| <![CDATA[ |
| |
| [Bindable] |
| public var simpleDP:Array = ['Milk chocolates', 'Dark chocolates', 'Toffies', 'Caramels']; |
| |
| 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.*; |
| import mx.controls.*; |
| |
| [ResourceBundle("MyBundle")] |
| private static var myBundle:ResourceBundle; |
| |
| |
| |
| import mx.managers.SystemManager; |
| public function scriptFunction(a:String, b:int):String |
| { |
| return a + ":" + b.toString(); |
| } |
| public var styleDecl:Object; |
| public var styleObj:Object; |
| |
| |
| public function doTest1():void |
| { |
| application.myLabel.enabled = myBundle.getBoolean('myBooleanValue'); |
| } |
| |
| public function doTest2():void |
| { |
| application.myLabel.text = String(myBundle.getNumber('myNumericStepper1_maximum')); |
| } |
| |
| public function doTest3():void |
| { |
| |
| application.myLabel.text = myBundle.getString('myButton1_label'); |
| } |
| |
| public function doTest4():void |
| { |
| |
| application.myList.dataProvider = myBundle.getStringArray('myComboBox1_labels'); |
| } |
| |
| ]]> |
| </mx:Script> |
| <testCases> |
| <TestCase testID="Checking_the_method_getBoolean" keywords="[CompileTime, Localization, Method, getBoolean]" description="Checking the method getBoolean"> |
| <setup> |
| <ResetComponent target="myLabel" className="mx.controls::Label" waitEvent="updateComplete" /> |
| <RunCode code="doTest1()"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="myLabel" propertyName="enabled" value="true" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="Checking_the_method_getNumber" keywords="[CompileTime, Localization, Method, getNumber]" description="Checking the method getNumber"> |
| <setup> |
| <ResetComponent target="myLabel" className="mx.controls::Label" waitEvent="updateComplete" /> |
| <RunCode code="doTest2()"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="myLabel" propertyName="text" value="15" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="Checking_the_method_getString" keywords="[CompileTime, Localization, Method, getString]" description="Checking the method getString"> |
| <setup> |
| <ResetComponent target="myLabel" className="mx.controls::Label" waitEvent="updateComplete" /> |
| <RunCode code="doTest3()"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="myLabel" propertyName="text" value="English" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="Checking_the_method_getStringArray" keywords="[CompileTime, Localization, Method, getStringArray]" description="Checking the method getStringArray"> |
| <setup> |
| <RunCode code="doTest4()" waitTarget="myList" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <AssertPropertyValue target="myList" propertyName="dataProvider" valueExpression="value=simpleDP" /> |
| </body> |
| </TestCase> |
| |
| |
| |
| </testCases> |
| </UnitTester> |