poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1691788 - in /poi/trunk/src: java/org/apache/poi/hssf/record/cf/Threshold.java testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
Date Sun, 19 Jul 2015 02:35:04 GMT
Author: nick
Date: Sun Jul 19 02:35:04 2015
New Revision: 1691788

URL: http://svn.apache.org/r1691788
Log:
#58130 Fix the icon formatting read/write CF test

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/cf/Threshold.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/cf/Threshold.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/cf/Threshold.java?rev=1691788&r1=1691787&r2=1691788&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/cf/Threshold.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/cf/Threshold.java Sun Jul 19 02:35:04 2015
@@ -73,6 +73,14 @@ public final class Threshold {
     }
     public void setType(byte type) {
         this.type = type;
+
+        // Ensure the value presense / absense is consistent for the new type
+        if (type == RangeType.MIN.id || type == RangeType.MAX.id ||
+               type == RangeType.FORMULA.id) {
+            this.value = null;
+        } else if (value == null) {
+            this.value = 0d;
+        }
     }
     public void setType(int type) {
         this.type = (byte)type;
@@ -86,6 +94,9 @@ public final class Threshold {
     }
     public void setParsedExpression(Ptg[] ptgs) {
         formula = Formula.create(ptgs);
+        if (ptgs.length > 0) {
+            this.value = null;
+        }
     }
 
     public Double getValue() {

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java?rev=1691788&r1=1691787&r2=1691788&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
(original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
Sun Jul 19 02:35:04 2015
@@ -555,11 +555,11 @@ public abstract class BaseTestConditiona
         assertEquals("Values", s.getRow(0).getCell(0).toString());
         assertEquals("10.0", s.getRow(2).getCell(0).toString());
 
-        // Check we found all the conditional formattings rules we should have
+        // Check we found all the conditional formatting rules we should have
         SheetConditionalFormatting sheetCF = s.getSheetConditionalFormatting();
         int numCF = 3;
         int numCF12 = 15;
-        int numCFEX = 0; // TODO This should be 1, but we don't support CFEX formattings
yet
+        int numCFEX = 0; // TODO This should be 2, but we don't support CFEX formattings
yet
         assertEquals(numCF+numCF12+numCFEX, sheetCF.getNumConditionalFormattings());
         
         int fCF = 0, fCF12 = 0, fCFEX = 0;
@@ -982,8 +982,7 @@ public abstract class BaseTestConditiona
         assertEquals(BorderFormatting.BORDER_HAIR, r1fp.getBorderRight());
     }
     
-    // TODO Fix this test to work for HSSF
-    public void DISABLEDtestCreateIconFormatting() {
+    public void testCreateIconFormatting() {
         Workbook workbook = _testDataProvider.createWorkbook();
         Sheet sheet = workbook.createSheet();
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message