blob: 7e3022aedc1402311d03fdb3df54493dc9588ecf [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="gumbo/components/TabBar/Integration/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="TabBar_ViewStack2.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 Assets.*;
import mx.core.FlexGlobals;
import spark.components.*;
import mx.core.*;
]]>
</mx:Script>
<testCases>
<!--
========================================================
States
Set the TabBar's dataProvider.state1 and dataProvider.state2 to different ViewStacks.
Be sure they update correctly. Be sure changes to selectedIndex work correctly.
Make certain items in the ViewStack present/absent in different states.
Be sure the TabBar updates as currentState is changed.
========================================================
-->
<!-- CURRENTLY 0 KNOWN FAILURES -->
<TestCase testID="states_test0" keywords="[TabBar,ViewStack,States]" description="default state: state1 (one item)">
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
</setup>
<body>
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(0)" propertyName="label" value="Halo 1" />
<AssertPropertyValue target="TC_States.child1.getElementAt(0)" propertyName="label" value="Halo 1" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="0" />
<AssertPropertyValue target="TC_States.child1" propertyName="selectedIndex" value="0" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="1" />
<AssertPropertyValue target="TC_States.tb_States.dataProvider" propertyName="length" value="1" />
<AssertPropertyValue target="TC_States" propertyName="currentState" value="state1" />
<CompareBitmap target="TC_States.tb_States" url="../integration/baselines/$testID.png" numColorVariances="5" maxColorVariance="10"/>
</body>
</TestCase>
<TestCase testID="states_test1" keywords="[TabBar,ViewStack,States]" description="empty viewstack in state">
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
<SetProperty target="TC_States" propertyName="currentState" value="state0" waitTarget="TC_States" waitEvent="currentStateChange" />
</setup>
<body>
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="-1" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="0" />
<AssertPropertyValue target="TC_States.tb_States.dataProvider" propertyName="length" value="0" />
<AssertPropertyValue target="TC_States" propertyName="currentState" value="state0" />
</body>
</TestCase>
<TestCase testID="states_test2" keywords="[TabBar,ViewStack,States]" description="state2 (2 items) - setting SelectedIndex on TabBar" >
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
<SetProperty target="TC_States" propertyName="currentState" value="state2" waitTarget="TC_States" waitEvent="currentStateChange" />
<SetProperty target="TC_States.tb_States" propertyName="selectedIndex" value="1" waitTarget="TC_States.tb_States" waitEvent="updateComplete" />
</setup>
<body>
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(0)" propertyName="label" value="Spark 1" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(1)" propertyName="label" value="Spark 2" />
<AssertPropertyValue target="TC_States.child2.getElementAt(0)" propertyName="label" value="Spark 1" />
<AssertPropertyValue target="TC_States.child2.getElementAt(1)" propertyName="label" value="Spark 2" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="1" />
<AssertPropertyValue target="TC_States.child2" propertyName="selectedIndex" value="1" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="2" />
<AssertPropertyValue target="TC_States.tb_States.dataProvider" propertyName="length" value="2" />
<AssertPropertyValue target="TC_States" propertyName="currentState" value="state2" />
<CompareBitmap target="TC_States.tb_States" url="../integration/baselines/$testID.png" numColorVariances="5" maxColorVariance="10"/>
</body>
</TestCase>
<TestCase testID="states_test2b" keywords="[TabBar,ViewStack,States]" description="state2 (2 items) - setting SelectedIndex on ViewStack" >
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
<SetProperty target="TC_States" propertyName="currentState" value="state2" waitTarget="TC_States" waitEvent="currentStateChange" />
<SetProperty target="TC_States.child2" propertyName="selectedIndex" value="1" waitTarget="TC_States.child2" waitEvent="updateComplete" />
</setup>
<body>
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(0)" propertyName="label" value="Spark 1" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(1)" propertyName="label" value="Spark 2" />
<AssertPropertyValue target="TC_States.child2.getElementAt(0)" propertyName="label" value="Spark 1" />
<AssertPropertyValue target="TC_States.child2.getElementAt(1)" propertyName="label" value="Spark 2" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="1" />
<AssertPropertyValue target="TC_States.child2" propertyName="selectedIndex" value="1" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="2" />
<AssertPropertyValue target="TC_States.tb_States.dataProvider" propertyName="length" value="2" />
<AssertPropertyValue target="TC_States" propertyName="currentState" value="state2" />
<CompareBitmap target="TC_States.tb_States" url="../integration/baselines/$testID.png" numColorVariances="5" maxColorVariance="10"/>
</body>
</TestCase>
<TestCase testID="states_test3" keywords="[TabBar,ViewStack,States]" description="state3 (3 items) - setting SelectedIndex on TabBar" >
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
<SetProperty target="TC_States" propertyName="currentState" value="state3" waitTarget="TC_States" waitEvent="currentStateChange" />
<SetProperty target="TC_States.tb_States" propertyName="selectedIndex" value="1" waitTarget="TC_States.tb_States" waitEvent="updateComplete" />
</setup>
<body>
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(0)" propertyName="label" value="SparkHalo 1" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(1)" propertyName="label" value="SparkHalo 2" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(2)" propertyName="label" value="SparkHalo 3" />
<AssertPropertyValue target="TC_States.child3.getElementAt(0)" propertyName="label" value="SparkHalo 1" />
<AssertPropertyValue target="TC_States.child3.getElementAt(1)" propertyName="label" value="SparkHalo 2" />
<AssertPropertyValue target="TC_States.child3.getElementAt(2)" propertyName="label" value="SparkHalo 3" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="1" />
<AssertPropertyValue target="TC_States.child3" propertyName="selectedIndex" value="1" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="3" />
<AssertPropertyValue target="TC_States.tb_States.dataProvider" propertyName="length" value="3" />
<AssertPropertyValue target="TC_States" propertyName="currentState" value="state3" />
<CompareBitmap target="TC_States.tb_States" url="../integration/baselines/$testID.png" numColorVariances="5" maxColorVariance="10"/>
</body>
</TestCase>
<TestCase testID="states_test3b" keywords="[TabBar,ViewStack,States]" description="state3 (3 items) - setting SelectedIndex on ViewStack" >
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
<SetProperty target="TC_States" propertyName="currentState" value="state3" waitTarget="TC_States" waitEvent="currentStateChange" />
<SetProperty target="TC_States.child3" propertyName="selectedIndex" value="1" waitTarget="TC_States.child3" waitEvent="updateComplete" />
</setup>
<body>
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(0)" propertyName="label" value="SparkHalo 1" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(1)" propertyName="label" value="SparkHalo 2" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(2)" propertyName="label" value="SparkHalo 3" />
<AssertPropertyValue target="TC_States.child3.getElementAt(0)" propertyName="label" value="SparkHalo 1" />
<AssertPropertyValue target="TC_States.child3.getElementAt(1)" propertyName="label" value="SparkHalo 2" />
<AssertPropertyValue target="TC_States.child3.getElementAt(2)" propertyName="label" value="SparkHalo 3" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="1" />
<AssertPropertyValue target="TC_States.child3" propertyName="selectedIndex" value="1" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="3" />
<AssertPropertyValue target="TC_States.tb_States.dataProvider" propertyName="length" value="3" />
<AssertPropertyValue target="TC_States" propertyName="currentState" value="state3" />
<CompareBitmap target="TC_States.tb_States" url="../integration/baselines/$testID.png" numColorVariances="5" maxColorVariance="10"/>
</body>
</TestCase>
<TestCase testID="states_test4" keywords="[TabBar,ViewStack,States]" description="preserving selectedIndex when changing to smaller ViewStack - setting selectedIndex on TabBar" >
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
<SetProperty target="TC_States" propertyName="currentState" value="state3" waitTarget="TC_States" waitEvent="currentStateChange" />
<SetProperty target="TC_States.tb_States" propertyName="selectedIndex" value="1" waitTarget="TC_States.tb_States" waitEvent="updateComplete" />
</setup>
<body>
<SetProperty target="TC_States" propertyName="currentState" value="state2" waitTarget="TC_States" waitEvent="currentStateChange" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="2" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="0" />
<AssertPropertyValue target="TC_States.child2" propertyName="selectedIndex" value="0" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(0)" propertyName="selected" value="true" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(1)" propertyName="selected" value="false" />
</body>
</TestCase>
<TestCase testID="states_test4b" keywords="[TabBar,ViewStack,States]" description="preserving selectedIndex when changing to smaller ViewStack - setting selectedIndex on ViewStack" >
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
<SetProperty target="TC_States" propertyName="currentState" value="state3" waitTarget="TC_States" waitEvent="currentStateChange" />
<SetProperty target="TC_States.child3" propertyName="selectedIndex" value="1" waitTarget="TC_States.child3" waitEvent="updateComplete" />
</setup>
<body>
<SetProperty target="TC_States" propertyName="currentState" value="state2" waitTarget="TC_States" waitEvent="currentStateChange" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="2" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="0" />
<AssertPropertyValue target="TC_States.child2" propertyName="selectedIndex" value="0" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(0)" propertyName="selected" value="true" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(1)" propertyName="selected" value="false" />
<SetProperty target="TC_States" propertyName="currentState" value="state3" waitTarget="TC_States" waitEvent="currentStateChange" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="3" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="1" />
<AssertPropertyValue target="TC_States.child3" propertyName="selectedIndex" value="1" />
</body>
</TestCase>
<TestCase testID="states_test5" keywords="[TabBar,ViewStack,States]" description="preserving selectedIndex when changing to larger ViewStack - setting selectedIndex on TabBar" >
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
<SetProperty target="TC_States" propertyName="currentState" value="state2" waitTarget="TC_States" waitEvent="currentStateChange" />
<SetProperty target="TC_States.tb_States" propertyName="selectedIndex" value="1" waitTarget="TC_States.tb_States" waitEvent="updateComplete" />
</setup>
<body>
<SetProperty target="TC_States" propertyName="currentState" value="state3" waitTarget="TC_States" waitEvent="currentStateChange" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="3" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="0" />
<AssertPropertyValue target="TC_States.child3" propertyName="selectedIndex" value="0" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(0)" propertyName="selected" value="true" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(1)" propertyName="selected" value="false" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(2)" propertyName="selected" value="false" />
</body>
</TestCase>
<TestCase testID="states_test5b" keywords="[TabBar,ViewStack,States]" description="preserving selectedIndex when changing to larger ViewStack - setting selectedIndex on ViewStack" >
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
<SetProperty target="TC_States" propertyName="currentState" value="state2" waitTarget="TC_States" waitEvent="currentStateChange" />
<SetProperty target="TC_States.child2" propertyName="selectedIndex" value="1" waitTarget="TC_States.child2" waitEvent="updateComplete" />
</setup>
<body>
<SetProperty target="TC_States" propertyName="currentState" value="state3" waitTarget="TC_States" waitEvent="currentStateChange" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="3" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="0" />
<AssertPropertyValue target="TC_States.child3" propertyName="selectedIndex" value="0" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(0)" propertyName="selected" value="true" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(1)" propertyName="selected" value="false" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup.getElementAt(2)" propertyName="selected" value="false" />
</body>
</TestCase>
<TestCase testID="states_test6" keywords="[TabBar,ViewStack,States]" description="losing selectedIndex when changing to empty ViewStack - setting selectedIndex on TabBar" >
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
<SetProperty target="TC_States" propertyName="currentState" value="state2" waitTarget="TC_States" waitEvent="currentStateChange" />
<SetProperty target="TC_States.tb_States" propertyName="selectedIndex" value="1" waitTarget="TC_States.tb_States" waitEvent="updateComplete" />
</setup>
<body>
<SetProperty target="TC_States" propertyName="currentState" value="state0" waitTarget="TC_States" waitEvent="currentStateChange" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="0" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="-1" />
<AssertPropertyValue target="TC_States.child0" propertyName="selectedIndex" value="-1" />
</body>
</TestCase>
<TestCase testID="states_test6b" keywords="[TabBar,ViewStack,States]" description="losing selectedIndex when changing to empty ViewStack - setting selectedIndex on ViewStack" >
<setup>
<ResetComponent target="TC_States" className="Assets.TestCompStates" waitEvent="updateComplete" />
<SetProperty target="TC_States" propertyName="currentState" value="state2" waitTarget="TC_States" waitEvent="currentStateChange" />
<SetProperty target="TC_States.child2" propertyName="selectedIndex" value="1" waitTarget="TC_States.child2" waitEvent="updateComplete" />
</setup>
<body>
<SetProperty target="TC_States" propertyName="currentState" value="state0" waitTarget="TC_States" waitEvent="currentStateChange" />
<AssertPropertyValue target="TC_States.tb_States.dataGroup" propertyName="numElements" value="0" />
<AssertPropertyValue target="TC_States.tb_States" propertyName="selectedIndex" value="-1" />
<AssertPropertyValue target="TC_States.child0" propertyName="selectedIndex" value="-1" />
</body>
</TestCase>
<TestCase testID="states_test7" keywords="[TabBar,ViewStack,States]" description="testing ViewStack with different elements present/absent in different states - state1" >
<setup>
<ResetComponent target="TC_States2" className="Assets.TestCompStates2" waitEvent="updateComplete" />
</setup>
<body>
<AssertPropertyValue target="TC_States2.tb_States2.dataGroup" propertyName="numElements" value="2" />
<AssertPropertyValue target="TC_States2.tb_States2.dataGroup.getElementAt(0)" propertyName="label" value="SparkHalo 1" />
<AssertPropertyValue target="TC_States2.tb_States2.dataGroup.getElementAt(1)" propertyName="label" value="SparkHalo 3" />
<AssertPropertyValue target="TC_States2.vs1.getElementAt(0)" propertyName="label" value="SparkHalo 1" />
<AssertPropertyValue target="TC_States2.vs1.getElementAt(1)" propertyName="label" value="SparkHalo 3" />
</body>
</TestCase>
<TestCase testID="states_test8" keywords="[TabBar,ViewStack,States]" description="testing ViewStack with different elements present/absent in different states - state2" >
<setup>
<ResetComponent target="TC_States2" className="Assets.TestCompStates2" waitEvent="updateComplete" />
<SetProperty target="TC_States2" propertyName="currentState" value="state2" waitTarget="TC_States2" waitEvent="currentStateChange" />
</setup>
<body>
<AssertPropertyValue target="TC_States2.tb_States2.dataGroup" propertyName="numElements" value="2" />
<AssertPropertyValue target="TC_States2.tb_States2.dataGroup.getElementAt(0)" propertyName="label" value="SparkHalo 2" />
<AssertPropertyValue target="TC_States2.tb_States2.dataGroup.getElementAt(1)" propertyName="label" value="SparkHalo 3" />
<AssertPropertyValue target="TC_States2.vs1.getElementAt(0)" propertyName="label" value="SparkHalo 2" />
<AssertPropertyValue target="TC_States2.vs1.getElementAt(1)" propertyName="label" value="SparkHalo 3" />
</body>
</TestCase>
</testCases>
</UnitTester>