blob: 9274097aaa4e96f97250ff9a68fcbb165d43e7b9 [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 testDir="apollo/spark/components/WindowedApplication/methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="wa_properties_heightwidth.mxml">
<!-- this set of lines form a template that must be in each unit test -->
<mx:Script>
<![CDATA[
public static function init(o:DisplayObject):void
{
}
]]>
</mx:Script>
<mx:Metadata>
<![CDATA[
[Mixin]
]]>
</mx:Metadata>
<!-- end of set of lines that must be in each unit test -->
<mx:Script>
<![CDATA[
import flash.system.Capabilities;
import mx.core.FlexGlobals;
import spark.components.*;
import spark.skins.spark.SparkChromeWindowedApplicationSkin ;
]]>
</mx:Script>
<testCases>
<!--
========================================================
Test maximize()
- The maximizable property is tested elsewhere. Here,
we're just testing that maximmize() maximizes, which is
a similar, partly duplicated, set of tests.
- Clicking the maximize button to maximize is also
tested in the maximizable tests.
========================================================
-->
<TestCase testID="maximize_test1_WindowedApplicationSkin" keywords="[WindowedApplication,maximize]" description="Maximize when in the restored state." >
<setup>
<RunCode code="FlexGlobals.topLevelApplication.doReset()" waitTarget="" waitEvent="resetComplete" />
<SetProperty target="" propertyName="maxHeight" value="10000" />
<WaitForEvent numExpectedEvents="1" eventName="maxHeightChanged" target="" timeout="2000" />
<SetProperty target="" propertyName="maxWidth" value="10000" />
<WaitForEvent numExpectedEvents="1" eventName="maxWidthChanged" target="" timeout="2000" />
</setup>
<body>
<SetStyle target="" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" />
<RunCode code="FlexGlobals.topLevelApplication.maximize()" waitTarget="" waitEvent="windowResize" />
<Pause timeout="400"/>
<AssertPropertyValue target="nativeWindow" propertyName="displayState" value="maximized" />
<AssertMethodValue method="value = (Capabilities.screenResolutionX >= FlexGlobals.topLevelApplication.width) &amp;&amp; (FlexGlobals.topLevelApplication.width >= FlexGlobals.topLevelApplication.screenWidthFudged)" value="true" />
<AssertMethodValue method="value = (Capabilities.screenResolutionY >= FlexGlobals.topLevelApplication.height) &amp;&amp; (FlexGlobals.topLevelApplication.height >= FlexGlobals.topLevelApplication.screenHeightFudged)" value="true" />
<AssertPropertyValue target="btn1" propertyName="top" value="0" />
<AssertPropertyValue target="btn1" propertyName="left" value="0" />
<AssertPropertyValue target="btn2" propertyName="top" value="0" />
<AssertPropertyValue target="btn2" propertyName="right" value="0" />
<AssertPropertyValue target="btn3" propertyName="left" value="0" />
<AssertPropertyValue target="btn3" propertyName="bottom" value="0" />
<AssertPropertyValue target="btn4" propertyName="right" value="0" />
<AssertPropertyValue target="btn4" propertyName="bottom" value="0" />
<RunCode code="FlexGlobals.topLevelApplication.restore()" />
</body>
</TestCase>
<TestCase testID="maximize_test2_WindowedApplicationSkin" keywords="[WindowedApplication,maximize]" description="Maximize when maximized. We must use Pause." >
<setup>
<RunCode code="FlexGlobals.topLevelApplication.doReset()" waitTarget="" waitEvent="resetComplete" />
<SetProperty target="" propertyName="maxHeight" value="10000" />
<WaitForEvent numExpectedEvents="1" eventName="maxHeightChanged" target="" timeout="2000" />
<SetProperty target="" propertyName="maxWidth" value="10000" />
<WaitForEvent numExpectedEvents="1" eventName="maxWidthChanged" target="" timeout="2000" />
</setup>
<body>
<SetStyle target="" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" />
<RunCode code="FlexGlobals.topLevelApplication.maximize()" waitTarget="" waitEvent="windowResize" />
<RunCode code="FlexGlobals.topLevelApplication.maximize()" />
<Pause timeout="200" />
<AssertPropertyValue target="nativeWindow" propertyName="displayState" value="maximized" />
<AssertMethodValue method="value = (Capabilities.screenResolutionX >= FlexGlobals.topLevelApplication.width) &amp;&amp; (FlexGlobals.topLevelApplication.width >= FlexGlobals.topLevelApplication.screenWidthFudged)" value="true" />
<AssertMethodValue method="value = (Capabilities.screenResolutionY >= FlexGlobals.topLevelApplication.height) &amp;&amp; (FlexGlobals.topLevelApplication.height >= FlexGlobals.topLevelApplication.screenHeightFudged)" value="true" />
<AssertPropertyValue target="btn1" propertyName="top" value="0" />
<AssertPropertyValue target="btn1" propertyName="left" value="0" />
<AssertPropertyValue target="btn2" propertyName="top" value="0" />
<AssertPropertyValue target="btn2" propertyName="right" value="0" />
<AssertPropertyValue target="btn3" propertyName="left" value="0" />
<AssertPropertyValue target="btn3" propertyName="bottom" value="0" />
<AssertPropertyValue target="btn4" propertyName="right" value="0" />
<AssertPropertyValue target="btn4" propertyName="bottom" value="0" />
<RunCode code="FlexGlobals.topLevelApplication.restore()" />
</body>
</TestCase>
<TestCase testID="maximize_test3_WindowedApplicationSkin" keywords="[WindowedApplication,maximize]" description="Maximize when minimized." >
<setup>
<RunCode code="FlexGlobals.topLevelApplication.doReset()" waitTarget="" waitEvent="resetComplete" />
<SetProperty target="" propertyName="maxHeight" value="10000" />
<WaitForEvent numExpectedEvents="1" eventName="maxHeightChanged" target="" timeout="2000" />
<SetProperty target="" propertyName="maxWidth" value="10000" />
<WaitForEvent numExpectedEvents="1" eventName="maxWidthChanged" target="" timeout="2000" />
<RunCode code="FlexGlobals.topLevelApplication.restore()" />
</setup>
<body>
<SetStyle target="" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" />
<RunCode code="FlexGlobals.topLevelApplication.minimize()" waitTarget="" waitEvent="displayStateChange" />
<RunCode code="FlexGlobals.topLevelApplication.maximize()" waitTarget="" waitEvent="displayStateChange" />
<Pause timeout="200"/>
<AssertPropertyValue target="nativeWindow" propertyName="displayState" value="maximized" />
<AssertMethodValue method="value = (Capabilities.screenResolutionX >= FlexGlobals.topLevelApplication.width) &amp;&amp; (FlexGlobals.topLevelApplication.width >= FlexGlobals.topLevelApplication.screenWidthFudged)" value="true" />
<AssertMethodValue method="value = (Capabilities.screenResolutionY >= FlexGlobals.topLevelApplication.height) &amp;&amp; (FlexGlobals.topLevelApplication.height >= FlexGlobals.topLevelApplication.screenHeightFudged)" value="true" />
<AssertPropertyValue target="btn1" propertyName="top" value="0" />
<AssertPropertyValue target="btn1" propertyName="left" value="0" />
<AssertPropertyValue target="btn2" propertyName="top" value="0" />
<AssertPropertyValue target="btn2" propertyName="right" value="0" />
<AssertPropertyValue target="btn3" propertyName="left" value="0" />
<AssertPropertyValue target="btn3" propertyName="bottom" value="0" />
<AssertPropertyValue target="btn4" propertyName="right" value="0" />
<AssertPropertyValue target="btn4" propertyName="bottom" value="0" />
<RunCode code="FlexGlobals.topLevelApplication.restore()" />
</body>
</TestCase>
<TestCase testID="maximize_test1_SparkChromeWindowedApplicationSkin " keywords="[WindowedApplication,maximize]" description="Maximize when in the restored state." >
<setup>
<RunCode code="FlexGlobals.topLevelApplication.doReset()" waitTarget="" waitEvent="resetComplete" />
<SetProperty target="" propertyName="maxHeight" value="10000" />
<SetProperty target="" propertyName="maxWidth" value="10000" />
</setup>
<body>
<SetStyle target="" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" />
<RunCode code="FlexGlobals.topLevelApplication.maximize()" waitTarget="" waitEvent="displayStateChange" />
<AssertPropertyValue target="nativeWindow" propertyName="displayState" value="maximized" />
<AssertMethodValue method="value = (Capabilities.screenResolutionX >= FlexGlobals.topLevelApplication.width) &amp;&amp; (FlexGlobals.topLevelApplication.width >= FlexGlobals.topLevelApplication.screenWidthFudged)" value="true" />
<AssertMethodValue method="value = (Capabilities.screenResolutionY >= FlexGlobals.topLevelApplication.height) &amp;&amp; (FlexGlobals.topLevelApplication.height >= FlexGlobals.topLevelApplication.screenHeightFudged)" value="true" />
<AssertPropertyValue target="btn1" propertyName="top" value="0" />
<AssertPropertyValue target="btn1" propertyName="left" value="0" />
<AssertPropertyValue target="btn2" propertyName="top" value="0" />
<AssertPropertyValue target="btn2" propertyName="right" value="0" />
<AssertPropertyValue target="btn3" propertyName="left" value="0" />
<AssertPropertyValue target="btn3" propertyName="bottom" value="0" />
<AssertPropertyValue target="btn4" propertyName="right" value="0" />
<AssertPropertyValue target="btn4" propertyName="bottom" value="0" />
<AssertMethodValue method="value = (Capabilities.screenResolutionX >= FlexGlobals.topLevelApplication.skin.titleBar.width) &amp;&amp; (FlexGlobals.topLevelApplication.skin.titleBar.width >= FlexGlobals.topLevelApplication.screenWidthFudged)" value="true" />
<RunCode code="FlexGlobals.topLevelApplication.restore()" />
</body>
</TestCase>
<TestCase testID="maximize_test2_SparkChromeWindowedApplicationSkin" keywords="[WindowedApplication,maximize]" description="Maximize when maximized. We must use Pause." >
<setup>
<RunCode code="FlexGlobals.topLevelApplication.doReset()" waitTarget="" waitEvent="resetComplete" />
<SetProperty target="" propertyName="maxHeight" value="10000" />
<SetProperty target="" propertyName="maxWidth" value="10000" />
</setup>
<body>
<SetStyle target="" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" />
<RunCode code="FlexGlobals.topLevelApplication.maximize()" waitTarget="" waitEvent="windowResize" />
<RunCode code="FlexGlobals.topLevelApplication.maximize()" />
<Pause timeout="200" />
<AssertPropertyValue target="nativeWindow" propertyName="displayState" value="maximized" />
<AssertMethodValue method="value = (Capabilities.screenResolutionX >= FlexGlobals.topLevelApplication.width) &amp;&amp; (FlexGlobals.topLevelApplication.width >= FlexGlobals.topLevelApplication.screenWidthFudged)" value="true" />
<AssertMethodValue method="value = (Capabilities.screenResolutionY >= FlexGlobals.topLevelApplication.height) &amp;&amp; (FlexGlobals.topLevelApplication.height >= FlexGlobals.topLevelApplication.screenHeightFudged)" value="true" />
<AssertPropertyValue target="btn1" propertyName="top" value="0" />
<AssertPropertyValue target="btn1" propertyName="left" value="0" />
<AssertPropertyValue target="btn2" propertyName="top" value="0" />
<AssertPropertyValue target="btn2" propertyName="right" value="0" />
<AssertPropertyValue target="btn3" propertyName="left" value="0" />
<AssertPropertyValue target="btn3" propertyName="bottom" value="0" />
<AssertPropertyValue target="btn4" propertyName="right" value="0" />
<AssertPropertyValue target="btn4" propertyName="bottom" value="0" />
<AssertMethodValue method="value = (Capabilities.screenResolutionX >= FlexGlobals.topLevelApplication.skin.titleBar.width) &amp;&amp; (FlexGlobals.topLevelApplication.skin.titleBar.width >= FlexGlobals.topLevelApplication.screenWidthFudged)" value="true" />
<RunCode code="FlexGlobals.topLevelApplication.restore()" />
</body>
</TestCase>
<TestCase testID="maximize_test3_SparkChromeWindowedApplicationSkin" keywords="[WindowedApplication,maximize]" description="Maximize when minimized." >
<setup>
<RunCode code="FlexGlobals.topLevelApplication.doReset()" waitTarget="" waitEvent="resetComplete" />
<SetProperty target="" propertyName="maxHeight" value="10000" />
<SetProperty target="" propertyName="maxWidth" value="10000" />
</setup>
<body>
<SetStyle target="" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" />
<RunCode code="FlexGlobals.topLevelApplication.minimize()" waitTarget="" waitEvent="displayStateChange" />
<RunCode code="FlexGlobals.topLevelApplication.maximize()" waitTarget="" waitEvent="displayStateChange" />
<AssertPropertyValue target="nativeWindow" propertyName="displayState" value="maximized" />
<AssertMethodValue method="value = (Capabilities.screenResolutionX >= FlexGlobals.topLevelApplication.width) &amp;&amp; (FlexGlobals.topLevelApplication.width >= FlexGlobals.topLevelApplication.screenWidthFudged)" value="true" />
<AssertMethodValue method="value = (Capabilities.screenResolutionY >= FlexGlobals.topLevelApplication.height) &amp;&amp; (FlexGlobals.topLevelApplication.height >= FlexGlobals.topLevelApplication.screenHeightFudged)" value="true" />
<AssertPropertyValue target="btn1" propertyName="top" value="0" />
<AssertPropertyValue target="btn1" propertyName="left" value="0" />
<AssertPropertyValue target="btn2" propertyName="top" value="0" />
<AssertPropertyValue target="btn2" propertyName="right" value="0" />
<AssertPropertyValue target="btn3" propertyName="left" value="0" />
<AssertPropertyValue target="btn3" propertyName="bottom" value="0" />
<AssertPropertyValue target="btn4" propertyName="right" value="0" />
<AssertPropertyValue target="btn4" propertyName="bottom" value="0" />
<AssertMethodValue method="value = (Capabilities.screenResolutionX >= FlexGlobals.topLevelApplication.skin.titleBar.width) &amp;&amp; (FlexGlobals.topLevelApplication.skin.titleBar.width >= FlexGlobals.topLevelApplication.screenWidthFudged)" value="true" />
<RunCode code="FlexGlobals.topLevelApplication.restore()" />
</body>
</TestCase>
</testCases>
</UnitTester>