| <?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 xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="main.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 flash.globalization.DateTimeFormatter;
|
| public var flashDF:flash.globalization.DateTimeFormatter;
|
| private var aDate:Date = new Date(2000, 0, 1);
|
|
|
|
|
| ]]>
|
| </mx:Script>
|
|
|
| <testCases>
|
| <TestCase testID="SetupDateTimeFormatterTest">
|
| <body>
|
| <SetProperty target="" propertyName="currentState" value="sparkDateTimeFormatterTest"
|
| waitEvent="updateComplete" />
|
| </body>
|
| </TestCase>
|
| <TestCase testID="DateTimeFormatter_test1" description="" keywords="[DateTimeFormatter, actualLocaleIDName]">
|
| <setup>
|
| <RunCode code="flashDF=new flash.globalization.DateTimeFormatter('xx')" />
|
| </setup>
|
| <body>
|
| <AssertPropertyValue propertyName="actualLocaleIDName" valueExpression="value=flashDF.actualLocaleIDName" target="sparkDateTimeFormatterTests.dtFormatter"/>
|
| </body>
|
| </TestCase>
|
| <TestCase testID="DateTimeFormatter_test2" description="" keywords="[DateTimeFormatter, format, dateStyle, Binding]">
|
| <setup>
|
| <RunCode code="flashDF=new flash.globalization.DateTimeFormatter('zh_CN', 'short', 'long')"/>
|
| <SetStyle styleName="locale" target="sparkDateTimeFormatterTests.dtFormatterShortDate" value="zh_CN" />
|
| </setup>
|
| <body>
|
| <AssertPropertyValue propertyName="text" valueExpression="value=flashDF.format(aDate)" target="sparkDateTimeFormatterTests.dateShort" />
|
| </body>
|
| </TestCase>
|
| <TestCase testID="DateTimeFormatter_test3" description="" keywords="[DateTimeFormatter, format, timeStyle, Binding]">
|
| <setup>
|
| <RunCode code="flashDF=new flash.globalization.DateTimeFormatter('zh_CN', 'long', 'short')"/>
|
| <SetStyle styleName="locale" target="sparkDateTimeFormatterTests.dtFormatterShortTime" value="zh_CN" />
|
| </setup>
|
| <body>
|
| <AssertPropertyValue propertyName="text" valueExpression="value=flashDF.format(aDate)" target="sparkDateTimeFormatterTests.timeShort" />
|
| </body>
|
| </TestCase>
|
| <TestCase testID="DateTimeFormatter_test4" description="MaskFull" keywords="[DateTimeFormatter, DateTimePattern]">
|
| <setup>
|
| <RunCode code="flashDF=new flash.globalization.DateTimeFormatter('en-US')"/>
|
| <RunCode code="flashDF.setDateTimePattern('EEEE, MMMM. d, yyyy \'at\' h:mm a')"/>
|
| </setup>
|
| <body>
|
| <AssertMethodValue method="value=application.sparkDateTimeFormatterTests.dtFormatterPattern.format(new Date(2000, 0, 1))" valueExpression="value=flashDF.format(new Date(2000, 0, 1))"/>
|
| <AssertMethodValue method="value=application.sparkDateTimeFormatterTests.dtFormatterPattern.format(new Date(65, 2, 6, 9, 42, 16, 0))" valueExpression="value=flashDF.format(new Date(65, 2, 6, 9, 42, 16, 0))"/>
|
| <AssertMethodValue method="value=application.sparkDateTimeFormatterTests.dtFormatterPattern.format(new Date(30000000, 11, 31, 23, 59, 59, 935))" valueExpression="value=flashDF.format(new Date(30000000, 11, 31, 23, 59, 59, 935))"/>
|
| <AssertMethodValue method="value=application.sparkDateTimeFormatterTests.dtFormatterPattern.format(new Date(0))" valueExpression="value=flashDF.format(new Date(0))"/>
|
| <AssertMethodValue method="value=application.sparkDateTimeFormatterTests.dtFormatterPattern.format(new Date('Mon Jul 21 1969 3:16 PM'))" valueExpression="value=flashDF.format(new Date('Mon Jul 21 1969 3:16 PM'))"/>
|
| <AssertMethodValue method="value=application.sparkDateTimeFormatterTests.dtFormatterPattern.format(new Date(1, 1, 1, 1, 1, 1, 1))" valueExpression="value=flashDF.format(new Date(1, 1, 1, 1, 1, 1, 1))"/>
|
| <AssertMethodValue method="value=application.sparkDateTimeFormatterTests.dtFormatterPattern.format(new Date('2:57 PM'))" valueExpression="value=flashDF.format(new Date('2:57 PM'))"/>
|
| <AssertMethodValue method="value=application.sparkDateTimeFormatterTests.dtFormatterPattern.format(new Date('Fri Nov 28 17:34:21 UTC-0500 2008'))" valueExpression="value=flashDF.format(new Date('Fri Nov 28 17:34:21 UTC-0500 2008'))"/>
|
| <AssertMethodValue method="value=application.sparkDateTimeFormatterTests.dtFormatterPattern.format(new Date())" valueExpression="value=flashDF.format(new Date())"/>
|
| </body>
|
| </TestCase>
|
| <TestCase testID="DateTimeFormatter_test5" description="" keywords="[DateTimeFormatter, actualLocaleIDName]">
|
| <setup>
|
| <RunCode code="flashDF=new flash.globalization.DateTimeFormatter(application.sparkDateTimeFormatterTests.getLocale.text)" />
|
| </setup>
|
| <body>
|
| <AssertPropertyValue propertyName="actualLocaleIDName" valueExpression="value=flashDF.actualLocaleIDName" target="sparkDateTimeFormatterTests.dtFormatterNoLocaleInline"/>
|
| </body>
|
| </TestCase>
|
| <TestCase testID="DateTimeFormatter_test6" description="" keywords="[DateTimeFormatter, errorText]">
|
| <body>
|
| <AssertMethodValue method="value=application.sparkDateTimeFormatterTests.dtFormatterNoLocaleInline.format('2:45 PM')" value="#####"/>
|
| </body>
|
| </TestCase>
|
| </testCases>
|
| </UnitTester>
|