Those tests are pretty easy, that's properties tests
.\mustella\tests\components\NumericStepper\properties
Just add a new one for both Mx and Spark.
I guess it could be something like that:
<TestCase testID="NumericStepper_value_NaN_spark" description="Test
NumericStepper for NaN Value" keywords="[NumericStepper, value, property]">
<setup>
<ResetComponent target="myNumericStepper"
className="mx.controls.NumericStepper" waitEvent="updateComplete"/>
<SetProperty target="myNumericStepper" propertyName="maximum"
value="-1" waitEvent="updateComplete" waitTarget="myNumericStepper" />
<SetProperty target="myNumericStepper" propertyName="minimum"
value="-100" waitEvent="updateComplete" waitTarget="myNumericStepper" />
<SetProperty target="myNumericStepper" propertyName="value"
value=NaN waitEvent="updateComplete" waitTarget="myNumericStepper" />
<SetProperty target="myNumericStepper" propertyName="stepSize"
value="-3" waitEvent="updateComplete" waitTarget="myNumericStepper" />
</setup>
<body>
<DispatchKeyEvent key="TAB" waitEvent="focusIn"
waitTarget="myNumericStepper"/>
<DispatchKeyEvent keys="[DOWN, DOWN]" />
<AssertPropertyValue target="myNumericStepper"
propertyName="previousValue" value="-1"/>
</body>
</TestCase>
-Fred
-----Message d'origine-----
From: Harbs
Sent: Sunday, April 07, 2013 4:39 PM
To: dev@flex.apache.org
Subject: Re: git commit: Added override to set value to ensure it is not set
to NaN
Sounds good to me, but I've never created a test case, so I have no idea
what to do. Like I just responded, I believe they already are equivalent.
On Apr 7, 2013, at 3:29 PM, Frédéric THOMAS wrote:
One more point, none of the Mustella tests for the Mx and the Spark
NumericStepper have the use case of the NaN, it would be nice to add this
case and make them consistent, what do you think ?
-Fred
-----Message d'origine----- From: Frédéric THOMAS
Sent: Sunday, April 07, 2013 2:21 PM
To: dev@flex.apache.org
Subject: Re: git commit: Added override to set value to ensure it is not
set to NaN
Ok, I just noticed the mx:NumericStepper commitProperties set it to 0 in
case of NaN but it never happen because the checkValidValue reset it the
old
value in case of NaN, it means the Spart one and the Mx one are not
consistent, the Mx one doesn’t allows the value to be set with NaN, is
this
the right answer to apply to the Spark one ?
-Fred
-----Message d'origine----- From: Harbs
Sent: Sunday, April 07, 2013 2:08 PM
To: dev@flex.apache.org
Subject: Re: git commit: Added override to set value to ensure it is not
set
to NaN
Okay. Done.
I'll set up Mustella when I get a chance…
On Apr 7, 2013, at 2:28 PM, Frédéric THOMAS wrote:
Yeah, Range allows to incr/decr in changeValueByStep, so
nearestValidValue is the good place, I haven't seen before because the
source code where FB took me wasn't the good function, I have to fix
that, that's a pain.
-Fred
-----Message d'origine----- From: Harbs
Sent: Sunday, April 07, 2013 1:21 PM
To: dev@flex.apache.org
Subject: Re: git commit: Added override to set value to ensure it is not
set to NaN
Yes. nearestValidValue looks like a good place to fix it. The question
is, should it be in Range, Spinner (what a funny name for a base class…)
or NumericStepper?
I'm thinking Range make the most sense because NaN is not a valid value…
On Apr 7, 2013, at 2:08 PM, Frédéric THOMAS wrote:
Sorry my bad, you are right, I was looking at another function, I don't
use usually FB and it sent me elsewhere.
well, nearestValidValue looks to be the place.
-Fred
-----Message d'origine----- From: Frédéric THOMAS
Sent: Sunday, April 07, 2013 1:00 PM
To: dev@flex.apache.org
Subject: Re: git commit: Added override to set value to ensure it is not
set to NaN
IMHO, it is more a Spinner thing as the Range doesn’t incr/decr values,
so,
it is valid to set it to a NaN value to say that's a meaningless value
but
the incr/decr have currently no code to manage that situation, that's
the
reason why I thing it could be the place to do it.
What do you think ?
-Fred
-----Message d'origine----- From: Harbs
Sent: Sunday, April 07, 2013 12:36 PM
To: dev@flex.apache.org
Subject: Re: git commit: Added override to set value to ensure it is not
set
to NaN
If 0 is out of range, 0 will be converted to minimum automatically.
But you are probably right. I see no reason to not set it straight to
minimium.
It should probably also be fixed in Range set value(). Any reason you
can
think of why it should not be fixed there?
If you agree, I'll revert NumericStepper and make the change in
Range.as…
Harbs
On Apr 7, 2013, at 12:43 PM, Frédéric THOMAS wrote:
Hi Harbs,
I guess you will have the opportunity to do it again.
What if 0 is out of the Range ?
I guess the right fix is:
if(isNaN(newValue))
newValue = minimum;
-Fred
-----Message d'origine----- From: Harbs
Sent: Sunday, April 07, 2013 11:38 AM
To: dev@flex.apache.org
Subject: Re: git commit: Added override to set value to ensure it is
not set to NaN
I thought it was automatically prepended because I created a branch for
it. I see that when I deleted the branch, the JIRA number disappeared.
Still learning git… ;-)
FWIW, it was FLEX-33288
Harbs
On Apr 7, 2013, at 11:57 AM, Frédéric THOMAS wrote:
Take the habit to prepend the issue id to your commit message, it is
useful
if someone wants to see the modified code from the source tab of the
Jira
issue.
-Fred
-----Message d'origine----- From: ha...@apache.org
Sent: Sunday, April 07, 2013 9:02 AM
To: comm...@flex.apache.org
Subject: git commit: Added override to set value to ensure it is not
set to NaN
Updated Branches:
refs/heads/develop 9ec4d1780 -> 53ad8aa03
Added override to set value to ensure it is not set to NaN
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit:
http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/53ad8aa0
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/53ad8aa0
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/53ad8aa0
Branch: refs/heads/develop
Commit: 53ad8aa037d29e1055ec6b532513fa50df730c81
Parents: 9ec4d17
Author: Harbs <ha...@in-tools.com>
Authored: Sun Apr 7 09:58:20 2013 +0300
Committer: Harbs <ha...@in-tools.com>
Committed: Sun Apr 7 09:58:20 2013 +0300
----------------------------------------------------------------------
.../spark/src/spark/components/NumericStepper.as | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/53ad8aa0/frameworks/projects/spark/src/spark/components/NumericStepper.as
----------------------------------------------------------------------
diff --git
a/frameworks/projects/spark/src/spark/components/NumericStepper.as
b/frameworks/projects/spark/src/spark/components/NumericStepper.as
index 36a1982..0848245 100644
--- a/frameworks/projects/spark/src/spark/components/NumericStepper.as
+++ b/frameworks/projects/spark/src/spark/components/NumericStepper.as
@@ -740,6 +740,17 @@ public class NumericStepper extends Spinner
/**
* @private
*/
+ override public function set value(newValue:Number):void
+ {
+ if(isNaN(newValue))
+ newValue = 0;
+
+ super.value = newValue;
+ }
+
+ /**
+ * @private
+ */
override protected function setValue(newValue:Number):void
{
super.setValue(newValue);