aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2015-07-20 03:52:50 +0000
committerNick Burch <nick@apache.org>2015-07-20 03:52:50 +0000
commit886d73deee98fad27cb9bdfa9992ce7d771e3684 (patch)
tree4ba4a65d5338b488abc9964531b4a376063f3655 /src/testcases/org/apache
parent21a8a53496be22f0b987ac8bc28265e681b76ceb (diff)
downloadpoi-886d73deee98fad27cb9bdfa9992ce7d771e3684.tar.gz
poi-886d73deee98fad27cb9bdfa9992ce7d771e3684.zip
#58130 CF DataBar support
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1691868 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache')
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
index 241a2efcb0..d14b556f44 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
@@ -641,11 +641,7 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
cf = sheetCF.getConditionalFormattingAt(2);
assertEquals(1, cf.getFormattingRanges().length);
assertEquals("E2:E17", cf.getFormattingRanges()[0].formatAsString());
-
- assertEquals(1, cf.getNumberOfRules());
- cr = cf.getRule(0);
- assertEquals(ConditionType.DATA_BAR, cr.getConditionTypeType());
- // TODO Support Data Bars, then check the rest of this rule
+ assertDataBar(cf, "FF63C384");
// Colours Red->Yellow->Green - Column F
@@ -774,6 +770,37 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
// TODO Support EXT formattings
}
+ private void assertDataBar(ConditionalFormatting cf, String color) {
+ assertEquals(1, cf.getNumberOfRules());
+ ConditionalFormattingRule cr = cf.getRule(0);
+ assertDataBar(cr, color);
+ }
+ private void assertDataBar(ConditionalFormattingRule cr, String color) {
+ assertEquals(ConditionType.DATA_BAR, cr.getConditionTypeType());
+ assertEquals(ComparisonOperator.NO_COMPARISON, cr.getComparisonOperation());
+ assertEquals(null, cr.getFormula1());
+ assertEquals(null, cr.getFormula2());
+
+ DataBarFormatting databar = cr.getDataBarFormatting();
+ assertNotNull(databar);
+ assertEquals(false, databar.isIconOnly());
+ assertEquals(true, databar.isLeftToRight());
+ assertEquals(0, databar.getWidthMin());
+ assertEquals(100, databar.getWidthMax());
+
+ assertColour(color, databar.getColor());
+
+ ConditionalFormattingThreshold th;
+ th = databar.getMinThreshold();
+ assertEquals(RangeType.MIN, th.getRangeType());
+ assertEquals(null, th.getValue());
+ assertEquals(null, th.getFormula());
+ th = databar.getMaxThreshold();
+ assertEquals(RangeType.MAX, th.getRangeType());
+ assertEquals(null, th.getValue());
+ assertEquals(null, th.getFormula());
+ }
+
private void assertIconSetPercentages(ConditionalFormatting cf, IconSet iconset, Double...vals) {
assertEquals(1, cf.getNumberOfRules());
ConditionalFormattingRule cr = cf.getRule(0);