blob: 025de4264c0e3418e9520491bb1b12cacc1691f0 [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 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="*"
testDir="mobile/ViewAndViewNavigator/tests/"
testSWF="ViewAndViewNavigatorMainTabbed.mxml">
<fx:Script source="globalTabbed.as" />
<fx:Script>
<![CDATA[
import mx.core.FlexGlobals;
import mx.events.FlexEvent;
import views.*;
import spark.components.ViewNavigator;
import spark.components.TabbedViewNavigator;
public static function init(o:DisplayObject):void { }
private function verifySectionChangeEventOrder():Boolean {
var expectedArray : Array = new Array(
"changing",
"viewDeactivate_sect1view1",
"remove_sect1view1",
"valueCommit",
"onIndexChange");
trace('++ ' + FlexGlobals.topLevelApplication.eventArray.toString());
return expectedArray.toString() == FlexGlobals.topLevelApplication.eventArray.toString();
}
]]>
</fx:Script>
<fx:Metadata><![CDATA[ [Mixin] ]]></fx:Metadata>
<testCases>
<TestCase testID="ViewSizesSetBeforeViewActivateEvent" description="Verify view properties are set before view_activate is called" keywords="[SDK-29956, view, viewnavigator, events]">
<setup>
<!-- note, this must be run first, the whole point of the test is to make sure the view's activate is dispatched on launch -->
</setup>
<body>
<AssertMethodValue method="value = FlexGlobals.topLevelApplication.tabbedNavigator.selectedNavigator.activeView.width > 0" value="true" />
</body>
</TestCase>
<TestCase testID="viewAndViewNavigatorEventsOnSelectedIndex" description="Verify events dispatches on change of selectedIndex occur in correct order" keywords="[view, viewnavigator, events]">
<setup>
<RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="tabbedNavigator" waitEvent="myEvent" />
<RunCode code="selectedNavigator().pushView(views.Sect1View1)" waitTarget="tabbedNavigator" waitEvent="viewChangeComplete" />
<RunCode code="FlexGlobals.topLevelApplication.eventArray = new Array()" />
</setup>
<body>
<AssertMethodValue method="value = TabbedViewNavigator(FlexGlobals.topLevelApplication.tabbedNavigator).selectedIndex == 0" value="true" />
<RunCode code="TabbedViewNavigator(FlexGlobals.topLevelApplication.tabbedNavigator).selectedIndex = 1" waitTarget="tabbedNavigator" waitEvent="change" />
<AssertMethodValue method="value = verifySectionChangeEventOrder()" value="true" />
</body>
</TestCase>
</testCases>
</UnitTester>