summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-04 21:42:51 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-04 21:42:51 +0100
commit177183f692f42f6a0cf5ee66f1b7e1c31a616140 (patch)
treea53ffc782063b39e5f4d6c77944c70a172fb228f /chart2
parent5a29db7a9945c4cd095799451a6c563d5aeeed57 (diff)
Proper fix for coverity#1326893
FindBugs' FE.FE_FLOATING_POINT_EQUALITY is about double value inaccuracies, not about NaN or negative zero (which is the topic of java.lang.Double.equals vs. ==). Reuse existing qa.TestCaseOldAPI.approxEqual method, moved to util.utils. Change-Id: I65f7bb1faf921e1c4035bb96aeff1eaf2cfb3153
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/TestCaseOldAPI.java19
1 files changed, 3 insertions, 16 deletions
diff --git a/chart2/qa/TestCaseOldAPI.java b/chart2/qa/TestCaseOldAPI.java
index e58a045e22ca..613ba480e7be 100644
--- a/chart2/qa/TestCaseOldAPI.java
+++ b/chart2/qa/TestCaseOldAPI.java
@@ -32,8 +32,8 @@ import com.sun.star.awt.*;
import com.sun.star.container.*;
import com.sun.star.util.XCloseable;
import com.sun.star.util.CloseVetoException;
-
import com.sun.star.uno.AnyConverter;
+import util.utils;
/**
* The following Complex Test will test the
@@ -360,7 +360,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
assure( "AutoMax is on", ! AnyConverter.toBoolean( xProp.getPropertyValue( "AutoMax" )) );
assure( "Maximum value invalid",
- approxEqual(
+ utils.approxEqual(
AnyConverter.toDouble( xProp.getPropertyValue( "Max" )),
nNewMax ));
@@ -369,7 +369,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
xProp.setPropertyValue( "Origin", new Double( nNewOrigin ));
assure( "Origin invalid",
- approxEqual(
+ utils.approxEqual(
AnyConverter.toDouble( xProp.getPropertyValue( "Origin" )),
nNewOrigin ));
xProp.setPropertyValue( "AutoOrigin", Boolean.TRUE);
@@ -942,19 +942,6 @@ public class TestCaseOldAPI extends ComplexTestCase {
return aResult;
}
-
-
- /// see rtl/math.hxx
- private boolean approxEqual( double a, double b )
- {
- if( a == b )
- return true;
- double x = a - b;
- return (x < 0.0 ? -x : x)
- < ((a < 0.0 ? -a : a) * (1.0 / (16777216.0 * 16777216.0)));
- }
-
-
/** returns true if a and b differ no more than tolerance.
@param tolerance