| <?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:s="library://ns.adobe.com/flex/spark" |
| xmlns="*" |
| testDir="mobile/components/List/integration/" |
| testSWF="ItemSnapping.mxml"> |
| |
| <fx:Script><![CDATA[ public static function init(o:DisplayObject):void { } ]]></fx:Script> |
| <fx:Metadata><![CDATA[ [Mixin] ]]></fx:Metadata> |
| |
| <fx:Script> |
| <![CDATA[ |
| import views.*; |
| import mx.events.TouchInteractionReason; |
| import mx.events.TouchInteractionEvent; |
| import mx.core.InteractionMode; |
| import spark.components.Scroller; |
| import spark.layouts.VerticalLayout; |
| import mx.core.FlexGlobals; |
| import comps.snappingTouchEvents; |
| |
| ]]> |
| </fx:Script> |
| |
| <testCases> |
| |
| <TestCase testID="ItemSnapping_programmatic_paging_random" keywords="[ItemSnapping, List]" description="verifies any random scroll position snaps at an item"> |
| <setup> |
| <ResetComponent target="navigator" className="comps.QANavigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <RunCode code="application.doResetOrientation()" waitTarget="stage" waitEvent="orientationChange" /> |
| </setup> |
| <body> |
| <RunCode code="application.navigator.pushView(views.PagingListTile)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <SetProperty target="navigator.activeView.itemList" propertyName="pageScrollingEnabled" value="true" /> |
| <SetProperty target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=Math.random()*application.navigator.activeView.itemList.dataGroup.height*application.navigator.activeView.itemList.dataGroup.numElements" waitEvent="propertyChange"/> |
| <!--<DispatchMouseEvent target="navigator.activeView.buttonRandScroll" type="click" localX="47" localY="20" />--> |
| <!-- ensure snapping lands at a complete page ie. verticalscroll position aligns with the starting of last absolute page --> |
| <AssertMethodValue method="value=application.navigator.activeView.itemList.dataGroup.verticalScrollPosition % application.navigator.activeView.itemList.dataGroup.height" value="0" /> |
| </body> |
| </TestCase> |
| |
| <!--<TestCase testID="ItemSnapping_programmatic_paging_atMultiples" keywords="[ItemSnapping, List]" description="verifies scroll position set at multiple of viewport height remains aligned"> |
| <bugs> |
| <Bug bugID="SDK-31505"/> |
| </bugs> |
| <setup> |
| <ResetComponent target="navigator" className="comps.QANavigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <RunCode code="application.doResetOrientation()" waitTarget="stage" waitEvent="orientationChange" /> |
| <RunCode code="application.navigator.pushView(views.PagingListTile)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <SetProperty target="navigator.activeView.itemList" propertyName="pageScrollingEnabled" value="true" /> |
| <SetProperty target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=application.navigator.activeView.itemList.dataGroup.height*2" waitEvent="propertyChange"/> |
| </setup> |
| <body> |
| <AssertMethodValue method="value=application.navigator.activeView.itemList.dataGroup.verticalScrollPosition % application.navigator.activeView.itemList.dataGroup.height" value="0" /> |
| <AssertPropertyValue target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=application.navigator.activeView.itemList.dataGroup.height*2"/> |
| </body> |
| </TestCase> --> |
| |
| <!--<TestCase testID="ItemSnapping_programmatic_paging_notaligned" keywords="[ItemSnapping, ProgrammaticSnapping]" description="verifies scroll position set less than 50% of an item snaps at same page"> |
| <bugs> |
| <Bug bugID="SDK-31505"/> |
| </bugs> |
| <setup> |
| <ResetComponent target="navigator" className="comps.QANavigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <RunCode code="application.doResetOrientation()" waitTarget="stage" waitEvent="orientationChange" /> |
| <RunCode code="application.navigator.pushView(views.PagingListTile)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <SetProperty target="navigator.activeView.itemList" propertyName="pageScrollingEnabled" value="true" /> |
| <SetProperty target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=application.navigator.activeView.itemList.dataGroup.height*2+5" waitEvent="propertyChange" /> |
| </setup> |
| <body> |
| <AssertMethodValue method="value=application.navigator.activeView.itemList.dataGroup.verticalScrollPosition % application.navigator.activeView.itemList.dataGroup.height" value="0" /> |
| <AssertPropertyValue target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=(2*application.navigator.activeView.itemList.dataGroup.height)"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ItemSnapping_programmatic_paging_midway" keywords="[ItemSnapping, ProgrammaticSnapping]" description="verifies scroll position set at midway of viewport height remains aligned"> |
| <bugs> |
| <Bug bugID="SDK-31505"/> |
| </bugs> |
| <setup> |
| <ResetComponent target="navigator" className="comps.QANavigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <RunCode code="application.doResetOrientation()" waitTarget="stage" waitEvent="orientationChange" /> |
| <RunCode code="application.navigator.pushView(views.PagingListTile)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <SetProperty target="navigator.activeView.itemList" propertyName="pageScrollingEnabled" value="true" /> |
| <SetProperty target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=application.navigator.activeView.itemList.dataGroup.height*5/2" waitEvent="propertyChange"/> |
| </setup> |
| <body> |
| <AssertMethodValue method="value=application.navigator.activeView.itemList.dataGroup.verticalScrollPosition % application.navigator.activeView.itemList.dataGroup.height" value="0" /> |
| <AssertPropertyValue target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=(3*application.navigator.activeView.itemList.dataGroup.height)"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ItemSnapping_programmatic_paging_last" keywords="[SDK-31365, ItemSnapping, List]" description="verifies scroll position set at at last item when vertical position is set out of upper bounds"> |
| <bugs> |
| <Bug bugID="SDK-31365, SDK-31505"/> |
| </bugs> |
| <setup> |
| <ResetComponent target="navigator" className="comps.QANavigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <RunCode code="application.doResetOrientation()" waitTarget="stage" waitEvent="orientationChange" /> |
| <RunCode code="application.navigator.pushView(views.PagingListTile)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <SetProperty target="navigator.activeView.itemList" propertyName="pageScrollingEnabled" value="true"/> |
| <SetProperty target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=(application.navigator.activeView.itemList.dataGroup.numElements)*application.navigator.activeView.itemList.dataGroup.height" waitEvent="propertyChange"/> |
| </setup> |
| <body> |
| <AssertPropertyValue target="navigator.activeView.itemList" propertyName="pageScrollingEnabled" value="true" /> |
| <AssertMethodValue method="value=application.navigator.activeView.itemList.dataGroup.verticalScrollPosition % application.navigator.activeView.itemList.dataGroup.height" value="0" /> |
| <AssertMethodValue method="value=application.navigator.activeView.itemList.dataGroup.getItemIndicesInView().sort(Array.NUMERIC).pop()" valueExpression="value=(application.navigator.activeView.itemList.dataGroup.numElements-1)" /> |
| </body> |
| </TestCase> |
| --> |
| |
| <TestCase testID="ItemSnapping_paging_smalldrag" keywords="[ItemSnapping, List]" description="verifies any small drag less than 50% snaps back to the same item in paging mode"> |
| <setup> |
| <ResetComponent target="navigator" className="comps.QANavigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <RunCode code="application.doResetOrientation()" waitTarget="stage" waitEvent="orientationChange" /> |
| </setup> |
| <body> |
| <RunCode code="application.navigator.pushView(views.PagingListTile)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <RunCode code="application.navigator.activeView.itemList.addEventListener('touchInteractionEnd',function(e:Event):void{trace('hello');})" /> |
| <SetProperty target="navigator.activeView.itemList" propertyName="pageScrollingEnabled" value="true" /> |
| <SimulateMouseGesture target="navigator.activeView.itemList" dragYFrom="25%" dragYTo="0" dragXFrom="50%" dragXTo="50%" waitTarget="navigator.activeView.itemList" waitEvent="touchInteractionEnd" /> |
| <AssertPropertyValue target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" value="0"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ItemSnapping_paging_largedrag" keywords="[ItemSnapping, List]" description="verifies any drag changes scroll position to next item in paging mode"> |
| <setup> |
| <ResetComponent target="navigator" className="comps.QANavigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <RunCode code="application.doResetOrientation()" waitTarget="stage" waitEvent="orientationChange" /> |
| </setup> |
| <body> |
| <RunCode code="application.navigator.pushView(views.PagingListTile)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <SetProperty target="navigator.activeView.itemList" propertyName="pageScrollingEnabled" value="true" /> |
| <SimulateMouseGesture target="navigator.activeView.itemList" dragYFrom="90%" dragYTo="0" dragXFrom="50%" dragXTo="50%" waitEvent="touchInteractionEnd"/> |
| <AssertPropertyValue target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=application.navigator.activeView.itemList.dataGroup.height"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ItemSnapping_paging_largethrow" keywords="[ItemSnapping, List]" description="verifies any large throw changes scroll position to next item in paging mode"> |
| <setup> |
| <ResetComponent target="navigator" className="comps.QANavigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <RunCode code="application.doResetOrientation()" waitTarget="stage" waitEvent="orientationChange" /> |
| </setup> |
| <body> |
| <RunCode code="application.navigator.pushView(views.PagingListTile)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <SetProperty target="navigator.activeView.itemList" propertyName="pageScrollingEnabled" value="true" /> |
| <SimulateMouseGesture target="navigator.activeView.itemList" valueExpression="value=application.mouseSequences.throw_large_down" waitTarget="navigator.activeView.itemList" waitEvent="touchInteractionEnd" /> |
| <AssertPropertyValue target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=application.navigator.activeView.itemList.dataGroup.height"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ItemSnapping_paging_smallthrow" keywords="[ItemSnapping, List]" description="verifies any small throw snaps back on the same item"> |
| <setup> |
| <ResetComponent target="navigator" className="comps.QANavigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <RunCode code="application.doResetOrientation()" waitTarget="stage" waitEvent="orientationChange" /> |
| </setup> |
| <body> |
| <RunCode code="application.navigator.pushView(views.PagingListTile)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <SetProperty target="navigator.activeView.itemList" propertyName="pageScrollingEnabled" value="true" /> |
| <SimulateMouseGesture target="navigator.activeView.itemList" valueExpression="value=application.mouseSequences.throw_small_down" waitTarget="navigator.activeView.itemList" waitEvent="touchInteractionEnd" /> |
| <AssertPropertyValue target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=0"/> |
| </body> |
| </TestCase> |
| |
| </testCases> |
| </UnitTester> |