aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/ss
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2015-07-13 20:11:47 +0000
committerNick Burch <nick@apache.org>2015-07-13 20:11:47 +0000
commit02b090e41638c861a0a1f47f78a08d68232c8cef (patch)
tree9ade8c01f9fe257d51978b94bfde5e23451a943a /src/testcases/org/apache/poi/ss
parent7d58f2297b3e6eca8d3cb342b1b5aa484f3deadb (diff)
downloadpoi-02b090e41638c861a0a1f47f78a08d68232c8cef.tar.gz
poi-02b090e41638c861a0a1f47f78a08d68232c8cef.zip
Move some test checks to using ConditionType instead of raw bytes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1690808 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.java41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
index 902a013122..ff5d589036 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
@@ -102,7 +102,8 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
SheetConditionalFormatting sheetCF = sh.getSheetConditionalFormatting();
ConditionalFormattingRule rule1 = sheetCF.createConditionalFormattingRule("SUM(A1:A5)>10");
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_FORMULA, rule1.getConditionType());
+ assertEquals(ConditionType.FORMULA.id, rule1.getConditionType());
+ assertEquals(ConditionType.FORMULA, rule1.getConditionTypeType());
assertEquals("SUM(A1:A5)>10", rule1.getFormula1());
int formatIndex1 = sheetCF.addConditionalFormatting(
new CellRangeAddress[]{
@@ -137,56 +138,65 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
ConditionalFormattingRule rule1 = sheetCF.createConditionalFormattingRule(
ComparisonOperator.EQUAL, "SUM(A1:A5)+10");
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule1.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS.id, rule1.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule1.getConditionTypeType());
assertEquals("SUM(A1:A5)+10", rule1.getFormula1());
assertEquals(ComparisonOperator.EQUAL, rule1.getComparisonOperation());
ConditionalFormattingRule rule2 = sheetCF.createConditionalFormattingRule(
ComparisonOperator.NOT_EQUAL, "15");
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule2.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS.id, rule2.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule2.getConditionTypeType());
assertEquals("15", rule2.getFormula1());
assertEquals(ComparisonOperator.NOT_EQUAL, rule2.getComparisonOperation());
ConditionalFormattingRule rule3 = sheetCF.createConditionalFormattingRule(
ComparisonOperator.NOT_EQUAL, "15");
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule3.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS.id, rule3.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule3.getConditionTypeType());
assertEquals("15", rule3.getFormula1());
assertEquals(ComparisonOperator.NOT_EQUAL, rule3.getComparisonOperation());
ConditionalFormattingRule rule4 = sheetCF.createConditionalFormattingRule(
ComparisonOperator.GT, "0");
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule4.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS.id, rule4.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule4.getConditionTypeType());
assertEquals("0", rule4.getFormula1());
assertEquals(ComparisonOperator.GT, rule4.getComparisonOperation());
ConditionalFormattingRule rule5 = sheetCF.createConditionalFormattingRule(
ComparisonOperator.LT, "0");
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule5.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS.id, rule5.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule5.getConditionTypeType());
assertEquals("0", rule5.getFormula1());
assertEquals(ComparisonOperator.LT, rule5.getComparisonOperation());
ConditionalFormattingRule rule6 = sheetCF.createConditionalFormattingRule(
ComparisonOperator.GE, "0");
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule6.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS.id, rule6.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule6.getConditionTypeType());
assertEquals("0", rule6.getFormula1());
assertEquals(ComparisonOperator.GE, rule6.getComparisonOperation());
ConditionalFormattingRule rule7 = sheetCF.createConditionalFormattingRule(
ComparisonOperator.LE, "0");
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule7.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS.id, rule7.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule7.getConditionTypeType());
assertEquals("0", rule7.getFormula1());
assertEquals(ComparisonOperator.LE, rule7.getComparisonOperation());
ConditionalFormattingRule rule8 = sheetCF.createConditionalFormattingRule(
ComparisonOperator.BETWEEN, "0", "5");
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule8.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS.id, rule8.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule8.getConditionTypeType());
assertEquals("0", rule8.getFormula1());
assertEquals("5", rule8.getFormula2());
assertEquals(ComparisonOperator.BETWEEN, rule8.getComparisonOperation());
ConditionalFormattingRule rule9 = sheetCF.createConditionalFormattingRule(
ComparisonOperator.NOT_BETWEEN, "0", "5");
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule9.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS.id, rule9.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule9.getConditionTypeType());
assertEquals("0", rule9.getFormula1());
assertEquals("5", rule9.getFormula2());
assertEquals(ComparisonOperator.NOT_BETWEEN, rule9.getComparisonOperation());
@@ -456,7 +466,7 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
// CF1 has two rules: values less than -3 are bold-italic red, values greater than 3 are green
ConditionalFormattingRule rule1 = cf1.getRule(0);
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule1.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule1.getConditionTypeType());
assertEquals(ComparisonOperator.GT, rule1.getComparisonOperation());
assertEquals("3", rule1.getFormula1());
assertNull(rule1.getFormula2());
@@ -470,7 +480,7 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
assertFalse(fmt1.isItalic());
ConditionalFormattingRule rule2 = cf1.getRule(1);
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule2.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule2.getConditionTypeType());
assertEquals(ComparisonOperator.LT, rule2.getComparisonOperation());
assertEquals("-3", rule2.getFormula1());
assertNull(rule2.getFormula2());
@@ -490,7 +500,7 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
assertEquals("B9", regions2[0].formatAsString());
ConditionalFormattingRule rule3 = cf2.getRule(0);
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_FORMULA, rule3.getConditionType());
+ assertEquals(ConditionType.FORMULA, rule3.getConditionTypeType());
assertEquals(ComparisonOperator.NO_COMPARISON, rule3.getComparisonOperation());
assertEquals("$A$8>5", rule3.getFormula1());
assertNull(rule3.getFormula2());
@@ -514,13 +524,13 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
assertEquals(2, cf3.getNumberOfRules());
ConditionalFormattingRule rule4 = cf3.getRule(0);
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule4.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule4.getConditionTypeType());
assertEquals(ComparisonOperator.LE, rule4.getComparisonOperation());
assertEquals("\"AAA\"", rule4.getFormula1());
assertNull(rule4.getFormula2());
ConditionalFormattingRule rule5 = cf3.getRule(1);
- assertEquals(ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, rule5.getConditionType());
+ assertEquals(ConditionType.CELL_VALUE_IS, rule5.getConditionTypeType());
assertEquals(ComparisonOperator.BETWEEN, rule5.getComparisonOperation());
assertEquals("\"A\"", rule5.getFormula1());
assertEquals("\"AAA\"", rule5.getFormula2());
@@ -576,6 +586,7 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
assertEquals(1, cf.getNumberOfRules());
cr = cf.getRule(0);
+ assertEquals(ConditionType.CELL_VALUE_IS, cr.getConditionTypeType());
// TODO Check the rest of this
// Highlight 10-30 - Column D