blob: 04c69f7a59356ce4eb928dd58ab68083075a975c [file]
<?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 testDir="mobile/components/TextInput/Integration/"
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="*"
testSWF="TextInput3.mxml">
<!-- this set of lines form a template that must be in each unit test -->
<fx:Script>
<![CDATA[
public static function init(o:DisplayObject):void
{
}
]]>
</fx:Script>
<fx:Metadata>
<![CDATA[
[Mixin]
]]>
</fx:Metadata>
<!-- end of set of lines that must be in each unit test -->
<fx:Script>
<![CDATA[
import components.*;
import mx.core.FlexGlobals;
import mx.utils.StringUtil;
import spark.components.TextInput;
import spark.components.supportClasses.*;
import spark.skins.mobile.*;
]]>
</fx:Script>
<testCases>
<!-- ******************** Here are a few basic states tests. ******************** -->
<TestCase testID="TextInput_states_test1" keywords="[TextInput, states]" description="Check values when the view has loaded." >
<setup>
<!--<RunCode code="FlexGlobals.topLevelApplication.doPopAll()" waitTarget="navigator" waitEvent="viewChangeComplete" />
<RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(components.TextInputView5)" waitTarget="navigator" waitEvent="viewChangeComplete" />-->
<ResetComponent target="tic5" className="components.TextInputComp5" waitEvent="updateComplete" />
</setup>
<body>
<CompareBitmap numColorVariances="4" maxColorVariance="16" url="../Integration/baselines" target="tic5.grp1">
<ConditionalValue deviceDensity="160" />
<ConditionalValue deviceDensity="240" />
<ConditionalValue deviceDensity="320" />
<ConditionalValue deviceDensity="320" os="ios" />
<ConditionalValue deviceDensity="160" os="qnx" />
</CompareBitmap>
</body>
</TestCase>
<TestCase testID="TextInput_states_test2" keywords="[TextInput, states]" description="Check values in state2." >
<setup>
<!--<RunCode code="FlexGlobals.topLevelApplication.doPopAll()" waitTarget="navigator" waitEvent="viewChangeComplete" />
<RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(components.TextInputView5)" waitTarget="navigator" waitEvent="viewChangeComplete" />-->
<ResetComponent target="tic5" className="components.TextInputComp5" waitEvent="updateComplete" />
</setup>
<body>
<SetProperty target="tic5" propertyName="currentState" value="state2" waitTarget="tic5.ti1" waitEvent="updateComplete" />
<CompareBitmap numColorVariances="4" maxColorVariance="16" url="../Integration/baselines" target="tic5.grp1">
<ConditionalValue deviceDensity="160" />
<ConditionalValue deviceDensity="240" />
<ConditionalValue deviceDensity="320" />
<ConditionalValue deviceDensity="320" os="ios" />
<ConditionalValue deviceDensity="160" os="qnx" />
</CompareBitmap>
</body>
</TestCase>
<TestCase testID="TextInput_states_test3" keywords="[TextInput, states]" description="Go to state2, then back to state1." >
<setup>
<!--<RunCode code="FlexGlobals.topLevelApplication.doPopAll()" waitTarget="navigator" waitEvent="viewChangeComplete" />
<RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(components.TextInputView5)" waitTarget="navigator" waitEvent="viewChangeComplete" />-->
<ResetComponent target="tic5" className="components.TextInputComp5" waitEvent="updateComplete" />
</setup>
<body>
<SetProperty target="tic5" propertyName="currentState" value="state2" waitTarget="tic5.ti1" waitEvent="updateComplete" />
<SetProperty target="tic5" propertyName="currentState" value="state1" waitTarget="tic5.ti1" waitEvent="updateComplete" />
<CompareBitmap numColorVariances="4" maxColorVariance="16" url="../Integration/baselines" target="tic5.grp1">
<ConditionalValue deviceDensity="160" />
<ConditionalValue deviceDensity="240" />
<ConditionalValue deviceDensity="320" />
<ConditionalValue deviceDensity="320" os="ios" />
<ConditionalValue deviceDensity="160" os="qnx" />
</CompareBitmap>
</body>
</TestCase>
<TestCase testID="TextInput_states_test4" keywords="[TextInput, states]" description="Be sure edited text is saved when returning to prev. state." >
<setup>
<!--<RunCode code="FlexGlobals.topLevelApplication.doPopAll()" waitTarget="navigator" waitEvent="viewChangeComplete" />
<RunCode code="FlexGlobals.topLevelApplication.navigator.pushView(components.TextInputView5)" waitTarget="navigator" waitEvent="viewChangeComplete" />-->
<ResetComponent target="tic5" className="components.TextInputComp5" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="FlexGlobals.topLevelApplication.tic5.ti2.focusManager.setFocus(FlexGlobals.topLevelApplication.tic5.ti2)" waitEvent="focusIn" waitTarget="tic5.ti2" />
<SetProperty target="tic5.ti2" propertyName="text" value="yo" waitTarget="tic5.ti2" waitEvent="updateComplete" />
<SetProperty target="tic5" propertyName="currentState" value="state2" waitTarget="tic5.ti2" waitEvent="updateComplete" />
<SetProperty target="tic5" propertyName="currentState" value="state1" waitTarget="tic5.ti2" waitEvent="updateComplete" />
<AssertPropertyValue target="tic5.ti2" propertyName="text" value="yo"/>
</body>
</TestCase>
</testCases>
</UnitTester>