blob: 0e15626b3c1950fb9573553c39d9778cfe8f2e5e [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="mobile/components/ToggleSwitch/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="*" testSWF="ToggleSwitchStates.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 -->
<testCases>
<TestCase testID="states_test1" description="Label different in state1 and state2." keywords="[ToggleSwitch,States]">
<setup>
<RunCode code="application.ensureState1()" waitEvent="manualResetComplete" />
</setup>
<body>
<AssertPropertyValue target="ts1" propertyName="selected" value="true" />
</body>
</TestCase>
<TestCase testID="states_test2" description="Label different in state1 and state2." keywords="[ToggleSwitch,States]">
<setup>
<RunCode code="application.ensureState1()" waitEvent="manualResetComplete" />
</setup>
<body>
<SetProperty propertyName="currentState" value="state2" waitTarget="ts1" waitEvent="updateComplete" />
<AssertPropertyValue target="ts1" propertyName="selected" value="false" />
</body>
</TestCase>
<TestCase testID="states_test3" description="Selected different in state1 and state2." keywords="[ToggleSwitch,States]">
<setup>
<RunCode code="application.ensureState1()" waitEvent="manualResetComplete" />
</setup>
<body>
<AssertPropertyValue target="ts1" propertyName="selected" value="true" />
</body>
</TestCase>
<TestCase testID="states_test4" description="Selected different in state1 and state2." keywords="[ToggleSwitch,States]">
<setup>
<RunCode code="application.ensureState1()" waitEvent="manualResetComplete" />
</setup>
<body>
<SetProperty propertyName="currentState" value="state2" waitTarget="ts1" waitEvent="updateComplete" />
<AssertPropertyValue target="ts1" propertyName="selected" value="false" />
</body>
</TestCase>
<TestCase testID="states_test5" description="Not present in state3" keywords="[ToggleSwitch,States]">
<setup>
<RunCode code="application.ensureState1()" waitEvent="manualResetComplete" />
</setup>
<body>
<SetProperty propertyName="currentState" value="state3" waitTarget="ts2" waitEvent="creationComplete" />
<AssertPropertyValue target="ts1" propertyName="parent" valueExpression="value = null" />
</body>
</TestCase>
<TestCase testID="states_test6" description="Present only in state3" keywords="[ToggleSwitch,States]">
<setup>
<RunCode code="application.ensureState1()" waitEvent="manualResetComplete" />
</setup>
<body>
<AssertPropertyValue target="ts2" propertyName="parent" valueExpression="value = null" />
</body>
</TestCase>
<TestCase testID="states_test7" description="Present only in state3" keywords="[ToggleSwitch,States]">
<setup>
<RunCode code="application.ensureState1()" waitEvent="manualResetComplete" />
</setup>
<body>
<SetProperty propertyName="currentState" value="state3" waitTarget="lbl1" waitEvent="updateComplete" />
<AssertMethodValue method="value = (application.ts2.parent != null)" value="true" />
</body>
</TestCase>
</testCases>
</UnitTester>