You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2022/06/15 16:01:37 UTC
svn commit: r1901945 - in /poi/trunk: poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/ poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/ poi/src/test/java/org/apache/poi/ss/usermodel/
Author: fanningpj
Date: Wed Jun 15 16:01:37 2022
New Revision: 1901945
URL: http://svn.apache.org/viewvc?rev=1901945&view=rev
Log:
[bug-66123] support gte attribute in XSSFConditionalFormattingThreshold
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFConditionalFormattingThreshold.java
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFConditionalFormatting.java
poi/trunk/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFConditionalFormattingThreshold.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFConditionalFormattingThreshold.java?rev=1901945&r1=1901944&r2=1901945&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFConditionalFormattingThreshold.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFConditionalFormattingThreshold.java Wed Jun 15 16:01:37 2022
@@ -72,6 +72,7 @@ public class XSSFConditionalFormattingTh
return null;
}
}
+
@Override
public void setValue(Double value) {
if (value == null) {
@@ -80,4 +81,20 @@ public class XSSFConditionalFormattingTh
cfvo.setVal(value.toString());
}
}
+
+ /**
+ * @return true if 'gte' attribute is set to true (defaults to true)
+ * @since POI 5.2.3
+ */
+ public boolean isGte() {
+ return cfvo.getGte();
+ }
+
+ /**
+ * @param gte set 'gte' attribute (defaults to true)
+ * @since POI 5.2.3
+ */
+ public void setGte(boolean gte) {
+ cfvo.setGte(gte);
+ }
}
Modified: poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFConditionalFormatting.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFConditionalFormatting.java?rev=1901945&r1=1901944&r2=1901945&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFConditionalFormatting.java (original)
+++ poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFConditionalFormatting.java Wed Jun 15 16:01:37 2022
@@ -19,7 +19,10 @@
package org.apache.poi.xssf.usermodel;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
@@ -27,6 +30,7 @@ import org.apache.poi.ss.usermodel.BaseT
import org.apache.poi.ss.usermodel.Color;
import org.apache.poi.ss.usermodel.ConditionalFormatting;
import org.apache.poi.ss.usermodel.ConditionalFormattingRule;
+import org.apache.poi.ss.usermodel.ConditionalFormattingThreshold;
import org.apache.poi.ss.usermodel.ExtendedColor;
import org.apache.poi.ss.usermodel.FontFormatting;
import org.apache.poi.ss.usermodel.PatternFormatting;
@@ -143,4 +147,18 @@ class TestXSSFConditionalFormatting exte
protected boolean applyLimitOf3() {
return false;
}
+
+ @Override
+ protected void checkThreshold(ConditionalFormattingThreshold threshold) {
+ assertNull(threshold.getValue());
+ assertNull(threshold.getFormula());
+ assertTrue(threshold instanceof XSSFConditionalFormattingThreshold,
+ "threshold is a XSSFConditionalFormattingThreshold?");
+ XSSFConditionalFormattingThreshold xssfThreshold = (XSSFConditionalFormattingThreshold)threshold;
+ assertTrue(xssfThreshold.isGte(), "gte defaults to true?");
+ xssfThreshold.setGte(false);
+ assertFalse(xssfThreshold.isGte(), "gte changed to false?");
+ xssfThreshold.setGte(true);
+ assertTrue(xssfThreshold.isGte(), "gte changed to true?");
+ }
}
Modified: poi/trunk/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java?rev=1901945&r1=1901944&r2=1901945&view=diff
==============================================================================
--- poi/trunk/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java (original)
+++ poi/trunk/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java Wed Jun 15 16:01:37 2022
@@ -550,8 +550,7 @@ public abstract class BaseTestConditiona
if (str.contains("[CFEX]")) fCFEX++;
} else {
ConditionType type = cf.getRule(cf.getNumberOfRules() - 1).getConditionType();
- if (type == ConditionType.CELL_VALUE_IS ||
- type == ConditionType.FORMULA) {
+ if (type == ConditionType.CELL_VALUE_IS || type == ConditionType.FORMULA) {
fCF++;
} else {
// TODO Properly detect Ext ones from the xml
@@ -772,15 +771,17 @@ public abstract class BaseTestConditiona
assertColor(color, databar.getColor());
- ConditionalFormattingThreshold th;
- th = databar.getMinThreshold();
- assertEquals(RangeType.MIN, th.getRangeType());
- assertNull(th.getValue());
- assertNull(th.getFormula());
- th = databar.getMaxThreshold();
- assertEquals(RangeType.MAX, th.getRangeType());
- assertNull(th.getValue());
- assertNull(th.getFormula());
+ ConditionalFormattingThreshold th1 = databar.getMinThreshold();
+ assertEquals(RangeType.MIN, th1.getRangeType());
+ checkThreshold(th1);
+ ConditionalFormattingThreshold th2 = databar.getMaxThreshold();
+ assertEquals(RangeType.MAX, th2.getRangeType());
+ checkThreshold(th2);
+ }
+
+ protected void checkThreshold(ConditionalFormattingThreshold threshold) {
+ assertNull(threshold.getValue());
+ assertNull(threshold.getFormula());
}
private void assertIconSetPercentages(ConditionalFormatting cf, IconSet iconset, Double...vals) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org