You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by mi...@apache.org on 2015/01/06 16:43:53 UTC

[3/3] git commit: [flex-sdk] [refs/heads/develop] - FLEX-34625 The same problem can occur for NaN, so I added the check and the unit test which makes sure it won't happen.

FLEX-34625 The same problem can occur for NaN, so I added the check and the unit test which makes sure it won't happen.


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

Branch: refs/heads/develop
Commit: 87e77c898210f2b84e7984d761ac17cdf939bd62
Parents: 685aeb3
Author: Mihai Chira <mi...@apache.org>
Authored: Tue Jan 6 15:42:42 2015 +0000
Committer: Mihai Chira <mi...@apache.org>
Committed: Tue Jan 6 15:42:42 2015 +0000

----------------------------------------------------------------------
 .../skins/spark/HighlightBitmapCaptureSkin.as   |  2 +-
 .../spark/skins/spark/FLEX_34625_Test.as        | 37 +++++++++++++++-----
 2 files changed, 29 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/87e77c89/frameworks/projects/spark/src/spark/skins/spark/HighlightBitmapCaptureSkin.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/skins/spark/HighlightBitmapCaptureSkin.as b/frameworks/projects/spark/src/spark/skins/spark/HighlightBitmapCaptureSkin.as
index 077f14a..3ca2070 100644
--- a/frameworks/projects/spark/src/spark/skins/spark/HighlightBitmapCaptureSkin.as
+++ b/frameworks/projects/spark/src/spark/skins/spark/HighlightBitmapCaptureSkin.as
@@ -162,7 +162,7 @@ package spark.skins.spark
             
             var bdWidth:Number = target.width + borderWeight * 2;
             var bdHeight:Number = target.height + borderWeight * 2;
-            if(bdWidth < 1 || bdHeight < 1)
+            if(bdWidth < 1 || bdHeight < 1 || isNaN(bdWidth) || isNaN(bdHeight))
                 return;
 
             var bitmapData:BitmapData = new BitmapData(bdWidth, bdHeight, true, 0);

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/87e77c89/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
index fd56d31..c727b83 100644
--- a/frameworks/tests/unitTests/spark/skins/spark/FLEX_34625_Test.as
+++ b/frameworks/tests/unitTests/spark/skins/spark/FLEX_34625_Test.as
@@ -1,4 +1,4 @@
-package spark.skins.spark {
+package {
     import flash.events.Event;
     import flash.events.EventDispatcher;
 
@@ -16,33 +16,52 @@ package spark.skins.spark {
         private static const NO_ENTER_FRAMES_TO_ALLOW:int = 4;
         private var noEnterFramesRemaining:int = NaN;
         private var _finishNotifier:EventDispatcher;
+        private var _textInput:TextInput;
 
         [Before]
         public function setUp():void
         {
+            var focusManager:FocusManager = new FocusManager(UIImpersonator.testDisplay as IFocusManagerContainer);
+            focusManager.showFocusIndicator = true;
+
+            _textInput = new TextInput();
+            _textInput.focusManager = focusManager;
+
             _finishNotifier = new EventDispatcher();
         }
 
         [After]
         public function tearDown():void
         {
+            _textInput = null;
             _finishNotifier = null;
         }
 
         [Test(async, timeout=500)]
-        public function testFocusSkinWithZeroFocusThickness():void
+        public function test_focus_skin_with_zero_focus_thickness():void
         {
             //given
-            const fm:FocusManager = new FocusManager(UIImpersonator.testDisplay as IFocusManagerContainer, false);
-            fm.showFocusIndicator = true;
+            UIImpersonator.addChild(_textInput);
+
+            //when
+            _textInput.setStyle("focusThickness", 0);
+            _textInput.setFocus();
 
-            const textInput:TextInput = new TextInput();
-            textInput.focusManager = fm;
-            UIImpersonator.addChild(textInput);
+            //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);
+        }
+
+        [Test(async, timeout=500)]
+        public function test_focus_skin_with_NaN_focus_thickness():void
+        {
+            //given
+            UIImpersonator.addChild(_textInput);
 
             //when
-            textInput.setStyle("focusThickness", 0);
-            textInput.setFocus();
+            _textInput.setStyle("focusThickness", NaN);
+            _textInput.setFocus();
 
             //then wait for the focus skin to show
             noEnterFramesRemaining = NO_ENTER_FRAMES_TO_ALLOW;