| <?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/ButtonBar/Events/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ButtonBarApp1.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.ButtonBar; |
| import mx.styles.StyleManager; |
| import mx.managers.SystemManager; |
| import mx.events.ListEvent; |
| |
| [Bindable] |
| private var myDP:Array=[{label:"Italy", data:"ITALY"},{label:"England", data:"ENGLAND"},{label:"Slovenia", data:"SLOVENIA"}]; |
| ]]> |
| </mx:Script> |
| <testCases> |
| <TestCase testID="ButtonBar_Events_change_Mouse" description="Test clicking on a ButtonBar and ensure the change event is launched" keywords="[change, ButtonBar]"> |
| <setup> |
| <ResetComponent target="bb1" className="spark.components::ButtonBar" waitEvent="updateComplete" waitTarget="bb1" /> |
| <RunCode code="application.setDataProvider(application.bb1, 1)" waitTarget="bb1" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <DispatchMouseClickEvent target="bb1.dataGroup.getElementAt(1)" localX="5" localY="2" /> |
| <AssertEvent target="bb1" eventName="change" eventClass="spark.events::IndexChangeEvent" /> |
| </body> |
| </TestCase> |
| <TestCase testID="ButtonBar_Events_change_index" description="Verify the index property of the change event for ButtonBar." keywords="[change, ButtonBar]"> |
| <setup> |
| <ResetComponent target="bb1" className="spark.components::ButtonBar" waitEvent="updateComplete" waitTarget="bb1" /> |
| <RunCode code="application.setDataProvider(application.bb1, 1)" waitTarget="bb1" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <DispatchMouseClickEvent target="bb1.dataGroup.getElementAt(2)" localX="5" localY="2" /> |
| <AssertEvent target="bb1" eventName="change" eventClass="spark.events::IndexChangeEvent" /> |
| <AssertEventPropertyValue propertyName="newIndex" value="2" /> |
| </body> |
| </TestCase> |
| <TestCase testID="ButtonBar_Events_change_item" description="Verify the item property of the change event for ButtonBar." keywords="[change, ButtonBar]"> |
| <setup> |
| <ResetComponent target="bb1" className="spark.components::ButtonBar" waitEvent="updateComplete" waitTarget="bb1" /> |
| <RunCode code="application.setDataProvider(application.bb1, 1)" waitTarget="bb1" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <DispatchMouseClickEvent target="bb1.dataGroup.getElementAt(0)" localX="5" localY="2" /> |
| <AssertEvent target="bb1" eventName="change" eventClass="spark.events::IndexChangeEvent" /> |
| <AssertEventPropertyValue propertyName="oldIndex" value="-1" /> |
| </body> |
| </TestCase> |
| <TestCase testID="ButtonBar_Events_change_relatedObject" description="Verify the relatedObject property of the change event for ButtonBar." keywords="[change, ButtonBar]"> |
| <setup> |
| <ResetComponent target="bb1" className="spark.components::ButtonBar" waitEvent="updateComplete" waitTarget="bb1" /> |
| <RunCode code="application.setDataProvider(application.bb1, 1)" waitTarget="bb1" waitEvent="updateComplete" /> |
| <RunCode code="application.addListener()" /> |
| </setup> |
| <body> |
| <DispatchMouseClickEvent target="bb1.dataGroup.getElementAt(2)" localX="5" localY="2" /> |
| <AssertEvent target="bb1" eventName="change" eventClass="spark.events::IndexChangeEvent" /> |
| <AssertStyleValue value="0xFF0000" target="bb1.dataGroup.getElementAt(2)" styleName="chromeColor" /> |
| </body> |
| </TestCase> |
| <TestCase testID="ButtonBar_Events_change_SpaceBar" description="Test pressing the spacebar on a ButtonBar triggers the change event" keywords="[change, ButtonBar]"> |
| <setup> |
| <ResetComponent target="bb1" className="spark.components::ButtonBar" waitEvent="updateComplete" waitTarget="bb1" /> |
| <RunCode code="application.setDataProvider(application.bb1, 1)" waitTarget="bb1" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <RunCode code="application.default_button.setFocus()" waitEvent="focusIn" waitTarget="default_button" /> |
| <DispatchKeyEvent key="TAB" waitEvent="focusIn" waitTarget="bb1" /> |
| <DispatchKeyEvent key="RIGHT" waitEvent="keyUp" waitTarget="bb1" /> |
| <DispatchKeyEvent key="SPACE" /> |
| <AssertEvent target="bb1" eventName="change" eventClass="spark.events::IndexChangeEvent" /> |
| </body> |
| </TestCase> |
| |
| </testCases> |
| </UnitTester> |