| <?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.*; |
| import spark.transitions.SlideViewTransition; |
| |
| import mx.core.mx_internal; |
| use namespace mx_internal; |
| |
| public var simpleObject : String; |
| public var basicArray : Array; |
| public var customObject : Object; |
| |
| public static function init(o:DisplayObject):void { } |
| |
| public function buildObjects():void { |
| |
| simpleObject = new String("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.popToFirstView(); |
| } |
| FlexGlobals.topLevelApplication.navigator.activeView.title = 'Sect1View1'; |
| buildObjects(); |
| } |
| */ |
| |
| ]]> |
| </fx:Script> |
| |
| <fx:Metadata><![CDATA[ [Mixin] ]]></fx:Metadata> |
| |
| <testCases> |
| |
| <!-- |
| This test pushes a fresh view, writes some unique data to it, pushes another view, confirms it is a new view, |
| pops a view, and confirms the unique data is there. |
| --> |
| |
| <TestCase testID="simpleObjectPersistence" description="Verify simple object data set in a view is persisted." keywords="[pushView, popView]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="buildObjects()"/> |
| </setup> |
| |
| <body> |
| <AssertMethodValue method="value = (FlexGlobals.topLevelApplication.navigator.activeView == null)" value="true" /> |
| |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View1, simpleObject)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = (FlexGlobals.topLevelApplication.navigator.activeView is Sect1View1)" value="true" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2)" 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" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.popView()" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.data == simpleObject" value="true" /> |
| </body> |
| |
| </TestCase> |
| |
| <!-- destructionPolicy has been removed --> |
| <TestCase testID="inActiveViewsNotAccessibleWhenDestructionIsTrue" description="Verify the active property of disabled view is false until reactivated" keywords="[pushView, popView]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="navigator().pushView(views.Sect1View1)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.activeView.destructionPolicy = 'auto'" /> |
| </setup> |
| |
| <body> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.navigationStack.source[0].instance == null" value="false" /> |
| |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.navigationStack.source[0].instance == null" value="true" /> |
| |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.popView()" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.navigationStack.source[0].instance == null" value="false" /> |
| </body> |
| |
| </TestCase> |
| |
| <TestCase testID="inActiveViewsNotAccessibleWhenDestructionIsNever" description="Verify the active property of disabled view is false until reactivated" keywords="[pushView, popView]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="navigator().pushView(views.Sect1View1)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.activeView.destructionPolicy = 'never'" /> |
| </setup> |
| |
| <body> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.navigationStack.source[0].instance == null" value="false" /> |
| |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.navigationStack.source[0].instance == null" value="false" /> |
| |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.popView()" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.navigationStack.source[0].instance == null" value="false" /> |
| </body> |
| |
| </TestCase> |
| |
| <TestCase testID="arrayPersistence" description="Verify array data set in a view is persisted." keywords="[pushView, popView]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2, basicArray)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| </setup> |
| |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.data != basicArray" value="true" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.popView()" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.data == basicArray" value="true" /> |
| </body> |
| |
| </TestCase> |
| |
| <TestCase testID="customObjectPersistence" description="Verify custom object data set in a view is persisted." keywords="[Button, pushView, popView]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2, customObject)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| </setup> |
| |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(views.Sect1View2)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.data != customObject" value="true" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.popView()" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.data == customObject" value="true" /> |
| </body> |
| |
| </TestCase> |
| |
| <!-- SDK-27823 --> |
| <TestCase testID="setProperties" description="" keywords="[viewnavigator]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="navigator().pushView(views.Sect1View1)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.activeView.destructionPolicy = 'never'" /> |
| </setup> |
| |
| <body> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.title == 'Sect1View1'" value="true" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.activeView.title = 'New Title'" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.title == 'New Title'" value="true" /> |
| |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(Sect1View2)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.title == 'Sect1View2'" value="true" /> |
| |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.popView()" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.title == 'New Title'" value="true" /> |
| |
| </body> |
| |
| </TestCase> |
| |
| <!-- SDK-27823 --> |
| <TestCase testID="setProperties2" description="" keywords="[viewnavigator]"> |
| |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.resetApp()" waitTarget="navigator" waitEvent="myEvent" /> |
| <RunCode code="navigator().pushView(views.Sect1View1)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.activeView.destructionPolicy = 'auto'" /> |
| </setup> |
| |
| <body> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.title == 'Sect1View1'" value="true" /> |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.activeView.title = 'New Title'" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.title == 'New Title'" value="true" /> |
| |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(Sect1View2)" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.title == 'Sect1View2'" value="true" /> |
| |
| <RunCode code="FlexGlobals.topLevelApplication.navigator.popView()" waitTarget="navigator" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value = FlexGlobals.topLevelApplication.navigator.activeView.title == 'Sect1View1'" value="true" /> |
| |
| </body> |
| |
| </TestCase> |
| |
| </testCases> |
| |
| </UnitTester> |