blob: f8f184f0d4963ef586bdb9d56006c23cd515a0c1 [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.View;
import spark.components.ViewNavigator;
import spark.components.TabbedViewNavigator;
public var vn : ViewNavigator;
public static function init(o:DisplayObject):void { }
/*
public function activeView() : View {
return navigator().activeView;
}
public function navigator() : TabbedViewNavigator {
return TabbedViewNavigator(FlexGlobals.topLevelApplication.navigator);
}
public function selectedNavigator() : ViewNavigator {
return ViewNavigator(navigator().selectedNavigator);
}
public function resetApp():void {
if( ViewNavigator(FlexGlobals.topLevelApplication.navigator.selectedNavigator).activeView is Sect1View1) {
FlexGlobals.topLevelApplication.navigator.selectedNavigator.dispatchEvent( new Event("complete") );
} else {
ViewNavigator(FlexGlobals.topLevelApplication.navigator.selectedNavigator).popToFirstView();
}
}
*/
public function createViewNav():ViewNavigator {
vn = new ViewNavigator();
vn.label = "Root View";
vn.firstView = RootView;
return vn;
}
public function addItem():void {
navigator().addItem(createViewNav());
}
public function addItemAt(i:Number):void {
navigator().addItemAt(createViewNav(), 1);
}
]]>
</fx:Script>
<fx:Metadata><![CDATA[ [Mixin] ]]></fx:Metadata>
<testCases>
<TestCase testID="viewAndViewNavigatorAddRemove" description="Verify ISelectable -- addItem, getItemAt, removeItemAt" keywords="[viewnavigator, addItem, addItemAt, removeItemAt]">
<setup>
<RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="tabbedNavigator" waitEvent="myEvent" />
<RunCode code="selectedNavigator().pushView(views.Sect1View1)" waitTarget="tabbedNavigator" waitEvent="viewChangeComplete" />
</setup>
<body>
<AssertMethodValue method="value = navigator().length == 2" value="true" />
<!-- addItem() -->
<RunCode code="addItem()" waitTarget="tabbedNavigator" waitEvent="updateComplete" />
<!-- getItemAt() -->
<AssertMethodValue method="value = navigator().length == 3" value="true" />
<AssertMethodValue method="value = navigator().getItemAt(2) == vn" value="true" />
<!-- removeItemAt() -->
<RunCode code="navigator().removeItemAt(2)" waitTarget="tabbedNavigator" waitEvent="updateComplete" />
<AssertMethodValue method="value = navigator().length == 2" value="true" />
<!-- addItemAt() -->
<RunCode code="addItemAt(1)" waitTarget="tabbedNavigator" waitEvent="updateComplete" />
<AssertMethodValue method="value = navigator().length == 3" value="true" />
<AssertMethodValue method="value = navigator().getItemAt(1) == vn" value="true" />
<!-- removeItemAt() -->
<RunCode code="navigator().removeItemAt(1)" waitTarget="tabbedNavigator" waitEvent="updateComplete" />
<AssertMethodValue method="value = navigator().length == 2" value="true" />
</body>
</TestCase>
</testCases>
</UnitTester>