diff options
author | Nick Burch <nick@apache.org> | 2015-07-15 00:04:53 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2015-07-15 00:04:53 +0000 |
commit | 7f8feae6f6293e51966331d0f42539a73bb4b59d (patch) | |
tree | 8014bc904d3c736b53935a16a4b3bcf3242d5ad3 /src/testcases/org/apache/poi/ss | |
parent | 6b32c8f1f856be3d6b133a57e903451e6c36b031 (diff) | |
download | poi-7f8feae6f6293e51966331d0f42539a73bb4b59d.tar.gz poi-7f8feae6f6293e51966331d0f42539a73bb4b59d.zip |
Further HSSF support towards CF IconSets #58130
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1691113 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss')
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java index a803fc83cd..6276b58291 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java @@ -24,6 +24,7 @@ import junit.framework.TestCase; import org.apache.poi.hssf.usermodel.HSSFConditionalFormatting;
import org.apache.poi.hssf.usermodel.HSSFConditionalFormattingRule;
import org.apache.poi.ss.ITestDataProvider;
+import org.apache.poi.ss.usermodel.IconMultiStateFormatting.IconSet;
import org.apache.poi.ss.util.CellRangeAddress;
/**
@@ -544,6 +545,7 @@ public abstract class BaseTestConditionalFormatting extends TestCase { Sheet s = wb.getSheet("CF");
ConditionalFormatting cf = null;
ConditionalFormattingRule cr = null;
+ IconMultiStateFormatting icon = null;
// Sanity check data
assertEquals("Values", s.getRow(0).getCell(0).toString());
@@ -644,7 +646,30 @@ public abstract class BaseTestConditionalFormatting extends TestCase { // Colours R->G - Column F
// Colours BWR - Column G
+
// Icons : Default - Column H
+ cf = sheetCF.getConditionalFormattingAt(5);
+ assertEquals(1, cf.getFormattingRanges().length);
+ assertEquals("H2:H17", cf.getFormattingRanges()[0].formatAsString());
+
+ assertEquals(1, cf.getNumberOfRules());
+ cr = cf.getRule(0);
+ assertEquals(ConditionType.ICON_SET, cr.getConditionTypeType());
+ assertEquals(ComparisonOperator.NO_COMPARISON, cr.getComparisonOperation());
+ assertEquals(null, cr.getFormula1());
+ assertEquals(null, cr.getFormula2());
+ if (cr instanceof HSSFConditionalFormattingRule) {
+ HSSFConditionalFormattingRule hcr = (HSSFConditionalFormattingRule)cr;
+ icon = hcr.getMultiStateFormatting();
+ assertNotNull(icon);
+ assertEquals(IconSet.GYR_3_TRAFFIC_LIGHTS, icon.getIconSet());
+ assertEquals(false, icon.isIconOnly());
+ assertEquals(false, icon.isReversed());
+ // TODO Check the rest
+ } else {
+ // TODO XSSF Support
+ }
+
// Icons : 3 signs - Column I
// Icons : 3 traffic lights 2 - Column J
// Icons : 4 traffic lights - Column K
@@ -834,6 +859,10 @@ public abstract class BaseTestConditionalFormatting extends TestCase { assertEquals(BorderFormatting.BORDER_HAIR, r1fp.getBorderRight());
}
+ public void testCreateIconFormatting() {
+ // TODO Implement for XSSF, then test here
+ }
+
public void testBug55380() {
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet();
|