| <?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/Window/methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="window_basic_005.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 ; |
| public function checkMaxSizeValue(actualSize:Number, expectSize:Number, delta:Number):Boolean |
| { |
| trace("expectSize-actualSize="+(expectSize-actualSize)+";delta="+delta); |
| if ((expectSize-actualSize)<delta) |
| return true; |
| else |
| return false; |
| } |
| ]]> |
| </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_SparkChrome" keywords="[Window,maximize]" description="Maximize when in the restored state." > |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/> |
| <RunCode code="FlexGlobals.topLevelApplication.createAWindow()" waitTarget="" waitEvent="myWindowComplete"/> |
| <SetProperty target="windowObj" propertyName="maxHeight" value="10000" /> |
| <SetProperty target="windowObj" propertyName="maxWidth" value="10000" /> |
| </setup> |
| <body> |
| <SetStyle target="windowObj" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" /> |
| <RunCode code="FlexGlobals.topLevelApplication.windowObj.maximize()" waitTarget="windowObj" waitEvent="displayStateChange" /> |
| <AssertPropertyValue target="windowObj.nativeWindow" propertyName="displayState" value="maximized" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.width,Capabilities.screenResolutionX,130)" value="true" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.height,Capabilities.screenResolutionY,130)" value="true" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.skin.titleBar.width,Capabilities.screenResolutionX,130)" value="true" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="maximize_test1_WindowedApplicationSkin " keywords="[Window,maximize]" description="Maximize when in the restored state." > |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/> |
| <RunCode code="FlexGlobals.topLevelApplication.createAWindow()" waitTarget="" waitEvent="myWindowComplete"/> |
| <SetProperty target="windowObj" propertyName="maxHeight" value="10000" /> |
| <SetProperty target="windowObj" propertyName="maxWidth" value="10000" /> |
| </setup> |
| <body> |
| <SetStyle target="windowObj" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" /> |
| <RunCode code="FlexGlobals.topLevelApplication.windowObj.maximize()" waitTarget="windowObj" waitEvent="displayStateChange" /> |
| <AssertPropertyValue target="windowObj.nativeWindow" propertyName="displayState" value="maximized" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.width,Capabilities.screenResolutionX,130)" value="true" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.height,Capabilities.screenResolutionY,130)" value="true" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="maximize_test2_SparkChrome" keywords="[Window,maximize]" description="Maximize when maximized. We must use Pause." > |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/> |
| <RunCode code="FlexGlobals.topLevelApplication.createAWindow()" waitTarget="" waitEvent="myWindowComplete"/> |
| <SetProperty target="windowObj" propertyName="maxHeight" value="10000" /> |
| <SetProperty target="windowObj" propertyName="maxWidth" value="10000" /> |
| </setup> |
| <body> |
| <SetStyle target="windowObj" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" /> |
| <RunCode code="FlexGlobals.topLevelApplication.windowObj.maximize()" waitTarget="windowObj" waitEvent="displayStateChange" /> |
| <RunCode code="FlexGlobals.topLevelApplication.windowObj.maximize()" /> |
| <WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/> |
| <AssertPropertyValue target="windowObj.nativeWindow" propertyName="displayState" value="maximized" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.width,Capabilities.screenResolutionX,130)" value="true" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.height,Capabilities.screenResolutionY,130)" value="true" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.skin.titleBar.width,Capabilities.screenResolutionX,130)" value="true" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="maximize_test2_WindowedApplicationSkin " keywords="[Window,maximize]" description="Maximize when maximized. We must use Pause." > |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/> |
| <RunCode code="FlexGlobals.topLevelApplication.createAWindow()" waitTarget="" waitEvent="myWindowComplete"/> |
| <SetProperty target="windowObj" propertyName="maxHeight" value="10000" /> |
| <SetProperty target="windowObj" propertyName="maxWidth" value="10000" /> |
| </setup> |
| <body> |
| <SetStyle target="windowObj" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" /> |
| <WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="2"/> |
| <RunCode code="FlexGlobals.topLevelApplication.windowObj.maximize()" waitTarget="windowObj" waitEvent="displayStateChange" /> |
| <WaitForEvent target="stage" eventName="enterFrame" numExpectedEvents="4"/> |
| <AssertPropertyValue target="windowObj.nativeWindow" propertyName="displayState" value="maximized" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.width,Capabilities.screenResolutionX,130)" value="true" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.height,Capabilities.screenResolutionY,130)" value="true" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="maximize_test3_SparkChrome" keywords="[Window,maximize]" description="Maximize when minimized." > |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/> |
| <RunCode code="FlexGlobals.topLevelApplication.createAWindow()" waitTarget="" waitEvent="myWindowComplete"/> |
| <SetProperty target="windowObj" propertyName="maxHeight" value="10000" /> |
| <SetProperty target="windowObj" propertyName="maxWidth" value="10000" /> |
| </setup> |
| <body> |
| <SetStyle target="windowObj" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" /> |
| <RunCode code="FlexGlobals.topLevelApplication.windowObj.minimize()" waitTarget="windowObj" waitEvent="displayStateChange" /> |
| <RunCode code="FlexGlobals.topLevelApplication.windowObj.maximize()" waitTarget="windowObj" waitEvent="displayStateChange" /> |
| <AssertPropertyValue target="windowObj.nativeWindow" propertyName="displayState" value="maximized" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.width,Capabilities.screenResolutionX,130)" value="true" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.height,Capabilities.screenResolutionY,130)" value="true" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.skin.titleBar.width,Capabilities.screenResolutionX,130)" value="true" /> |
| </body> |
| </TestCase> |
| |
| <TestCase testID="maximize_test3_WindowedApplicationSkin " keywords="[Window,maximize]" description="Maximize when minimized." > |
| <setup> |
| <RunCode code="FlexGlobals.topLevelApplication.closeAllChildWindow()"/> |
| <RunCode code="FlexGlobals.topLevelApplication.createAWindow()" waitTarget="" waitEvent="myWindowComplete"/> |
| <SetProperty target="windowObj" propertyName="maxHeight" value="10000" /> |
| <SetProperty target="windowObj" propertyName="maxWidth" value="10000" /> |
| </setup> |
| <body> |
| <SetStyle target="windowObj" styleName="skinClass" valueExpression="value = SparkChromeWindowedApplicationSkin" waitEvent="updateComplete" /> |
| <RunCode code="FlexGlobals.topLevelApplication.windowObj.minimize()" waitTarget="windowObj" waitEvent="displayStateChange" /> |
| <RunCode code="FlexGlobals.topLevelApplication.windowObj.maximize()" waitTarget="windowObj" waitEvent="displayStateChange" /> |
| <AssertPropertyValue target="windowObj.nativeWindow" propertyName="displayState" value="maximized" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.width,Capabilities.screenResolutionX,130)" value="true" /> |
| <AssertMethodValue method="value =checkMaxSizeValue( FlexGlobals.topLevelApplication.windowObj.height,Capabilities.screenResolutionY,130)" value="true" /> |
| </body> |
| </TestCase> |
| |
| </testCases> |
| </UnitTester> |