blob: 43c31ca841befe8f3a0e712bb74323d2d8555fae [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/StageText/methods/"
testSWF="StageText.mxml" xmlns:mx="library://ns.adobe.com/flex/mx">
<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.core.FlexGlobals;
]]>
</fx:Script>
<testCases>
<TestCase testID="TextInput_selectAll_nominal" keywords="[StageText, TextInput, selectAll, Methods]" description="Verify that selectAll selects all text.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
</setup>
<body>
<SetProperty target="navigator.activeView.lvTextInput" propertyName="height" value="100" waitEvent="updateComplete"/>
<SetProperty target="navigator.activeView.lvTextInput" propertyName="text" value="Short string" waitEvent="updateComplete"/>
<RunCode code="application.navigator.activeView.lvTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.selectAll()"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionAnchorPosition"
value="0"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="12"/>
<CompareBitmap target="navigator.activeView.lvTextInput" stageText="true" url="../methods/baselines/TextInput/">
<ConditionalValue deviceDensity="160" os="qnx"/>
<ConditionalValue deviceDensity="240" os="android"/>
<ConditionalValue deviceDensity="320" os="iphone"/>
</CompareBitmap>
</body>
</TestCase>
<TestCase testID="TextInput_selectRange_nominal" keywords="[StageText, TextInput, selectRange, Methods]" description="Verify that selectRange selects the correct range of text.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
</setup>
<body>
<SetProperty target="navigator.activeView.lvTextInput" propertyName="text" value="Short string" waitEvent="updateComplete"/>
<RunCode code="application.navigator.activeView.lvTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.selectRange(2,8)"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionAnchorPosition"
value="2"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="8"/>
<CompareBitmap target="navigator.activeView.lvTextInput" stageText="true" url="../methods/baselines/TextInput/">
<ConditionalValue deviceDensity="160" os="qnx"/>
<ConditionalValue deviceDensity="240" os="android"/>
<ConditionalValue deviceDensity="320" os="iphone"/>
</CompareBitmap>
</body>
</TestCase>
<TestCase testID="TextInput_selectRange_state_change" keywords="[StageText, TextInput, selectRange, Methods]" description="Verify that selected text stays selected on a state change.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.TextSelectionStateView)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
</setup>
<body>
<RunCode code="application.navigator.activeView.ssTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.ssTextInput"/>
<RunCode code="application.navigator.activeView.ssTextInput.selectRange(2,10)"
waitEvent="updateComplete"
waitTarget="navigator.activeView.ssTextInput"/>
<RunCode code="application.navigator.activeView.changeState()"
waitEvent="updateComplete"
waitTarget="navigator.activeView"/>
<RunCode code="application.navigator.activeView.changeState()"
waitEvent="updateComplete"
waitTarget="navigator.activeView.ssTextInput"/>
<AssertPropertyValue target="navigator.activeView.ssTextInput"
propertyName="selectionAnchorPosition"
value="2"/>
<AssertPropertyValue target="navigator.activeView.ssTextInput"
propertyName="selectionActivePosition"
value="10"/>
</body>
</TestCase>
<TestCase testID="TextInput_selectRange_softKeyboard_toggle" keywords="[StageText, TextInput, selectRange, Methods, SoftKeyboard]" description="Verify that selected text stays selected on when the Soft Keyboard is opened.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.TextSelectionStateView)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
</setup>
<body>
<RunCode code="application.navigator.activeView.ssTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.ssTextInput"/>
<RunCode code="application.navigator.activeView.ssTextInput.selectRange(2,10)"
waitEvent="updateComplete"
waitTarget="navigator.activeView.ssTextInput"/>
<DispatchMouseClickEvent target="navigator.activeView.ssTextInput" localX="5" localY="5" waitEvent="click"/>
<AssertEvent target="navigator.activeView.ssTextInput" eventName="softKeyboardActivate" eventClass="flash.events::SoftKeyboardEvent" numExpectedEvents="-1"/>
<AssertPropertyValue target="navigator.activeView.ssTextInput"
propertyName="selectionAnchorPosition"
value="2"/>
<AssertPropertyValue target="navigator.activeView.ssTextInput"
propertyName="selectionActivePosition"
value="10"/>
</body>
</TestCase>
<TestCase testID="TextInput_selectAll_empty" keywords="[StageText, TextInput, selectAll, Methods]" description="Verify that selectAll works with an empty run of text.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
<SetProperty target="navigator.activeView.lvTextInput" propertyName="height" value="150" waitEvent="updateComplete"/>
<SetProperty target="navigator.activeView.lvTextInput" propertyName="text" value="" waitEvent="updateComplete"/>
</setup>
<body>
<RunCode code="application.navigator.activeView.lvTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.selectAll()"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionAnchorPosition"
value="0"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="0"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="text"
value=""/>
</body>
</TestCase>
<TestCase testID="TextInput_selectAll_overwrite" keywords="[StageText, TextInput, selectAll, Methods]" description="Verify that selectAll correctly overwrites.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
<SetProperty target="navigator.activeView.lvTextInput" propertyName="height" value="150" waitEvent="updateComplete"/>
</setup>
<body>
<RunCode code="application.navigator.activeView.lvTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.selectAll()"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.insertText('hello')"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionAnchorPosition"
value="5"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="5"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="text"
value="hello"/>
</body>
</TestCase>
<TestCase testID="TextInput_selectAll_state_change" keywords="[StageText, TextInput, selectAll, Methods]" description="Verify that selected text stays selected on a state change.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.TextSelectionStateView)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
</setup>
<body>
<RunCode code="application.navigator.activeView.ssTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.ssTextInput"/>
<RunCode code="application.navigator.activeView.ssTextInput.selectAll()"
waitEvent="updateComplete"
waitTarget="navigator.activeView.ssTextInput"/>
<RunCode code="application.navigator.activeView.changeState()"
waitEvent="updateComplete"
waitTarget="navigator.activeView"/>
<RunCode code="application.navigator.activeView.changeState()"
waitEvent="updateComplete"
waitTarget="navigator.activeView.ssTextInput"/>
<AssertPropertyValue target="navigator.activeView.ssTextInput"
propertyName="selectionAnchorPosition"
value="0"/>
<AssertPropertyValue target="navigator.activeView.ssTextInput"
propertyName="selectionActivePosition"
value="21"/>
</body>
</TestCase>
<TestCase testID="TextInput_selectAll_softKeyboard_toggle" keywords="[StageText, TextInput, selectAll, Methods, SoftKeyboard]" description="Verify that selected text stays selected on when the Soft Keyboard is opened.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.TextSelectionStateView)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
</setup>
<body>
<RunCode code="application.navigator.activeView.ssTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.ssTextInput"/>
<RunCode code="application.navigator.activeView.ssTextInput.selectAll()"
waitEvent="updateComplete"
waitTarget="navigator.activeView.ssTextInput"/>
<DispatchMouseClickEvent target="navigator.activeView.ssTextInput" localX="5" localY="5" waitEvent="click"/>
<AssertEvent target="navigator.activeView.ssTextInput" eventName="softKeyboardActivate" eventClass="flash.events::SoftKeyboardEvent" numExpectedEvents="-1"/>
<AssertPropertyValue target="navigator.activeView.ssTextInput"
propertyName="selectionAnchorPosition"
value="0"/>
<AssertPropertyValue target="navigator.activeView.ssTextInput"
propertyName="selectionActivePosition"
value="21"/>
</body>
</TestCase>
<TestCase testID="TextInput_insertText_empty" keywords="[StageText, TextInput, insertText, Methods]" description="Verify that you can insert text in an empty field." bugs="[SDK-30925]">
<setup>
<!--<SetProperty target="navigator.activeView.lvTextInput" propertyName="height" value="304" waitEvent="updateComplete"/>-->
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
<SetProperty propertyName="text" target="navigator.activeView.lvTextInput" value=""/>
</setup>
<body>
<RunCode code="application.navigator.activeView.lvTextInput.insertText('fish')"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.insertText('stick')"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="text"
value="fishstick"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="9"/>
</body>
</TestCase>
<TestCase testID="TextInput_insertText_overwrite" keywords="[StageText, TextInput, insertText, Methods]" description="Verify that you can insert text over a section of text." bugs="[SDK-30925]">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
<SetProperty propertyName="text" target="navigator.activeView.lvTextInput" value="fishnet"/>
</setup>
<body>
<RunCode code="application.navigator.activeView.lvTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.selectRange(4,7)"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.insertText('stick')"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="text"
value="fishstick"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="9"/>
</body>
</TestCase>
<TestCase testID="TextInput_appendText_empty" keywords="[StageText, TextInput, appendText, Methods]" description="Verify that you can append text in an empty field." bugs="[SDK-30925]">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
<SetProperty propertyName="text" target="navigator.activeView.lvTextInput" value=""/>
</setup>
<body>
<RunCode code="application.navigator.activeView.lvTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.appendText('fish')"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.appendText('stick')"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="text"
value="fishstick"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="9"/>
</body>
</TestCase>
<TestCase testID="TextInput_appendText_overwrite" keywords="[StageText, TextInput, insertText, Methods]" description="Verify that you can append text with selection and not overwrite." bugs="[SDK-30925]">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
<SetProperty propertyName="text" target="navigator.activeView.lvTextInput" value="fishnet"/>
</setup>
<body>
<RunCode code="application.navigator.activeView.lvTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.selectRange(4,7)"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.appendText('stick')"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="text"
value="fishnetstick"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="12"/>
</body>
</TestCase>
<TestCase testID="TextInput_insertText_top" keywords="[StageText, TextInput, insertText, Methods]" description="Verify that you can insert text with the cursor at the start of the run.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
<SetProperty propertyName="text" target="navigator.activeView.lvTextInput" value="stick"/>
</setup>
<body>
<RunCode code="application.navigator.activeView.lvTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.selectRange(0,0)"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.insertText('fish')"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="text"
value="fishstick"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="4"/>
</body>
</TestCase>
<TestCase testID="TextInput_insertText_middle" keywords="[StageText, TextInput, insertText, Methods]" description="Verify that you can insert text in the middle of a run.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
<SetProperty propertyName="text" target="navigator.activeView.lvTextInput" value="fick"/>
</setup>
<body>
<RunCode code="application.navigator.activeView.lvTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.selectRange(2,2)"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.insertText('shsti')"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="text"
value="fishstick"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="7"/>
</body>
</TestCase>
<TestCase testID="TextInput_insertText_end" keywords="[StageText, TextInput, insertText, Methods]" description="Verify that you can insert text in the end of a run.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
<SetProperty propertyName="text" target="navigator.activeView.lvTextInput" value="fish"/>
</setup>
<body>
<RunCode code="application.navigator.activeView.lvTextInput.setFocus()" waitEvent="focusIn" waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.selectRange(4,4)"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<RunCode code="application.navigator.activeView.lvTextInput.insertText('stick')"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="text"
value="fishstick"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="9"/>
</body>
</TestCase>
<!-- Not for Mega
<TestCase testID="TextInput_scrollToRange_nominal" keywords="[StageText, TextInput, scrollToRange, Methods]" description="Verify that scrollToRange scrolls to the correct range of text.">
<setup>
<RunCode code="application.stage.focus=null" />
<ResetComponent target="navigator" className="comps.QANavigator"
waitEvent="viewChangeComplete" />
<RunCode code="application.navigator.pushView(views.LoremView100)"
waitTarget="navigator" waitEvent="viewChangeComplete"
timeout="7000" />
</setup>
<body>
<RunCode code="application.navigator.activeView.lvTextInput.scrollToRange(2000,2100)"
waitEvent="updateComplete"
waitTarget="navigator.activeView.lvTextInput"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionAnchorPosition"
value="2000"/>
<AssertPropertyValue target="navigator.activeView.lvTextInput"
propertyName="selectionActivePosition"
value="2100"/>
<CompareBitmap target="navigator.activeView.lvTextInput" stageText="true" url="../methods/baselines/TextInput/">
<ConditionalValue deviceDensity="160" os="qnx"/>
<ConditionalValue deviceDensity="240" os="android"/>
<ConditionalValue deviceDensity="320" os="iphone"/>
</CompareBitmap>
</body>
</TestCase>-->
</testCases>
</UnitTester>