| <?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="gumbo/components/ToggleButton/properties/" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:m="http://ns.adobe.com/mxml/2009" xmlns="*" testSWF="Flex4_ToggleButton_main.mxml"> |
| |
| <!-- this set of lines form a template that must be in each unit test --> |
| |
| <fx:Script> |
| <![CDATA[ |
| public static function init(o:DisplayObject):void |
| { |
| } |
| ]]> |
| </fx:Script> |
| |
| <fx:Metadata> |
| <![CDATA[ |
| [Mixin] |
| ]]> |
| </fx:Metadata> |
| |
| <!-- end of set of lines that must be in each unit test --> |
| |
| <fx:Script> |
| <![CDATA[ |
| import spark.components.ToggleButton; |
| ]]> |
| </fx:Script> |
| |
| <fx:Style> |
| .myStyle{ |
| color: #FF0000 |
| } |
| |
| .myStyle2{ |
| color: #0000FF |
| } |
| </fx:Style> |
| |
| <testCases> |
| |
| <TestCase testID="ToggleButton_selected_property_true" description="Checks that when selected is true, the ToggleButton shows it is selected" keywords="[ToggleButton, selected, property]"> |
| <setup> |
| <ResetComponent target="myTB" className="spark.components.ToggleButton" waitEvent="updateComplete"/> |
| <SetProperty target="myTB" propertyName="selected" value="true" waitEvent="updateComplete" waitTarget="myTB"/> |
| </setup> |
| <body> |
| <CompareBitmap url="../properties/baselines/$testID.png" target="myTB"/> |
| </body> |
| </TestCase> |
| <TestCase testID="ToggleButton_selected_property_default" description="Checks that the default ToggleButton is not selected" keywords="[ToggleButton, selected, property]"> |
| <setup> |
| <ResetComponent target="myTB" className="spark.components.ToggleButton" waitEvent="updateComplete"/> |
| </setup> |
| <body> |
| <CompareBitmap url="../properties/baselines/$testID.png" target="myTB"/> |
| </body> |
| </TestCase> |
| <TestCase testID="ToggleButton_selected_property_by_click_true" description="Checks that clicking the ToggleButton selects it" keywords="[ToggleButton, selected, property]"> |
| <setup> |
| <ResetComponent target="myTB" className="spark.components.ToggleButton" waitEvent="updateComplete"/> |
| <DispatchMouseClickEvent target="myTB" localX="26" localY="11" waitEvent="updateComplete" waitTarget="myTB"/> |
| </setup> |
| <body> |
| <AssertPropertyValue propertyName="selected" value="true" target="myTB"/> |
| <CompareBitmap url="../properties/baselines/$testID.png" target="myTB"/> |
| </body> |
| </TestCase> |
| <TestCase testID="ToggleButton_selected_property_by_spacebar" description="Checks that clicking the ToggleButton selects it" keywords="[ToggleButton, selected, property]"> |
| <setup> |
| <ResetComponent target="myTB" className="spark.components.ToggleButton" waitEvent="updateComplete"/> |
| <DispatchKeyEvent keys="[TAB]" waitEvent="focusIn" waitTarget="myTB"/> |
| <DispatchKeyEvent keys="[SPACE]" waitEvent="updateComplete" waitTarget="myTB"/> |
| </setup> |
| <body> |
| <AssertPropertyValue propertyName="selected" value="true" target="myTB"/> |
| </body> |
| </TestCase> |
| <TestCase testID="ToggleButton_deselect_by_click" description="Checks that clicking a selected ToggleButton, unselects it" keywords="[ToggleButton, selected, property]"> |
| <setup> |
| <ResetComponent target="myTB" className="spark.components.ToggleButton" waitEvent="updateComplete"/> |
| <SetProperty target="myTB" propertyName="selected" value="true" waitEvent="updateComplete" waitTarget="myTB"/> |
| <DispatchMouseClickEvent target="myTB" localX="26" localY="11" waitEvent="updateComplete" waitTarget="myTB"/> |
| </setup> |
| <body> |
| <AssertPropertyValue propertyName="selected" value="false" target="myTB"/> |
| <CompareBitmap url="../properties/baselines/$testID.png" target="myTB"/> |
| </body> |
| </TestCase> |
| <TestCase testID="ToggleButton_label" description="ToggleButton with label" keywords="[ToggleButton, label, property]"> |
| <setup> |
| <ResetComponent target="myTB" className="spark.components.ToggleButton" waitEvent="updateComplete"/> |
| <SetProperty target="myTB" propertyName="label" value="ToggleButton" waitEvent="updateComplete" waitTarget="myTB.skin"/> |
| </setup> |
| <body> |
| <CompareBitmap url="../properties/baselines/$testID.png" target="myTB"/> |
| </body> |
| </TestCase> |
| <TestCase testID="ToggleButton_label_disabled" description="ToggleButton with label" keywords="[ToggleButton, label, property]"> |
| <setup> |
| <ResetComponent target="myTB" className="spark.components.ToggleButton" waitEvent="updateComplete"/> |
| <SetProperty target="myTB" propertyName="enabled" value="false"/> |
| <SetProperty target="myTB" propertyName="label" value="ToggleButton" waitEvent="updateComplete" waitTarget="myTB.skin"/> |
| </setup> |
| <body> |
| <CompareBitmap url="../properties/baselines/$testID.png" target="myTB"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ToggleButton_label_enabledDisabledSelected" description="ToggleButton enabled and disabled while selected" keywords="[ToggleButton, label, property]"> |
| <setup> |
| <ResetComponent target="myTB" className="spark.components.ToggleButton" waitEvent="updateComplete"/> |
| <SetProperty target="myTB" propertyName="label" value="ToggleButton" waitEvent="updateComplete" waitTarget="myTB.skin"/> |
| <SetProperty target="myTB" propertyName="selected" value="true" waitEvent="updateComplete" waitTarget="myTB.skin"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="myTB" propertyName="selected" value="true"/> |
| <CompareBitmap url="../properties/baselines/$testID_1.png" target="myTB"/> |
| <SetProperty target="myTB" propertyName="enabled" value="false" waitEvent="updateComplete"/> |
| <AssertPropertyValue target="myTB" propertyName="enabled" value="false"/> |
| <AssertPropertyValue target="myTB" propertyName="selected" value="true"/> |
| <CompareBitmap url="../properties/baselines/$testID_2.png" target="myTB"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ToggleButton_runTime_labelChange" description="ToggleButton with label changed at runtime" keywords="[ToggleButton, label, property]"> |
| <setup> |
| <ResetComponent target="myTB2" className="spark.components.ToggleButton" waitEvent="updateComplete"/> |
| <SetProperty target="myTB2" propertyName="label" value="ToggleButton" waitEvent="updateComplete" waitTarget="myTB2.skin"/> |
| </setup> |
| <body> |
| <CompareBitmap url="../properties/baselines/$testID_1.png" target="myTB2"/> |
| <DispatchMouseClickEvent target="myTB2" localX="26" localY="11" waitEvent="updateComplete" waitTarget="myTB2"/> |
| <CompareBitmap url="../properties/baselines/$testID_2.png" target="myTB2"/> |
| <DispatchMouseClickEvent target="myTB2" localX="26" localY="11" waitEvent="updateComplete" waitTarget="myTB2"/> |
| <CompareBitmap url="../properties/baselines/$testID_3.png" target="myTB2"/> |
| </body> |
| </TestCase> |
| <TestCase testID="ToggleButton_selected" description="ToggleButton with selection bound to label" keywords="[ToggleButton, label, property]"> |
| <setup> |
| <ResetComponent target="myTB3" className="spark.components.ToggleButton" waitEvent="updateComplete"/> |
| <SetProperty target="myTB3" propertyName="label" value="Selection bound" waitEvent="updateComplete" waitTarget="myTB3.skin"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="myTB3" propertyName="selected" value="false"/> |
| <AssertPropertyValue target="myLabel" propertyName="text" value="false" /> |
| <DispatchMouseClickEvent target="myTB3" localX="26" localY="11" waitEvent="updateComplete" waitTarget="myTB3"/> |
| <AssertPropertyValue target="myTB3" propertyName="selected" value="true"/> |
| <AssertPropertyValue target="myLabel" propertyName="text" value="true" /> |
| <DispatchMouseClickEvent target="myTB3" localX="26" localY="11" waitEvent="updateComplete" waitTarget="myTB3"/> |
| <AssertPropertyValue target="myTB3" propertyName="selected" value="false"/> |
| </body> |
| </TestCase> |
| <TestCase testID="ToggleButton_baselinePosition_preValidation" description="baselinePosition test" keywords="[ToggleButton, baselinePosition, property]"> |
| <setup> |
| <ResetComponent target="myTB" className="spark.components.ToggleButton" /> |
| </setup> |
| <body> |
| <AssertPropertyValue propertyName="baselinePosition" value="16" target="myTB"/> |
| </body> |
| </TestCase> |
| <TestCase testID="ToggleButton_baselinePosition_postValidation" description="baselinePosition test" keywords="[ToggleButton, baselinePosition, property]"> |
| <setup> |
| <ResetComponent target="myTB" className="spark.components.ToggleButton" waitTarget="myTB" waitEvent="updateComplete"/> |
| </setup> |
| <body> |
| <AssertPropertyValue propertyName="baselinePosition" value="16" target="myTB"/> |
| </body> |
| </TestCase> |
| |
| </testCases> |
| </UnitTester> |