| <?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/FileDataGrid/methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="FileDataGrid_main.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.controls.FileSystemDataGrid; |
| |
| import flash.filesystem.File; |
| |
| import mx.collections.ArrayCollection; |
| |
| import flash.system.Capabilities; |
| |
| |
| |
| public var myAC:ArrayCollection = new ArrayCollection(); |
| |
| |
| |
| [Bindable] |
| |
| public var contentLength:int = -1; |
| |
| [Bindable] |
| |
| public var myOS:String; |
| |
| [Bindable] |
| |
| public var newDirectory:File; |
| |
| |
| |
| private function whichOS():void |
| |
| { |
| |
| if (Capabilities.os.indexOf("Windows") != -1){ |
| |
| myOS="windows"; |
| |
| newDirectory = new File("c:\\windows"); |
| |
| } |
| |
| |
| |
| else if (Capabilities.os.indexOf("Mac") != -1){ |
| |
| myOS="System"; |
| |
| newDirectory = new File("/System/"); |
| |
| } |
| |
| } |
| |
| |
| |
| private function setDir(): void |
| |
| { |
| |
| application.myFileSystemDataGrid.directory=newDirectory; |
| |
| |
| |
| } |
| |
| |
| |
| private function setVal(): void |
| |
| { |
| |
| application.myFileSystemDataGrid.directory=newDirectory; |
| |
| application.myFileSystemDataGrid.extensions=[".txt"]; |
| |
| } |
| |
| |
| |
| private function updateBackHis():String{ |
| |
| myAC.source = application.myFileSystemDataGrid.backHistory; |
| |
| return String(myAC.source.length); |
| |
| |
| |
| } |
| |
| |
| |
| private function checkcurrentpath():String{ |
| |
| |
| |
| return String(application.myFileSystemDataGrid.directory.name); |
| |
| |
| |
| } |
| |
| private function setDirC(): void{ |
| |
| |
| |
| var newDirectory:File = new File("c:\\"); |
| |
| application.myFileSystemDataGrid.directory=newDirectory; |
| |
| } |
| |
| private function checkContentLength():String{ |
| |
| trace(String(application.myFileSystemDataGrid.dataProvider)); |
| |
| return String(application.myFileSystemDataGrid.dataProvider.length); |
| |
| } |
| |
| |
| |
| private function setContentLength():void{ |
| |
| contentLength = application.myFileSystemDataGrid.dataProvider.length; |
| |
| } |
| |
| ]]> |
| |
| </mx:Script> |
| |
| |
| |
| <testCases> |
| |
| |
| |
| <TestCase testID="FileSystemDataGrid_Method_clear_set" keywords="[clear, FileSystemDataGrid]"> |
| |
| <setup> |
| |
| <RunCode code="whichOS()"/> |
| |
| <ResetComponent target="myFileSystemDataGrid" className="mx.controls::FileSystemDataGrid" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| |
| |
| <RunCode code="application.myFileSystemDataGrid.clear()" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| </setup> |
| |
| <body> |
| |
| <AssertMethodValue target="myFileSystemDataGrid" method="value=checkContentLength()" value="0"/> |
| |
| </body> |
| |
| </TestCase> |
| |
| |
| |
| <TestCase testID="FileSystemDataGrid_Method_refresh_set" keywords="[Refresh, FileSystemDataGrid]"> |
| |
| <setup> |
| |
| <ResetComponent target="myFileSystemDataGrid" className="mx.controls::FileSystemDataGrid" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| <RunCode code="setContentLength()"/> |
| |
| <RunCode code="application.myFileSystemDataGrid.clear()" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| <RunCode code="application.myFileSystemDataGrid.refresh()" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| </setup> |
| |
| <body> |
| |
| <AssertMethodValue target="myFileSystemDataGrid" method="value=checkContentLength()" value="{contentLength}"/> |
| |
| </body> |
| |
| </TestCase> |
| |
| |
| |
| <TestCase testID="FileSystemDataGrid_Method_navigateDown_aftersetting" keywords="[canNavigateBack, FileSystemDataGrid]"> |
| |
| <setup> |
| |
| <ResetComponent target="myFileSystemDataGrid" className="mx.controls::FileSystemDataGrid" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| <DispatchKeyEvent keys="[TAB]" waitEvent="focusIn" waitTarget="myFileSystemDataGrid"/> |
| |
| <DispatchMouseEvent type="mouseDown" localX="35" localY="35" target="myFileSystemDataGrid" /> |
| |
| <DispatchMouseEvent type="mouseUp" localX="35" localY="35" target="myFileSystemDataGrid" /> |
| |
| <RunCode code="application.myFileSystemDataGrid.navigateDown()" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| </setup> |
| |
| <body> |
| |
| |
| |
| <AssertPropertyValue target="myFileSystemDataGrid" propertyName="canNavigateUp" value="true" /> |
| |
| </body> |
| |
| </TestCase> |
| |
| |
| |
| <TestCase testID="FileSystemDataGrid_Method_navigateUp_aftersetting" keywords="[canNavigateBack, FileSystemDataGrid]"> |
| |
| <setup> |
| |
| <ResetComponent target="myFileSystemDataGrid" className="mx.controls::FileSystemDataGrid" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| <DispatchKeyEvent keys="[TAB]" waitEvent="focusIn" waitTarget="myFileSystemDataGrid"/> |
| |
| <DispatchMouseEvent type="mouseDown" localX="35" localY="35" target="myFileSystemDataGrid" /> |
| |
| <DispatchMouseEvent type="mouseUp" localX="35" localY="35" target="myFileSystemDataGrid" /> |
| |
| <DispatchKeyEvent keys="[ENTER]" waitEvent="directoryChange" waitTarget="myFileSystemDataGrid"/> |
| |
| <RunCode code="application.myFileSystemDataGrid.navigateUp()" waitEvent="directoryChange" waitTarget="myFileSystemDataGrid"/> |
| |
| </setup> |
| |
| <body> |
| |
| |
| |
| <AssertPropertyValue target="myFileSystemDataGrid" propertyName="canNavigateUp" value="false" /> |
| |
| </body> |
| |
| </TestCase> |
| |
| |
| |
| <TestCase testID="FileSystemDataGrid_Method_navigateBack_aftersetting" keywords="[canNavigateBack, FileSystemDataGrid]"> |
| |
| <setup> |
| |
| <ResetComponent target="myFileSystemDataGrid" className="mx.controls::FileSystemDataGrid" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| <DispatchKeyEvent keys="[TAB]" waitEvent="focusIn" waitTarget="myFileSystemDataGrid"/> |
| |
| <DispatchMouseEvent type="mouseDown" localX="35" localY="35" target="myFileSystemDataGrid" /> |
| |
| <DispatchMouseEvent type="mouseUp" localX="35" localY="35" target="myFileSystemDataGrid" /> |
| |
| <DispatchKeyEvent keys="[ENTER]" waitEvent="directoryChange" waitTarget="myFileSystemDataGrid"/> |
| |
| <RunCode code="application.myFileSystemDataGrid.navigateBack()" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| </setup> |
| |
| <body> |
| |
| |
| |
| <AssertPropertyValue target="myFileSystemDataGrid" propertyName="canNavigateBack" value="false" /> |
| |
| </body> |
| |
| </TestCase> |
| |
| |
| |
| |
| |
| <TestCase testID="FileSystemDataGrid_Method_navigateForward_aftersetting" keywords="[canNavigateBack, FileSystemDataGrid]"> |
| |
| <setup> |
| |
| <ResetComponent target="myFileSystemDataGrid" className="mx.controls::FileSystemDataGrid" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| <DispatchKeyEvent keys="[TAB]" waitEvent="focusIn" waitTarget="myFileSystemDataGrid"/> |
| |
| <DispatchMouseEvent type="mouseDown" localX="35" localY="35" target="myFileSystemDataGrid" /> |
| |
| <DispatchMouseEvent type="mouseUp" localX="35" localY="35" target="myFileSystemDataGrid" /> |
| |
| <DispatchKeyEvent keys="[ENTER]" waitEvent="directoryChange" waitTarget="myFileSystemDataGrid"/> |
| |
| <RunCode code="application.myFileSystemDataGrid.navigateBack()" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| <RunCode code="application.myFileSystemDataGrid.navigateForward()" waitEvent="updateComplete" waitTarget="myFileSystemDataGrid"/> |
| |
| </setup> |
| |
| <body> |
| |
| |
| |
| <AssertPropertyValue target="myFileSystemDataGrid" propertyName="canNavigateBack" value="true" /> |
| |
| </body> |
| |
| </TestCase> |
| |
| |
| |
| </testCases> |
| |
| |
| |
| </UnitTester> |
| |