| <?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; |
| use namespace mx_internal; |
| |
| |
| private var propertyVal:String=""; |
| protected function saveProperty(prop:String):void |
| { |
| propertyVal=prop; |
| } |
| ]]> |
| </fx:Script> |
| |
| <testCases> |
| |
| <!-- Verify default values --> |
| <TestCase testID="ItemSnapping_snapping_default" keywords="[ItemSnapping, list]" description="verifies default values"> |
| <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.ListVertical)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <AssertPropertyValue target="navigator.activeView.itemList" propertyName="scrollSnappingMode" value="none" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ItemSnapping_default_paging" keywords="[ItemSnapping, list]" description="verifies default values"> |
| <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.ListVertical)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <AssertPropertyValue target="navigator.activeView.itemList" propertyName="pageScrollingEnabled" value="false" /> |
| </body> |
| </TestCase> |
| |
| <!-- SDK-31372 Regression for RTE --> |
| <TestCase testID="ItemSnapping_virtualLayoutFalse" keywords="[ItemSnapping, list]" description="verifies no RTE on virtual layout set to false in lists"> |
| <bugs> |
| <Bug bugID="SDK-31372" /> |
| </bugs> |
| <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.ListVertical)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <SetProperty target="navigator.activeView.itemList" propertyName="scrollSnappingMode" value="leadingEdge" /> |
| <SetProperty target="navigator.activeView.itemList" propertyName="useVirtualLayout" value="false" /> |
| <AssertPropertyValue target="navigator.activeView.itemList.dataGroup" propertyName="verticalScrollPosition" valueExpression="value=((application.navigator.activeView.itemList.layout as VerticalLayout).firstIndexInView)*application.navigator.activeView.itemList.dataGroup.height"/> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ItemSnapping_paging_largethrow_orientation" keywords="[ItemSnapping, List]" description="verifies any large throw aligns on a proper page when turned during an animation"> |
| <bugs> |
| <Bug bugID="SDK-31514" /> |
| </bugs> |
| <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.PagingHGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/> |
| <SetProperty target="navigator.activeView.imageScroller" propertyName="pageScrollingEnabled" value="true" /> |
| <!-- Intentionally not waiting for touchInteractionEndEvent for verifying the bug --> |
| <SimulateMouseGesture target="navigator.activeView.imageGroup" valueExpression="value=application.mouseSequences.throw_large_right" waitTarget="navigator.activeView.imageScroller"/> |
| <RunCode code="application.navigator.stage.setOrientation(StageOrientation.ROTATED_RIGHT)" waitTarget="stage" waitEvent="orientationChange" timeout="6000"/> |
| <WaitForLayoutManager /> |
| <AssertMethodValue method="value=application.navigator.activeView.imageGroup.horizontalScrollPosition % application.navigator.activeView.imageGroup.width" value="0" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ItemSnapping_snapping_list_horizontal_leadging_largethrow_orientation" keywords="[ItemSnapping, List, trailing]" description="verifies any throw on a list results in trailing edge snapped when rotated during animation"> |
| <bugs> |
| <Bug bugID="SDK-31147" /> |
| </bugs> |
| <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.ListHorizontal)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <SetProperty target="navigator.activeView.itemList" propertyName="scrollSnappingMode" value="leadingEdge" /> |
| <SimulateMouseGesture target="navigator.activeView.itemList" valueExpression="value=application.mouseSequences.throw_large_right" waitTarget="navigator.activeView.itemList" waitEvent="touchInteractionEnd" /> |
| <RunCode code="application.navigator.stage.setOrientation(StageOrientation.ROTATED_RIGHT)" waitTarget="stage" waitEvent="orientationChange" timeout="6000"/> |
| <!-- ensure scroll position aligns with the starting of first element in view --> |
| <AssertMethodValue method="value=ItemSnapping.isLeading(application.navigator.activeView.itemList.dataGroup,'horizontal')" value="true" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ItemSnapping_snapping_list_horizontal_leadging_largethrow_orientation_stopanimation" keywords="[ItemSnapping, List, trailing]" description="verifies any throw on a list results in trailing edge snapped when rotated during animation"> |
| <bugs> |
| <Bug bugID="SDK-31147" /> |
| </bugs> |
| <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.ListHorizontal)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <SetProperty target="navigator.activeView.itemList" propertyName="scrollSnappingMode" value="leadingEdge" /> |
| <SimulateMouseGesture target="navigator.activeView.itemList" valueExpression="value=application.mouseSequences.throw_large_right" waitTarget="navigator.activeView.itemList" /> |
| <!-- we wait for touchinteraction to end after orientation changes since a re throw occurs on orientation change and does not stop to snap --> |
| <RunCode code="application.navigator.stage.setOrientation(StageOrientation.ROTATED_RIGHT)" waitTarget="stage" waitEvent="touchInteractionEnd" timeout="6000"/> |
| <!-- ensure scroll position aligns with the starting of first element in view --> |
| <AssertMethodValue method="value=ItemSnapping.isLeading(application.navigator.activeView.itemList.dataGroup,'horizontal')" value="true" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="ItemSnapping_snapping_list_horizontal_leadging_largethrow_stopanimation" keywords="[ItemSnapping, List, trailing]" description="verifies any throw on a list results in trailing edge snapped when changed modes during animation"> |
| <bugs> |
| <Bug bugID="SDK-31049" /> |
| </bugs> |
| <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.ListHorizontal)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000" /> |
| <SetProperty target="navigator.activeView.itemList" propertyName="scrollSnappingMode" value="leadingEdge" /> |
| <SimulateMouseGesture target="navigator.activeView.itemList" valueExpression="value=application.mouseSequences.throw_large_right" waitTarget="navigator.activeView.itemList"/> |
| <SetProperty target="navigator.activeView.itemList" propertyName="scrollSnappingMode" value="trailingEdge" waitEvent="touchInteractionEnd"/> |
| <!-- ensure scroll position aligns with the starting of trailing element in view --> |
| <AssertMethodValue method="value=ItemSnapping.isTrailing(application.navigator.activeView.itemList.dataGroup,'horizontal')" value="true" /> |
| </body> |
| </TestCase> |
| </testCases> |
| </UnitTester> |