flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mih...@apache.org
Subject [1/3] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34625 Added a unit test which reproduces the bug.
Date Tue, 06 Jan 2015 15:43:51 GMT
Repository: flex-sdk
Updated Branches:
  refs/heads/develop 44911f08a -> 87e77c898


FLEX-34625 Added a unit test which reproduces the bug.


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/6a031b47
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/6a031b47
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/6a031b47

Branch: refs/heads/develop
Commit: 6a031b47027cd5530c16228490d5b8be3ea88628
Parents: 44911f0
Author: Mihai Chira <mihaic@apache.org>
Authored: Tue Jan 6 15:26:15 2015 +0000
Committer: Mihai Chira <mihaic@apache.org>
Committed: Tue Jan 6 15:26:15 2015 +0000

----------------------------------------------------------------------
 .../spark/skins/spark/FLEX_34625_Test.as        | 69 ++++++++++++++++++++
 1 file changed, 69 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/6a031b47/frameworks/tests/unitTests/spark/skins/spark/FLEX_34625_Test.as
----------------------------------------------------------------------
diff --git a/frameworks/tests/unitTests/spark/skins/spark/FLEX_34625_Test.as b/frameworks/tests/unitTests/spark/skins/spark/FLEX_34625_Test.as
new file mode 100644
index 0000000..fd56d31
--- /dev/null
+++ b/frameworks/tests/unitTests/spark/skins/spark/FLEX_34625_Test.as
@@ -0,0 +1,69 @@
+package spark.skins.spark {
+    import flash.events.Event;
+    import flash.events.EventDispatcher;
+
+    import mx.managers.FocusManager;
+    import mx.managers.IFocusManagerContainer;
+
+    import org.flexunit.asserts.assertTrue;
+    import org.flexunit.async.Async;
+    import org.fluint.uiImpersonation.UIImpersonator;
+
+    import spark.components.TextInput;
+
+    public class FLEX_34625_Test {
+
+        private static const NO_ENTER_FRAMES_TO_ALLOW:int = 4;
+        private var noEnterFramesRemaining:int = NaN;
+        private var _finishNotifier:EventDispatcher;
+
+        [Before]
+        public function setUp():void
+        {
+            _finishNotifier = new EventDispatcher();
+        }
+
+        [After]
+        public function tearDown():void
+        {
+            _finishNotifier = null;
+        }
+
+        [Test(async, timeout=500)]
+        public function testFocusSkinWithZeroFocusThickness():void
+        {
+            //given
+            const fm:FocusManager = new FocusManager(UIImpersonator.testDisplay as IFocusManagerContainer,
false);
+            fm.showFocusIndicator = true;
+
+            const textInput:TextInput = new TextInput();
+            textInput.focusManager = fm;
+            UIImpersonator.addChild(textInput);
+
+            //when
+            textInput.setStyle("focusThickness", 0);
+            textInput.setFocus();
+
+            //then wait for the focus skin to show
+            noEnterFramesRemaining = NO_ENTER_FRAMES_TO_ALLOW;
+            UIImpersonator.testDisplay.addEventListener(Event.ENTER_FRAME, onEnterFrame);
+            Async.handleEvent(this, _finishNotifier, Event.COMPLETE, onTestComplete);
+        }
+
+        private function onEnterFrame(event:Event):void
+        {
+            if(!--noEnterFramesRemaining)
+            {
+                UIImpersonator.testDisplay.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
+
+                _finishNotifier.dispatchEvent(new Event(Event.COMPLETE));
+            }
+        }
+
+        private static function onTestComplete(event:Event, passThroughData:Object):void
+        {
+            //if we get here it means no error has been thrown
+            assertTrue(true);
+        }
+    }
+}


Mime
View raw message