blob: e7f27e992205c969845bbe53786bbc859e8506a3 [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="components/DateField/Methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="DateField_Basic_spark.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.controls.DateField;
public function changeDateToString():String
{
var todaysDate:String = DateField.dateToString(application.df.selectedDate, "MM/DD/YY");
return todaysDate;
}
public function changeStringToDate():Date
{
var dob:Date = DateField.stringToDate("06/30/2005", "MM/DD/YYYY");
return dob;
}
]]>
</mx:Script>
<testCases>
<TestCase testID="DateField_Method_Open_Default_spark" keywords="[open, DateField, methods]">
<setup>
<ResetComponent target="df" className="mx.controls::DateField" waitEvent="updateComplete" waitTarget="df"/>
<SetProperty target="df" propertyName="selectedDate" valueExpression="value=new Date(2005, 2, 5)" waitEvent="updateComplete" waitTarget="df"/>
</setup>
<body>
<RunCode code="application.df.open()" waitEvent="open" waitTarget="df"/>
<CompareBitmap url="../Methods/baselines/dfOpen_spark.png" target="" numColorVariances="5" ignoreMaxColorVariance="true"/>
</body>
</TestCase>
<TestCase testID="DateField_Method_Close_spark" keywords="[open, DateField methods]">
<setup>
<ResetComponent target="df" className="mx.controls::DateField" waitEvent="updateComplete" waitTarget="df"/>
<SetProperty target="df" propertyName="selectedDate" valueExpression="value=new Date(2005, 2, 5)" waitEvent="updateComplete" waitTarget="df"/>
</setup>
<body>
<RunCode code="application.df.open()" waitEvent="open" waitTarget="df"/>
<RunCode code="application.df.close()" waitEvent="close" waitTarget="df"/>
<CompareBitmap url="../Methods/baselines/dfClose_spark.png" target=""/>
</body>
</TestCase>
<TestCase testID="DateField_Method_dateToString_spark" keywords="[dateToString, DateChooser]">
<setup>
<ResetComponent target="df" className="mx.controls::DateField" waitEvent="updateComplete" waitTarget="df"/>
<SetProperty target="df" propertyName="selectedDate" valueExpression="value=new Date(2005, 2, 5)" waitEvent="updateComplete" waitTarget="df"/>
</setup>
<body>
<AssertMethodValue target="df" method="value=changeDateToString()" value="03/05/05"/>
</body>
</TestCase>
<TestCase testID="DateField_Method_stringToDate_spark" keywords="[stringToDate, DateChooser]">
<setup>
<ResetComponent target="df" className="mx.controls::DateField" waitEvent="updateComplete" waitTarget="df"/>
<SetProperty target="df" propertyName="selectedDate" valueExpression="value=new Date(2005, 2, 5)" waitEvent="updateComplete" waitTarget="df"/>
</setup>
<body>
<AssertMethodValue target="df" method="value=changeStringToDate()" valueExpression="value=new Date( 2005,05,30)"/>
</body>
</TestCase>
</testCases>
</UnitTester>