| <?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="ViewAndViewNavigatorMain.mxml"> |
| |
| <fx:Script source="globalNotTabbed.as" /> |
| |
| <fx:Script> |
| <![CDATA[ |
| |
| import mx.core.FlexGlobals; |
| import views.*; |
| |
| public var simpleObject : String; |
| public var basicArray : Array; |
| public var customObject : Object; |
| |
| public static function init(o:DisplayObject):void { } |
| |
| public function buildObjects():void { |
| |
| simpleObject = "ima string"; |
| basicArray = new Array("apples", "oranges", "bananas"); |
| customObject = new Object(); |
| customObject.string = "stringy thing"; |
| customObject.number = 2; |
| } |
| |
| /* |
| public function resetApp():void { |
| if(FlexGlobals.topLevelApplication.navigator.activeView is Sect1View1) { |
| FlexGlobals.topLevelApplication.navigator.dispatchEvent( new Event("complete") ); |
| } else { |
| // FlexGlobals.topLevelApplication.navigator.selectedIndex = 0; |
| FlexGlobals.topLevelApplication.navigator.popToFirstView(); |
| } |
| buildObjects(); |
| } |
| */ |
| ]]> |
| </fx:Script> |
| |
| <fx:Metadata><![CDATA[ [Mixin] ]]></fx:Metadata> |
| |
| <testCases> |
| |
| <TestCase testID="dataPassSimpleObject" description="Verify you can pass a simple object to a view" keywords="[view, viewnavigator, data]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="navigator().pushView(views.Sect1View1)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <RunCode code="buildObjects()" /> |
| </setup> |
| |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2, simpleObject)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView is Sect1View2" value="true" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.data == simpleObject" value="true" /> |
| </body> |
| |
| </TestCase> |
| |
| <TestCase testID="dataPassArray" description="Verify you can pass a simple an array to a view" keywords="[view, viewnavigator, data]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="navigator().pushView(views.Sect1View1)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <RunCode code="buildObjects()" /> |
| </setup> |
| |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2, basicArray)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView is Sect1View2" value="true" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.data == basicArray" value="true" /> |
| </body> |
| |
| </TestCase> |
| |
| <TestCase testID="dataPassCustomObject" description="Verify you can pass a custom object to a view" keywords="[view, viewnavigator, data]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="navigator().pushView(views.Sect1View1)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <RunCode code="buildObjects()" /> |
| </setup> |
| |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2, customObject)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView is Sect1View2" value="true" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.data == customObject" value="true" /> |
| </body> |
| |
| </TestCase> |
| |
| <TestCase testID="contextPassSimpleObject" description="Verify you can pass a simple context to a view" keywords="[view, viewnavigator, context]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="navigator().pushView(views.Sect1View1)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <RunCode code="buildObjects()" /> |
| </setup> |
| |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2, null, simpleObject)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView is Sect1View2" value="true" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.context == simpleObject" value="true" /> |
| </body> |
| |
| </TestCase> |
| |
| <TestCase testID="contextPassArray" description="Verify you can pass a simple an array to a view" keywords="[view, viewnavigator, context]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="navigator().pushView(views.Sect1View1)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <RunCode code="buildObjects()" /> |
| </setup> |
| |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2, null, basicArray)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView is Sect1View2" value="true" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.context == basicArray" value="true" /> |
| </body> |
| |
| </TestCase> |
| |
| <TestCase testID="contextPassCustomObject" description="Verify you can pass a custom object to a view" keywords="[view, viewnavigator, context]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="navigator().pushView(views.Sect1View1)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <RunCode code="buildObjects()" /> |
| </setup> |
| |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2, null, customObject)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView is Sect1View2" value="true" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.context == customObject" value="true" /> |
| </body> |
| |
| </TestCase> |
| |
| </testCases> |
| |
| </UnitTester> |