blob: 276177d81cf6ad91d35d54c9462c37960cde5be5 [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/RadioButton/properties/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="RadioButton_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.core.FlexGlobals;
public function setValueSelectedFalse():void{
FlexGlobals.topLevelApplication.rb.selected=false;
}
public function setValueSelectedTrue():void{
FlexGlobals.topLevelApplication.rb.selected=true;
}
public function setValueLabelPlacementBottom():void{
FlexGlobals.topLevelApplication.rb.labelPlacement='bottom';
}
public function setValueLabelPlacementTop():void{
FlexGlobals.topLevelApplication.rb.labelPlacement='top';
}
public function setValueLabelPlacementLeft():void{
FlexGlobals.topLevelApplication.rb.labelPlacement='left';
}
public function setValueEnabledTrue():void{
FlexGlobals.topLevelApplication.rb.enabled=true;
}
]]>
</mx:Script>
<testCases>
<TestCase testID="RadioButton_Property_Selected_Default_spark" keywords="[groupName, selected, RadioButton]">
<setup>
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="selected" value="false" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_Selected_True_spark" keywords="[backgroundAlpha, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="selected" value="true" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="selected" value="true" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_Selected_False_spark" keywords="[selected, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="selected" value="false" />
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="selected" value="false" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_Selected2_True_spark" keywords="[selected, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
<RunCode code="setValueSelectedTrue()" />
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="selected" value="true" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_Selected3_False_spark" keywords="[selected, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
<RunCode code="setValueSelectedFalse()" />
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="selected" value="false" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_LabelPlacement_Default_spark" keywords="[labelPlacement, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="label" value="Hello World!!!" waitEvent="updateComplete" waitTarget="rb" />
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="labelPlacement" value="right" />
<CompareBitmap target="rb" url="../properties/baselines/labelPlacement_default_spark.png" timeout="5000" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_LabelPlacement_left_spark" keywords="[labelPlacement, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="label" value="Hello World!!!" waitEvent="updateComplete" waitTarget="rb" />
<SetProperty target="rb" propertyName="labelPlacement" value="left" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="labelPlacement" value="left" />
<CompareBitmap target="rb" url="../properties/baselines/labelPlacement_left_spark.png" timeout="5000" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_LabelPlacement_top_spark" keywords="[labelPlacement, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="label" value="Hello World!!!" waitEvent="updateComplete" waitTarget="rb" />
<SetProperty target="rb" propertyName="labelPlacement" value="top" waitEvent="updateComplete" waitTarget="rb" />
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="labelPlacement" value="top" />
<CompareBitmap target="rb" url="../properties/baselines/labelPlacement_top_spark.png" timeout="5000" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_LabelPlacement_bottom_spark" keywords="[labelPlacement, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="label" value="Hello World!!!" waitEvent="updateComplete" waitTarget="rb" />
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="labelPlacement" value="bottom" waitEvent="updateComplete" waitTarget="rb" />
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="labelPlacement" value="bottom" />
<CompareBitmap target="rb" url="../properties/baselines/labelPlacement_bottom_spark.png" timeout="5000" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_LabelPlacement2_left_spark" keywords="[labelPlacement, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="label" value="Hello World!!!" waitEvent="updateComplete" waitTarget="rb" />
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
<RunCode code="setValueLabelPlacementLeft()" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="labelPlacement" value="left" />
<CompareBitmap target="rb" url="../properties/baselines/labelPlacement_left_spark.png" timeout="5000" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_LabelPlacement2_Top_spark" keywords="[labelPlacement, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="label" value="Hello World!!!" waitEvent="updateComplete" waitTarget="rb" />
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
<RunCode code="setValueLabelPlacementTop()" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="labelPlacement" value="top" />
<CompareBitmap target="rb" url="../properties/baselines/labelPlacement2_top_spark.png" timeout="5000" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_LabelPlacement2_bottom_spark" keywords="[labelPlacement, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="label" value="Hello World!!!" waitEvent="updateComplete" waitTarget="rb" />
<RunCode code="setValueLabelPlacementBottom()" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="labelPlacement" value="bottom" />
<CompareBitmap target="rb" url="../properties/baselines/labelPlacement2_bottom_spark.png" timeout="5000" />
</body>
</TestCase>
<!-- enabled -->
<TestCase testID="RadioButton_Property_Enabled_Default_spark" keywords="[enabled, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="enabled" value="true" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_Enabled_False_spark" keywords="[enabled, RadioButton]">
<setup>
<SetProperty target="rb" propertyName="groupName" value="g1" waitEvent="updateComplete" waitTarget="rb"/>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="enabled" value="false" />
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="enabled" value="false" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_Enabled_True_spark" keywords="[enabled, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="enabled" value="false" waitEvent="updateComplete" waitTarget="rb"/>
<RunCode code="setValueEnabledTrue()" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="enabled" value="true" />
</body>
</TestCase>
<!-- label -->
<TestCase testID="RadioButton_Property_Label1_spark" keywords="[label, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="label" value="" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_Label2_spark" keywords="[label, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="label" value=""/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="label" value="" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_Label3_spark" keywords="[label, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="label" value="RBLabel" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="label" value="RBLabel" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_Label4_spark" keywords="[label, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="label" value="@##$@^#" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="label" value="@##$@^#" />
</body>
</TestCase>
<TestCase testID="RadioButton_Property_GroupName_spark" keywords="[label, RadioButton]">
<setup>
<ResetComponent target="rb" className="mx.controls::RadioButton" waitEvent="updateComplete" waitTarget="rb"/>
<SetProperty target="rb" propertyName="groupName" value="rgdefault" waitEvent="updateComplete" waitTarget="rb"/>
</setup>
<body>
<AssertPropertyValue target="rb" propertyName="groupName" value="rgdefault" />
</body>
</TestCase>
</testCases>
</UnitTester>