blob: 19c2199d1b1895eb5981a4a15667c752b063e271 [file] [log] [blame]
<?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 spark.layouts.VerticalLayout;
import mx.core.FlexGlobals;
import comps.snappingTouchEvents;
import spark.components.DataGroup;
]]>
</fx:Script>
<testCases>
<TestCase testID="ItemSnapping_snapping_group_tilecolumnwise_leading_prog" keywords="[ItemSnapping, List]" description="verifies any prog transition on a tile group results in leading edge snapped">
<bugs>
<Bug bugID="SDK-31511"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="leadingEdge" />
<!-- set scroll position to ensure snapping at a particular item - see bug -->
<SetProperty target="navigator.activeView.imageGroup" propertyName="verticalScrollPosition" valueExpression="value=application.navigator.activeView.imageGroup.height*2" waitEvent="propertyChange"/>
<SetProperty target="navigator.activeView.imageGroup" propertyName="orientation" value="columns" waitEvent="propertyChange"/>
<!-- ensure snapping lands at a complete page ie. verticalscroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isLeading(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_leading_prog" keywords="[ItemSnapping, List]" description="verifies any prog transition on a tile group results in leading edge snapped">
<bugs>
<Bug bugID="SDK-31511"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="leadingEdge" />
<!-- set scroll position to ensure snapping at a particular item - see bug -->
<SetProperty target="navigator.activeView.imageGroup" propertyName="verticalScrollPosition" valueExpression="value=application.navigator.activeView.imageGroup.height*2" waitEvent="propertyChange"/>
<SetProperty target="navigator.activeView.imageGroup" propertyName="verticalGap" value="0" waitEvent="updateComplete"/>
<!-- ensure snapping lands at a complete page ie. verticalscroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isLeading(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_leading_smalldrag" keywords="[ItemSnapping, List]" description="verifies any prog transition on a tile group results in leading edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="leadingEdge" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" dragYFrom="35%" dragYTo="0" dragXFrom="100" dragXTo="100" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure snapping lands at a complete page ie. verticalscroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isLeading(application.navigator.activeView.imageGroup,'vertical')" value="true" />
<!-- alternative approach to verifying snapping in tile
<AssertMethodValue method="value=application.navigator.activeView.imageGroup.verticalScrollPosition % (application.navigator.activeView.imageGroup.rowHeight + application.navigator.activeView.imageGroup.verticalGap)" value="0" />
-->
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_leading_largedrag" keywords="[ItemSnapping, List]" description="verifies any prog transition on a vertical group results in leading edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="leadingEdge" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" dragYFrom="95%" dragYTo="0" dragXFrom="100" dragXTo="100" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<!-- <AssertMethodValue method="value=(application.navigator.activeView.imageGroup.verticalScrollPosition % (application.navigator.activeView.imageGroup.getElementAt(0).height+6)) &lt;= 1" value="true" />
--> <AssertMethodValue method="value=ItemSnapping.isLeading(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_leading_smallthrow" keywords="[ItemSnapping, List]" description="verifies any small throw on a vertical group results in leading edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="leadingEdge" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" valueExpression="value=application.mouseSequences.throw_small_down" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isLeading(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_leading_largethrow" keywords="[ItemSnapping, List]" description="verifies any large throw on a vertical group results in leading edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="leadingEdge" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" valueExpression="value=application.mouseSequences.throw_large_down" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isLeading(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_trailing_prog" keywords="[ItemSnapping, List, trailing]" description="verifies any drag on a group results in trailing edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="trailingEdge" />
<SetProperty target="navigator.activeView.imageGroup" propertyName="verticalScrollPosition" valueExpression="value=application.navigator.activeView.imageGroup.height*2" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isTrailing(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_trailing_smalldrag" keywords="[ItemSnapping, List, trailing]" description="verifies any drag on a group results in trailing edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="trailingEdge" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" dragYFrom="25%" dragYTo="0" dragXFrom="100" dragXTo="100" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isTrailing(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_trailing_largedrag" keywords="[ItemSnapping, List, trailing]" description="verifies any drag on a group results in trailing edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="trailingEdge" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" dragYFrom="95%" dragYTo="0" dragXFrom="100" dragXTo="100" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isTrailing(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_trailing_smallthrow" keywords="[ItemSnapping, List, trailing]" description="verifies any drag on a group results in trailing edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="trailingEdge" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" valueExpression="value=application.mouseSequences.throw_small_down" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isTrailing(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_trailing_largethrow" keywords="[ItemSnapping, List, trailing]" description="verifies any drag on a group results in trailing edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="trailingEdge" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" valueExpression="value=application.mouseSequences.throw_large_down" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isTrailing(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_center_prog" keywords="[ItemSnapping, List, center]" description="verifies any drag on a group results in center edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="center" />
<SetProperty target="navigator.activeView.imageGroup" propertyName="verticalScrollPosition" valueExpression="value=application.navigator.activeView.imageGroup.height*2" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isCenterTile(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_center_smalldrag" keywords="[ItemSnapping, List, center]" description="verifies any drag on a group results in center edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="center" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" dragYFrom="25%" dragYTo="0" dragXFrom="100" dragXTo="100" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isCenterTile(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_center_largedrag" keywords="[ItemSnapping, List, center]" description="verifies any drag on a group results in center edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="center" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" dragYFrom="95%" dragYTo="0" dragXFrom="100" dragXTo="100" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isCenterTile(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_center_smallthrow" keywords="[ItemSnapping, List, center]" description="verifies any drag on a group results in center edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="center" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" valueExpression="value=application.mouseSequences.throw_small_down" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isCenterTile(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
<TestCase testID="ItemSnapping_snapping_group_tile_center_largethrow" keywords="[ItemSnapping, List, center]" description="verifies any drag on a group results in center edge snapped">
<bugs>
<Bug bugID="SDK-31506"/>
</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.SnappingTileGroup)" waitTarget="navigator" waitEvent="viewChangeComplete" timeout="6000"/>
<SetProperty target="navigator.activeView.imageScroller" propertyName="scrollSnappingMode" value="center" />
<SimulateMouseGesture target="navigator.activeView.imageScroller" valueExpression="value=application.mouseSequences.throw_large_down" waitTarget="navigator.activeView.imageScroller" waitEvent="touchInteractionEnd" />
<!-- ensure scroll position aligns with the starting of first element in view -->
<AssertMethodValue method="value=ItemSnapping.isCenterTile(application.navigator.activeView.imageGroup,'vertical')" value="true" />
</body>
</TestCase>
</testCases>
</UnitTester>