Repository: flex-asjs Updated Branches: refs/heads/mavenfolders [created] 9282af811
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/SolidBorderUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/SolidBorderUtil.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/SolidBorderUtil.as new file mode 100644 index 0000000..bb74b2a --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/SolidBorderUtil.as @@ -0,0 +1,191 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.utils +{ +import flash.display.Graphics; + + +/** + * The SolidBorderUtil class is a utility class that draws a solid color + * border of a specified color, thickness and alpha. This class is used + * to composite Flash equivalents of JS entities and has no JS + * equivalent. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ +COMPILE::AS3 +public class SolidBorderUtil +{ + /** + * Draw a solid color border as specified. Will fill with + * the backgroundColor if specified. The border draws + * inside with given width/height. + * + * @param g The flash.display.DisplayObject#graphics + * @param x The x position + * @param y The y position + * @param width The width + * @param height The height + * @param color The color + * @param backgroundColor The optional fill color + * @param thickness The thickness of the border + * @param alpha The alpha + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function drawBorder(g:Graphics, x:Number, y:Number, + width:Number, height:Number, + color:uint, backgroundColor:Object = null, + thickness:int = 1, alpha:Number = 1.0, + ellipseWidth:Number = NaN, ellipseHeight:Number = NaN):void + { + g.lineStyle(); // don't draw the line, it tends to get aligned on half-pixels + + if (thickness > 0) + { + g.beginFill(color, alpha); + if (!isNaN(ellipseWidth)) + { + g.drawRoundRect(x, y, width, height, ellipseWidth, ellipseHeight); + g.drawRoundRect(x + thickness, y + thickness, + width - thickness * 2, height - thickness * 2, + ellipseWidth, ellipseHeight); + } + else + { + g.drawRect(x, y, width, height); + g.drawRect(x + thickness, y + thickness, + width - thickness * 2, height - thickness * 2); + } + g.endFill(); + } + + if (backgroundColor != null) + { + g.beginFill(uint(backgroundColor), alpha); + + if (!isNaN(ellipseWidth)) + g.drawRoundRect(x + thickness, y + thickness, + width - thickness * 2, height - thickness * 2, + ellipseWidth, ellipseHeight); + else + g.drawRect(x + thickness, y + thickness, + width - thickness * 2, height - thickness * 2); + g.endFill(); + } + } + + /** + * Draw a solid color border as specified. Only square corners + * are supported as the real usage for this is to handle + * CSS triangles. The border is drawn around the given + * width and height. + * + * @param g The flash.display.DisplayObject#graphics + * @param x The x position + * @param y The y position + * @param width The width + * @param height The height + * @param colorTop The rgba color (alpha is in highest order byte) + * @param colorRight The rgba color + * @param colorBottom The rgba color + * @param colorLeft The rgba color + * @param backgroundColor The optional fill color + * @param thicknessTop The thickness of the border + * @param thicknessRight The thickness of the border + * @param thicknessBottom The thickness of the border + * @param thicknessLeft The thickness of the border + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function drawDetailedBorder(g:Graphics, x:Number, y:Number, + width:Number, height:Number, + colorTop:uint, colorRight:uint, colorBottom:uint, colorLeft:uint, + thicknessTop:int = 0, thicknessRight:int = 0, thicknessBottom:int = 0, thicknessLeft:int = 0 + ):void + { + g.lineStyle(); // don't draw the line, it tends to get aligned on half-pixels + + var color:uint; + var alpha:Number; + if (thicknessTop > 0) + { + color = colorTop & 0xFFFFFF; + alpha = (colorTop >>> 24 & 0xFF) / 255; + g.beginFill(color, alpha); + g.moveTo(0, 0); + g.lineTo(width + thicknessRight + thicknessLeft, 0); + if (width > 0) + g.lineTo(width + thicknessLeft, thicknessTop); + g.lineTo(thicknessLeft, thicknessTop); + g.lineTo(0, 0); + g.endFill(); + } + if (thicknessLeft > 0) + { + color = colorLeft & 0xFFFFFF; + alpha = (colorLeft >>> 24 & 0xFF) / 255; + g.beginFill(color, alpha); + g.moveTo(0, 0); + g.lineTo(thicknessLeft, thicknessTop); + if (height > 0) + g.lineTo(thicknessLeft, thicknessTop + height); + g.lineTo(0, height + thicknessBottom); + g.lineTo(0, 0); + g.endFill(); + } + if (thicknessRight > 0) + { + color = colorRight & 0xFFFFFF; + alpha = (colorRight >>> 24 & 0xFF) / 255; + g.beginFill(color, alpha); + g.moveTo(width + thicknessRight + thicknessLeft, 0); + g.lineTo(width + thicknessRight + thicknessLeft, height + thicknessBottom + thicknessTop); + if (height > 0) + g.lineTo(width + thicknessLeft, height + thicknessTop); + g.lineTo(width + thicknessLeft, thicknessTop); + g.lineTo(width + thicknessRight + thicknessLeft, 0); + g.endFill(); + } + if (thicknessBottom > 0) + { + color = colorBottom & 0xFFFFFF; + alpha = (colorBottom >>> 24 & 0xFF) / 255; + g.beginFill(color, alpha); + g.moveTo(0, height + thicknessBottom + thicknessTop); + g.lineTo(thicknessLeft, height + thicknessTop); + if (width > 0) + g.lineTo(width + thicknessLeft, height + thicknessTop); + g.lineTo(width + thicknessRight + thicknessLeft, height + thicknessBottom + thicknessTop); + g.lineTo(0, height + thicknessBottom + thicknessTop); + g.endFill(); + } + } + +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/StringTrimmer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/StringTrimmer.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/StringTrimmer.as new file mode 100644 index 0000000..fe170df --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/StringTrimmer.as @@ -0,0 +1,176 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.utils +{ + + /** + * The StringTrimmer class is a collection of static functions that provide utility + * features for trimming whitespace off Strings. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::AS3 + public class StringTrimmer + { + /** + * @private + */ + public function StringTrimmer() + { + throw new Error("StringTrimmer should not be instantiated."); + } + + /** + * Removes all whitespace characters from the beginning and end + * of the specified string. + * + * @param str The String whose whitespace should be trimmed. + * + * @return Updated String where whitespace was removed from the + * beginning and end. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function trim(str:String):String + { + if (str == null) return ''; + + var startIndex:int = 0; + while (isWhitespace(str.charAt(startIndex))) + ++startIndex; + + var endIndex:int = str.length - 1; + while (isWhitespace(str.charAt(endIndex))) + --endIndex; + + if (endIndex >= startIndex) + return str.slice(startIndex, endIndex + 1); + else + return ""; + } + + /** + * Removes all whitespace characters from the beginning and end + * of each element in an Array, where the Array is stored as a String. + * + * @param value The String whose whitespace should be trimmed. + * + * @param separator The String that delimits each Array element in the string. + * + * @return Array where whitespace was removed from the + * beginning and end of each element. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function splitAndTrim(value:String, delimiter:String):Array + { + if (value != "" && value != null) + { + var items:Array = value.split(delimiter); + + var len:int = items.length; + for (var i:int = 0; i < len; i++) + { + items[i] = StringTrimmer.trim(items[i]); + } + return items; + } + + return []; + } + + /** + * Removes all whitespace characters from the beginning and end + * of each element in an Array, where the Array is stored as a String. + * + * @param value The String whose whitespace should be trimmed. + * + * @param separator The String that delimits each Array element in the string. + * + * @return Updated String where whitespace was removed from the + * beginning and end of each element. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function trimArrayElements(value:String, delimiter:String):String + { + if (value != "" && value != null) + { + var items:Array = splitAndTrim(value, delimiter); + if (items.length > 0) + { + value = items.join(delimiter); + } + } + + return value; + } + + /** + * Returns <code>true</code> if the specified string is + * a single space, tab, carriage return, newline, or formfeed character. + * + * @param str The String that is is being queried. + * + * @return <code>true</code> if the specified string is + * a single space, tab, carriage return, newline, or formfeed character. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function isWhitespace(character:String):Boolean + { + switch (character) + { + case " ": + case "\t": + case "\r": + case "\n": + case "\f": + // non breaking space + case "\u00A0": + // line seperator + case "\u2028": + // paragraph seperator + case "\u2029": + // ideographic space + case "\u3000": + return true; + + default: + return false; + } + } + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Timer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Timer.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Timer.as new file mode 100644 index 0000000..582d884 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/Timer.as @@ -0,0 +1,148 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.utils +{ +COMPILE::AS3 +{ + import flash.events.TimerEvent; + import flash.utils.Timer; +} + +import org.apache.flex.events.Event; + +COMPILE::JS +{ + import org.apache.flex.events.EventDispatcher; +} + +//-------------------------------------- +// Events +//-------------------------------------- + +/** + * Dispatched as requested via the delay and + * repeat count parameters in the constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ +[Event(name="timer", type="org.apache.flex.events.Event")] + +/** + * The Timer class dispatches events based on a delay + * and repeat count. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ +COMPILE::AS3 +public class Timer extends flash.utils.Timer +{ + /** + * Constructor. + * + * @param delay The number of milliseconds + * to wait before dispatching the event. + * @param repeatCount The number of times to dispatch + * the event. If 0, keep dispatching forever. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function Timer(delay:Number, repeatCount:int = 0) + { + super(delay, repeatCount); + addEventListener("timer", interceptor, false, 9999); + } + + private function interceptor(event:flash.events.Event):void + { + if (event is TimerEvent) + { + event.stopImmediatePropagation(); + dispatchEvent(new Event("timer")); + } + } +} + +COMPILE::JS +public class Timer extends EventDispatcher +{ + /** + * Constructor. + * + * @param delay The number of milliseconds + * to wait before dispatching the event. + * @param repeatCount The number of times to dispatch + * the event. If 0, keep dispatching forever. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function Timer(delay:Number, repeatCount:int = 0) + { + this.delay = delay; + this.repeatCount = repeatCount; + } + + public var delay:Number; + public var repeatCount:int; + + private var currentCount:int = 0; + + private var timerInterval:int = -1; + + public function reset():void + { + stop(); + currentCount = 0; + } + + public function stop():void + { + clearInterval(timerInterval); + timerInterval = -1; + } + + public function start():void + { + timerInterval = + setInterval(timerHandler, delay); + } + + private function timerHandler():void + { + currentCount++; + if (repeatCount > 0 && currentCount >= repeatCount) { + stop(); + } + + dispatchEvent(new Event('timer')); + } +} + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/UIUtils.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/UIUtils.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/UIUtils.as new file mode 100644 index 0000000..2e14e12 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/UIUtils.as @@ -0,0 +1,107 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.utils +{ + import org.apache.flex.core.IChild; + import org.apache.flex.core.IPopUpHost; + import org.apache.flex.core.IUIBase; + + /** + * The UIUtils class is a collection of static functions that provide utility + * features to UIBase objects. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class UIUtils + { + /** + * @private + */ + public function UIUtils() + { + throw new Error("UIUtils should not be instantiated."); + } + + /** + * Centers the given item relative to another item. Typically the item being centered is + * a child or sibling of the second item. + * + * @param item The component item being centered. + * @param relativeTo The component used as reference for the centering. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function center( item:IUIBase, relativeTo:IUIBase ):void + { + var xpos:Number = (relativeTo.width - item.width)/2; + var ypos:Number = (relativeTo.height - item.height)/2; + + item.x = xpos; + item.y = ypos; + } + + /** + * Given a component starting point, this function walks up the parent chain + * looking for a component that implements the IPopUpHost interface. The function + * either returns that component or null if no IPopUpHost can be found. + * + * @param start A component to start the search. + * @return A component that implements IPopUpHost or null. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function findPopUpHost(start:IUIBase):IPopUpHost + { + while( start != null && !(start is IPopUpHost) && start is IChild ) { + start = IChild(start).parent as IUIBase; + } + + return start as IPopUpHost; + } + + /** + * Removes the given component from the IPopUpHost. + * + * @param start A component to start the search. + * @return A component that implements IPopUpHost or null. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function removePopUp(popUp:IChild):void + { + var start:IUIBase = popUp.parent as IUIBase; + while( start != null && !(start is IPopUpHost) && start is IChild ) { + start = IChild(start).parent as IUIBase; + } + (start as IPopUpHost).removeElement(popUp); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/ViewSourceContextMenuOption.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/ViewSourceContextMenuOption.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/ViewSourceContextMenuOption.as new file mode 100644 index 0000000..5a2469a --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/ViewSourceContextMenuOption.as @@ -0,0 +1,97 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.utils +{ + +COMPILE::AS3 +{ + import flash.display.InteractiveObject; + import flash.events.ContextMenuEvent; + import flash.net.URLRequest; + import flash.net.navigateToURL; + import flash.ui.ContextMenu; + import flash.ui.ContextMenuItem; +} + +import org.apache.flex.core.IBead; +import org.apache.flex.core.IStrand; + +/** + * The ViewSourceContextMenuOption class is a class that + * implements the "View Source" option in Flash for a + * FlexJS application. There is no JS equivalent as + * browsers always display source. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ +public class ViewSourceContextMenuOption implements IBead +{ + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ViewSourceContextMenuOption() + { + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.UIBase#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + + COMPILE::AS3 + { + var menuHost:InteractiveObject = InteractiveObject(value); + var cm:ContextMenu = ContextMenu(menuHost.contextMenu); + if (!cm) + { + cm = new ContextMenu(); + menuHost.contextMenu = cm; + } + var cmi:ContextMenuItem = new ContextMenuItem("View Source..."); + cm.hideBuiltInItems(); + cm.customItems.push(cmi); + cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, viewSource); + } + } + + COMPILE::AS3 + private function viewSource(e:ContextMenuEvent):void + { + var urlRequest:URLRequest = new URLRequest("srcview/index.html"); + navigateToURL(urlRequest, "_blank"); + } +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/dbg/DOMPathUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/dbg/DOMPathUtil.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/dbg/DOMPathUtil.as new file mode 100644 index 0000000..3b3da0e --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/dbg/DOMPathUtil.as @@ -0,0 +1,95 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.utils.dbg +{ + import flash.utils.Dictionary; + import flash.utils.getQualifiedClassName; + + import org.apache.flex.core.IChild; + + /** + * The DOMPathUtil class is a tracks instances of display objects + * and provides a unique string for each one based on its position + * in the tree of display objects. It is generally used for + * trace output. If you think you need this for production applications + * you might want to re-think your design. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::AS3 + public class DOMPathUtil + { + /** + * @private + */ + public function DOMPathUtil() + { + throw new Error("DOMPathUtil should not be instantiated."); + } + + private static var dict:Dictionary = new Dictionary(true); + private static var counter:int = 0; + + /** + * Returns a string for an object. IF the object is parented, it + * creates a string based on the DOMPathUtil of the parent. + * + * @param obj The object to generate a path/name for. + * @return The unique name based on the parents. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static function getPath(obj:Object):String + { + if (obj == null) return ""; + + var name:String = null; + if (dict[obj] == null) + { + try { + name = obj.id; + } catch (e:Error) + { + } + if (name == null) + { + name = getQualifiedClassName(obj); + var c:int = name.lastIndexOf(":"); + if (c != -1) + name = name.substr(c + 1); + name += (counter++).toString(); + } + dict[obj] = name; + } + name = dict[obj]; + + if (obj is IChild) + { + name = getPath(IChild(obj).parent) + "/" + name; + } + return name; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/resources/basic-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/resources/basic-manifest.xml b/frameworks/projects/Core/src/main/resources/basic-manifest.xml new file mode 100644 index 0000000..c1842df --- /dev/null +++ b/frameworks/projects/Core/src/main/resources/basic-manifest.xml @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<!-- + + 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. + +--> + + +<componentPackage> + + <component id="Application" class="org.apache.flex.core.Application"/> + <component id="SimpleCSSValuesImpl" class="org.apache.flex.core.SimpleCSSValuesImpl"/> + <component id="CSSFontFaceBead" class="org.apache.flex.core.CSSFontFaceBead" /> + <component id="ViewBase" class="org.apache.flex.core.ViewBase"/> + <component id="BrowserScroller" class="org.apache.flex.core.BrowserScroller"/> + <component id="BrowserResizeHandler" class="org.apache.flex.core.BrowserResizeListener"/> + <component id="SimpleValuesImpl" class="org.apache.flex.core.SimpleValuesImpl"/> + <component id="MXMLDragInitiator" class="org.apache.flex.core.MXMLDragInitiator" /> + <component id="CallLaterBead" class="org.apache.flex.core.CallLaterBead" /> + + <component id="BindableCSSStyles" class="org.apache.flex.core.BindableCSSStyles"/> + <component id="SimpleCSSStyles" class="org.apache.flex.core.SimpleCSSStyles"/> + <component id="ParentDocumentBead" class="org.apache.flex.core.ParentDocumentBead"/> + <component id="MixinManager" class="org.apache.flex.utils.MixinManager" /> + <component id="ViewSourceContextMenuOption" class="org.apache.flex.utils.ViewSourceContextMenuOption" /> + + <component id="State" class="org.apache.flex.states.State"/> +</componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/resources/compile-as-to-js-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/resources/compile-as-to-js-config.xml b/frameworks/projects/Core/src/main/resources/compile-as-to-js-config.xml new file mode 100644 index 0000000..e601b79 --- /dev/null +++ b/frameworks/projects/Core/src/main/resources/compile-as-to-js-config.xml @@ -0,0 +1,77 @@ +<!-- + + 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. + +--> +<flex-config> + + <compiler> + <accessible>false</accessible> + + <external-library-path> + <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element> + <path-element>D:/SDKs/FlexJS/nightly_PF18_AIR18.0_en_US/js/libs/js.swc</path-element> + <path-element>D:/SDKs/FlexJS/nightly_PF18_AIR18.0_en_US/js/libs/gcl.swc</path-element> + </external-library-path> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + </keep-as3-metadata> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/flexjs/basic</uri> + <manifest>basic-manifest.xml</manifest> + </namespace> + </namespaces> + + <locale/> + + <source-path> + <!--<path-element>as/src</path-element>--> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-sources> + <path-element>as/src</path-element> + </include-sources> + + <include-classes> + <class>CoreClasses</class> + <!--<class>CoreASJSClasses</class>--> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/flexjs/basic</uri> + </include-namespaces> + + <target-player>11.1</target-player> + + +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/resources/compile-asjs-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/resources/compile-asjs-config.xml b/frameworks/projects/Core/src/main/resources/compile-asjs-config.xml new file mode 100644 index 0000000..977c1d4 --- /dev/null +++ b/frameworks/projects/Core/src/main/resources/compile-asjs-config.xml @@ -0,0 +1,78 @@ +<!-- + + 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. + +--> +<flex-config> + + <compiler> + <accessible>false</accessible> + + <external-library-path> + </external-library-path> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + </keep-as3-metadata> + + <locale/> + + <library-path> + </library-path> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/flexjs/basic</uri> + <manifest>basic-manifest.xml</manifest> + </namespace> + </namespaces> + + <source-path> + <path-element>as/src</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-file> + </include-file> + + <include-sources> + </include-sources> + + <include-classes> + <class>CoreClasses</class> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/flexjs/basic</uri> + </include-namespaces> + + <!--<target-player>${playerglobal.version}</target-player>--> + + +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/resources/compile-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/resources/compile-config.xml b/frameworks/projects/Core/src/main/resources/compile-config.xml new file mode 100644 index 0000000..d9a038d --- /dev/null +++ b/frameworks/projects/Core/src/main/resources/compile-config.xml @@ -0,0 +1,83 @@ +<!-- + + 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. + +--> +<flex-config> + + <compiler> + <accessible>false</accessible> + + <external-library-path> + <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element> + </external-library-path> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + </keep-as3-metadata> + + <locale/> + + <library-path/> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/flexjs/basic</uri> + <manifest>basic-manifest.xml</manifest> + </namespace> + </namespaces> + + <source-path> + <path-element>as/src</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-file> + <name>js/out/*</name> + <path>js/out/*</path> + </include-file> + <!-- + <include-file> + <name>js/src/*</name> + <path>js/src/*</path> + </include-file> + --> + + <include-classes> + <class>CoreClasses</class> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/flexjs/basic</uri> + </include-namespaces> + + <target-player>${playerglobal.version}</target-player> + + +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/main/resources/compile-js-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/resources/compile-js-config.xml b/frameworks/projects/Core/src/main/resources/compile-js-config.xml new file mode 100644 index 0000000..3c3784b --- /dev/null +++ b/frameworks/projects/Core/src/main/resources/compile-js-config.xml @@ -0,0 +1,87 @@ +<!-- + + 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. + +--> +<flex-config> + + <compiler> + <accessible>false</accessible> + + <external-library-path> + <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element> + </external-library-path> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + </keep-as3-metadata> + + <locale/> + + <library-path/> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/flexjs/basic</uri> + <manifest>basic-manifest.xml</manifest> + </namespace> + </namespaces> + + <source-path> + <path-element>as/src</path-element> + <path-element>asjs/src</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-file> + <name>js/out/*</name> + <path>js/out/*</path> + </include-file> + <!-- + <include-file> + <name>js/src/*</name> + <path>js/src/*</path> + </include-file> + --> + + <include-classes> + <class>CoreJSClasses</class> + <!-- leave out for now until we get Application to compile + <class>CoreASJSClasses</class>--> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/flexjs/basic</uri> + <uri>library://ns.apache.org/flexjs/svg</uri> + </include-namespaces> + + <target-player>${playerglobal.version}</target-player> + + +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/test/flex/FlexUnitFlexJSApplication.mxml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/test/flex/FlexUnitFlexJSApplication.mxml b/frameworks/projects/Core/src/test/flex/FlexUnitFlexJSApplication.mxml new file mode 100644 index 0000000..a97b086 --- /dev/null +++ b/frameworks/projects/Core/src/test/flex/FlexUnitFlexJSApplication.mxml @@ -0,0 +1,46 @@ +<?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/flexjs/basic" + applicationComplete="runTests()" + > + <fx:Script> + <![CDATA[ + import flexUnitTests.StrandTesterTest; + import flexUnitTests.StrandTester; + + import org.flexunit.listeners.CIListener; + import org.flexunit.runner.FlexUnitCore; + + public function runTests() : void + { + var core : FlexUnitCore = new FlexUnitCore(); + core.addListener(new CIListener()); + core.run(StrandTester); + } + + ]]> + </fx:Script> + <js:valuesImpl> + <js:SimpleValuesImpl /> + </js:valuesImpl> + +</js:Application> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/test/flex/build.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/test/flex/build.xml b/frameworks/projects/Core/src/test/flex/build.xml new file mode 100644 index 0000000..31d979b --- /dev/null +++ b/frameworks/projects/Core/src/test/flex/build.xml @@ -0,0 +1,165 @@ +<?xml version="1.0"?> +<!-- + + 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. + +--> + + +<project name="Core.test" default="main" basedir="."> + <property name="FLEXJS_HOME" location="../../../../.."/> + + <property file="${FLEXJS_HOME}/env.properties"/> + <property environment="env"/> + <property file="${FLEXJS_HOME}/build.properties"/> + <property name="FLEX_HOME" value="${env.FLEX_HOME}"/> + <property name="FALCON_HOME" value="${env.FALCON_HOME}"/> + + <condition property="browser" value="C:/Program Files/Internet Explorer/iexplore.exe"> + <os family="windows"/> + </condition> + <condition property="browser" value="/Applications/Safari.app/Contents/MacOS/Safari"> + <os family="mac"/> + </condition> + + <property name="report.dir" value="${basedir}/out" /> + + <available file="${FLEXJS_HOME}/../flex-flexunit" + type="dir" + property="FLEXUNIT_HOME" + value="${FLEXJS_HOME}/../flex-flexunit" /> + + <available file="${FLEXJS_HOME}/../flexunit" + type="dir" + property="FLEXUNIT_HOME" + value="${FLEXJS_HOME}/../flexunit" /> + + <available file="${env.FLEXUNIT_HOME}" + type="dir" + property="FLEXUNIT_HOME" + value="${env.FLEXUNIT_HOME}"/> + + <available file="${FLEXUNIT_HOME}/FlexUnit4/target" + type="dir" + property="FLEXUNIT_LIBPATH1" + value="-library-path+=${FLEXUNIT_HOME}/FlexUnit4/target/flexunit-4.3.0-20140410-as3_4.12.0.swc" /> + <property name="FLEXUNIT_LIBPATH1" value="-library-path+=${FLEXUNIT_HOME}/flexunit" /> + + <available file="${FLEXUNIT_HOME}/FlexUnit4CIListener/target" + type="dir" + property="FLEXUNIT_LIBPATH2" + value="-library-path+=${FLEXUNIT_HOME}/FlexUnit4CIListener/target" /> + <property name="FLEXUNIT_LIBPATH2" value="-define=CONFIG::dummy,false" /> + + <available file="${FLEXUNIT_HOME}/FlexUnit4AntTasks/target" + type="dir" + property="FLEXUNIT_CLASSPATH" + value="${FLEXUNIT_HOME}/FlexUnit4AntTasks/target" /> + <property name="FLEXUNIT_CLASSPATH" value="${FLEXUNIT_HOME}/flexunit" /> + + <target name="main" depends="clean,compile,test" description="Clean test of FlexJSUI.swc"> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="${basedir}"> + <include name="FlexUnitFlexJSApplication.swf"/> + </fileset> + </delete> + <delete failonerror="false"> + <fileset dir="${basedir}/js/out"> + <include name="**/**"/> + </fileset> + </delete> + </target> + + <path id="lib.path"> + <fileset dir="${FALCON_HOME}/lib" includes="falcon-flexTasks.jar"/> + </path> + + <target name="compile" description="Compiles FlexUnitApplication.swf"> + <echo message="Compiling FlexUnitFlexJSApplication.swf"/> + <echo message="FLEX_HOME: ${FLEX_HOME}"/> + <echo message="FALCON_HOME: ${FALCON_HOME}"/> + <echo message="FLEXUNIT_HOME: ${FLEXUNIT_HOME}"/> + + <!-- Load the <compc> task. We can't do this at the <project> level --> + <!-- because targets that run before flexTasks.jar gets built would fail. --> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + <!-- + Link in the classes (and their dependencies) for the MXML tags + listed in this project's manifest.xml. + Also link the additional classes (and their dependencies) + listed in FlexJSUIClasses.as, + because these aren't referenced by the manifest classes. + Keep the standard metadata when compiling. + Include the appropriate CSS files and assets in the SWC. + Don't include any resources in the SWC. + Write a bundle list of referenced resource bundles + into the file bundles.properties in this directory. + --> + <mxmlc fork="true" + file="${basedir}/FlexUnitFlexJSApplication.mxml" + output="${basedir}/FlexUnitFlexJSApplication.swf"> + <jvmarg line="${mxmlc.jvm.args}"/> + <arg value="+flexlib=${FLEXJS_HOME}/frameworks" /> + <arg value="-debug" /> + <arg value="-define=COMPILE::AS3,true" /> + <arg value="-define=COMPILE::JS,false" /> + <arg value="-compiler.mxml.children-as-data" /> + <arg value="-compiler.binding-value-change-event=org.apache.flex.events.ValueChangeEvent" /> + <arg value="-compiler.binding-value-change-event-kind=org.apache.flex.events.ValueChangeEvent" /> + <arg value="-compiler.binding-value-change-event-type=valueChange" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" /> + <arg value="-source-path+=${FLEXJS_HOME}/frameworks/projects/Core/as/src" /> + <arg value="-library-path+=${FLEXJS_HOME}/frameworks/libs" /> + <arg value="${FLEXUNIT_LIBPATH1}" /> + <arg value="${FLEXUNIT_LIBPATH2}" /> + </mxmlc> + </target> + + <target name="test"> + <taskdef resource="flexUnitTasks.tasks"> + <classpath> + <fileset dir="${FLEXUNIT_CLASSPATH}"> + <include name="flexUnitTasks*.jar" /> + </fileset> + </classpath> + </taskdef> + <mkdir dir="${report.dir}" /> + <flexunit + swf="${basedir}/FlexUnitFlexJSApplication.swf" + workingDir="${basedir}" + toDir="${report.dir}" + haltonfailure="false" + verbose="true" + localTrusted="true" + timeout="90000"> + <source dir="${FLEXJS_HOME}/frameworks/projects/Core/as/src" /> + <library dir="${FLEXJS_HOME}/frameworks/libs" /> + </flexunit> + + <!-- Generate readable JUnit-style reports --> + <junitreport todir="${report.dir}"> + <fileset dir="${report.dir}"> + <include name="TEST-*.xml" /> + </fileset> + <report format="frames" todir="${report.dir}/html" /> + </junitreport> + + </target> +</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/test/flex/flexUnitTests/StrandTester.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/test/flex/flexUnitTests/StrandTester.as b/frameworks/projects/Core/src/test/flex/flexUnitTests/StrandTester.as new file mode 100644 index 0000000..df62e31 --- /dev/null +++ b/frameworks/projects/Core/src/test/flex/flexUnitTests/StrandTester.as @@ -0,0 +1,27 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// +package flexUnitTests +{ + [Suite] + [RunWith("org.flexunit.runners.Suite")] + public class StrandTester + { + public var strandTesterTest:StrandTesterTest; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a903508e/frameworks/projects/Core/src/test/flex/flexUnitTests/StrandTesterTest.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/test/flex/flexUnitTests/StrandTesterTest.as b/frameworks/projects/Core/src/test/flex/flexUnitTests/StrandTesterTest.as new file mode 100644 index 0000000..97a84a3 --- /dev/null +++ b/frameworks/projects/Core/src/test/flex/flexUnitTests/StrandTesterTest.as @@ -0,0 +1,55 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// +package flexUnitTests +{ + import flexunit.framework.Assert; + + import org.apache.flex.core.Strand; + + public class StrandTesterTest + { + [Before] + public function setUp():void + { + } + + [After] + public function tearDown():void + { + } + + [BeforeClass] + public static function setUpBeforeClass():void + { + } + + [AfterClass] + public static function tearDownAfterClass():void + { + } + + [Test] + public function testIdProperty():void + { + var strand:Strand = new Strand(); + strand.id = "foo"; + Assert.assertEquals("Error testing Srand.id", strand.id, "foo"); + } + } +} \ No newline at end of file
