| <?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. |
| |
| --> |
| |
| <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:js="library://ns.apache.org/royale/basic" |
| xmlns:test="org.apache.royale.test.*" |
| applicationComplete="runTests()" |
| > |
| <fx:Declarations> |
| <test:RoyaleUnitCore id="core"/> |
| </fx:Declarations> |
| <fx:Script> |
| <![CDATA[ |
| COMPILE::SWF |
| { |
| import flash.system.fscommand; |
| } |
| |
| import flexUnitTests.ExternsJSTester; |
| |
| import org.apache.royale.events.Event; |
| import org.apache.royale.test.listeners.CIListener; |
| import org.apache.royale.test.listeners.BrowserConsoleListener; |
| import org.apache.royale.test.Runtime; |
| |
| |
| private static var _instance:FlexUnitRoyaleApplication; |
| public static function getInstance():FlexUnitRoyaleApplication{ |
| return _instance; |
| } |
| |
| public function get eventsTestParent():Group{ |
| return eventBubblingParent; |
| } |
| |
| //account for swf version variance in some test results due to fixed player bugs etc |
| public function getSwfVersion():uint{ |
| COMPILE::SWF{ |
| return this.stage.loaderInfo.bytes[3]; |
| |
| } |
| return 0; |
| } |
| |
| public function runLocal():Boolean{ |
| var ret:Boolean = false; |
| COMPILE::JS{ |
| ret = window.location.search.indexOf('local')!= -1; |
| if (!ret) { |
| console.log('For javascript you can run this locally with console output for debugging purposes, using "?local" appended to the url.\nIt may not work for all browsers with file:// protocol (works with Chrome), in which case you need a local http server') |
| } |
| } |
| return ret |
| } |
| |
| public function getPlayerVersion():String{ |
| COMPILE::SWF{ |
| import flash.system.Capabilities; |
| return Capabilities.version; |
| } |
| return ''; |
| } |
| |
| public function runTests():void |
| { |
| Runtime.swfVersion = getSwfVersion(); |
| _instance = this; |
| if (runLocal()) { |
| core.addListener(new BrowserConsoleListener()); |
| } else{ |
| core.addListener(new CIListener()); |
| } |
| core.addEventListener(Event.COMPLETE, core_completeHandler); |
| core.runClasses(ExternsJSTester); |
| } |
| |
| private function core_completeHandler(event:Event):void |
| { |
| COMPILE::SWF |
| { |
| fscommand("quit"); |
| } |
| } |
| |
| ]]> |
| </fx:Script> |
| <js:valuesImpl> |
| <!-- for such a simple app, we just set values to an empty array so it thinks it doesn't have any values --> |
| <js:SimpleValuesImpl values="[]"/> |
| </js:valuesImpl> |
| <js:initialView> |
| <js:View> |
| <js:Group id="eventBubblingParent" /> |
| </js:View> |
| </js:initialView> |
| |
| </js:Application> |