| <?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/SplitViewNavigator/integration/" |
| testSWF="PersistenceApp.mxml"> |
| |
| <fx:Script> |
| <![CDATA[ |
| import mx.core.FlexGlobals; |
| import spark.components.ViewNavigator; |
| import flash.geom.Point; |
| import comps.*; |
| import spark.components.Callout; |
| import spark.layouts.*; |
| import views.*; |
| |
| public static function init(o:DisplayObject):void { }; |
| |
| private var myObj:Object = {product:'Flex',company:'Apache'}; |
| |
| ]]> |
| </fx:Script> |
| |
| <fx:Metadata><![CDATA[ [Mixin] ]]></fx:Metadata> |
| |
| <testCases> |
| |
| <!-- First check View2 doesn't have any data. Then pass myObj and verify data --> |
| <TestCase testID="Persistence_set_data_in_first_VN" keywords="[SplitViewNavigator, persistence manager]" description="Pass data between Views in the first view navigator as non-popup."> |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.vn1.pushView(views.View2)" waitTarget="vn1" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn1).activeView is views.View2" value="true" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn1).activeView.data==null" value="true"/> |
| <RunCode code="FlexGlobals.topLevelApplication.vn1.pushView(views.View1)" waitTarget="vn1" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn1).activeView is views.View1" value="true" /> |
| <RunCode code="FlexGlobals.topLevelApplication.switchViewWithData(FlexGlobals.topLevelApplication.vn1,this.myObj)" waitTarget="vn1" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn1).activeView is views.View2" value="true" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn1).activeView.data['product']=='Flex'" value="true" /> |
| </body> |
| </TestCase> |
| |
| <!-- First check View1 doesn't have any data. Then pass myObj and verify data --> |
| <TestCase testID="Persistence_set_data_in_second_VN" keywords="[SplitViewNavigator, persistence manager]" description="Pass data between Views in the second view navigator."> |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.vn2.pushView(views.View1)" waitTarget="vn2" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn2).activeView is views.View1" value="true" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn2).activeView.data==null" value="true"/> |
| <RunCode code="FlexGlobals.topLevelApplication.vn2.pushView(views.View2)" waitTarget="vn2" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn2).activeView is views.View2" value="true" /> |
| <RunCode code="FlexGlobals.topLevelApplication.switchViewWithData(FlexGlobals.topLevelApplication.vn2,this.myObj)" waitTarget="vn2" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn2).activeView is views.View1" value="true" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn2).activeView.data['company']=='Apache'" value="true" /> |
| |
| </body> |
| </TestCase> |
| |
| <!-- Pass data between views that are in the callout. --> |
| <TestCase testID="Persistence_set_data_in_callout" keywords="[SplitViewNavigator, persistence manager, Callout]" description="Pass data between Views in callout."> |
| <body> |
| <RunCode code="FlexGlobals.topLevelApplication.svn1.showFirstViewNavigatorInPopUp(FlexGlobals.topLevelApplication.vn2)" /> |
| <RunCode code="FlexGlobals.topLevelApplication.vn1.pushView(views.View2)" waitTarget="vn1" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn1).activeView is views.View2" value="true" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn1).activeView.data==null" value="true"/> |
| <RunCode code="FlexGlobals.topLevelApplication.vn1.pushView(views.View1)" waitTarget="vn1" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn1).activeView is views.View1" value="true" /> |
| <RunCode code="FlexGlobals.topLevelApplication.switchViewWithData(FlexGlobals.topLevelApplication.vn1,this.myObj)" waitTarget="vn1" waitEvent="viewChangeComplete" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn1).activeView is views.View2" value="true" /> |
| <AssertMethodValue method="value=ViewNavigator(FlexGlobals.topLevelApplication.vn1).activeView.data['company']=='Apache'" value="true" /> |
| </body> |
| </TestCase> |
| |
| <!-- Save/load data by calling saveViewData() and loadViewData(). --> |
| <TestCase testID="Persistence_save_view_data" keywords="[SplitViewNavigator, persistence manager, saveViewData, loadViewData]" description="Call saveViewData and loadViewData methods."> |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.svn1.hideViewNavigatorPopUp()" /> |
| </setup> |
| <body> |
| <!--<RunCode code="FlexGlobals.topLevelApplication.svn1.saveViewData()"/>--> |
| <AssertMethodValue method="value=FlexGlobals.topLevelApplication.svn1.saveViewData()['dataArray'].length" value="2" /> |
| |
| </body> |
| </TestCase> |
| |
| <!-- Save/load data by calling saveViewData() and loadViewData(). --> |
| <TestCase testID="Persistence_load_view_data" keywords="[SplitViewNavigator, persistence manager, saveViewData, loadViewData]" description="Call saveViewData and loadViewData methods."> |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.svn1.hideViewNavigatorPopUp()" /> |
| <RunCode code="FlexGlobals.topLevelApplication.persistenceManager.setProperty('navigatorState', FlexGlobals.topLevelApplication.svn1.saveViewData());" /> |
| <RunCode code ="FlexGlobals.topLevelApplication.persistenceManager.save();" /> |
| |
| </setup> |
| <body> |
| <RunCode code ="FlexGlobals.topLevelApplication.persistenceManager.load();" /> |
| <AssertMethodValue method="value=FlexGlobals.topLevelApplication.persistenceManager.getProperty('navigatorState')['dataArray'].length" value="2" /> |
| |
| <RunCode code="FlexGlobals.topLevelApplication.svn1.loadViewData(FlexGlobals.topLevelApplication.persistenceManager.getProperty('navigatorState'))" /> |
| <AssertPropertyValue target="svn1" propertyName="numViewNavigators" value="2" /> |
| </body> |
| </TestCase> |
| |
| </testCases> |
| </UnitTester> |