You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2008/04/05 15:07:25 UTC
svn commit: r645088 [3/3] - in /poi/branches/ooxml: ./
src/documentation/content/xdocs/ src/java/org/apache/poi/hssf/model/
src/java/org/apache/poi/hssf/record/
src/java/org/apache/poi/hssf/record/aggregates/
src/java/org/apache/poi/hssf/record/cf/ src...
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java Sat Apr 5 06:07:22 2008
@@ -19,109 +19,107 @@
import junit.framework.TestCase;
+import org.apache.poi.hssf.model.Workbook;
+import org.apache.poi.hssf.record.CFRuleRecord.ComparisonOperator;
import org.apache.poi.hssf.record.cf.BorderFormatting;
import org.apache.poi.hssf.record.cf.FontFormatting;
import org.apache.poi.hssf.record.cf.PatternFormatting;
import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.util.LittleEndian;
/**
* Tests the serialization and deserialization of the TestCFRuleRecord
- * class works correctly.
+ * class works correctly.
*
* @author Dmitriy Kumshayev
*/
-public class TestCFRuleRecord
- extends TestCase
+public final class TestCFRuleRecord extends TestCase
{
- public TestCFRuleRecord(String name)
- {
- super(name);
- }
-
- public void testCreateCFRuleRecord ()
- {
- CFRuleRecord record = new CFRuleRecord();
- testCFRuleRecord(record);
-
- // Serialize
- byte [] serializedRecord = record.serialize();
-
- // Strip header
- byte [] recordData = new byte[serializedRecord.length-4];
- System.arraycopy(serializedRecord, 4, recordData, 0, recordData.length);
-
- // Deserialize
- record = new CFRuleRecord(new TestcaseRecordInputStream(CFRuleRecord.sid, (short)recordData.length, recordData));
-
- // Serialize again
+ public void testCreateCFRuleRecord ()
+ {
+ Workbook workbook = Workbook.createWorkbook();
+ CFRuleRecord record = CFRuleRecord.create(workbook, "7");
+ testCFRuleRecord(record);
+
+ // Serialize
+ byte [] serializedRecord = record.serialize();
+
+ // Strip header
+ byte [] recordData = new byte[serializedRecord.length-4];
+ System.arraycopy(serializedRecord, 4, recordData, 0, recordData.length);
+
+ // Deserialize
+ record = new CFRuleRecord(new TestcaseRecordInputStream(CFRuleRecord.sid, (short)recordData.length, recordData));
+
+ // Serialize again
byte[] output = record.serialize();
-
+
// Compare
assertEquals("Output size", recordData.length+4, output.length); //includes sid+recordlength
-
+
for (int i = 0; i < recordData.length;i++)
{
assertEquals("CFRuleRecord doesn't match", recordData[i], output[i+4]);
}
- }
+ }
private void testCFRuleRecord(CFRuleRecord record)
{
FontFormatting fontFormatting = new FontFormatting();
- testFontFormattingAccessors(fontFormatting);
- assertFalse(record.containsFontFormattingBlock());
- record.setFontFormatting(fontFormatting);
- assertTrue(record.containsFontFormattingBlock());
-
- BorderFormatting borderFormatting = new BorderFormatting();
- testBorderFormattingAccessors(borderFormatting);
- assertFalse(record.containsBorderFormattingBlock());
- record.setBorderFormatting(borderFormatting);
- assertTrue(record.containsBorderFormattingBlock());
-
- assertFalse(record.isLeftBorderModified());
- record.setLeftBorderModified(true);
- assertTrue(record.isLeftBorderModified());
-
- assertFalse(record.isRightBorderModified());
- record.setRightBorderModified(true);
- assertTrue(record.isRightBorderModified());
-
- assertFalse(record.isTopBorderModified());
- record.setTopBorderModified(true);
- assertTrue(record.isTopBorderModified());
-
- assertFalse(record.isBottomBorderModified());
- record.setBottomBorderModified(true);
- assertTrue(record.isBottomBorderModified());
-
- assertFalse(record.isTopLeftBottomRightBorderModified());
- record.setTopLeftBottomRightBorderModified(true);
- assertTrue(record.isTopLeftBottomRightBorderModified());
-
- assertFalse(record.isBottomLeftTopRightBorderModified());
- record.setBottomLeftTopRightBorderModified(true);
- assertTrue(record.isBottomLeftTopRightBorderModified());
-
-
- PatternFormatting patternFormatting = new PatternFormatting();
- testPatternFormattingAccessors(patternFormatting);
- assertFalse(record.containsPatternFormattingBlock());
- record.setPatternFormatting(patternFormatting);
- assertTrue(record.containsPatternFormattingBlock());
-
- assertFalse(record.isPatternBackgroundColorModified());
- record.setPatternBackgroundColorModified(true);
- assertTrue(record.isPatternBackgroundColorModified());
-
- assertFalse(record.isPatternColorModified());
- record.setPatternColorModified(true);
- assertTrue(record.isPatternColorModified());
-
- assertFalse(record.isPatternStyleModified());
- record.setPatternStyleModified(true);
- assertTrue(record.isPatternStyleModified());
+ testFontFormattingAccessors(fontFormatting);
+ assertFalse(record.containsFontFormattingBlock());
+ record.setFontFormatting(fontFormatting);
+ assertTrue(record.containsFontFormattingBlock());
+
+ BorderFormatting borderFormatting = new BorderFormatting();
+ testBorderFormattingAccessors(borderFormatting);
+ assertFalse(record.containsBorderFormattingBlock());
+ record.setBorderFormatting(borderFormatting);
+ assertTrue(record.containsBorderFormattingBlock());
+
+ assertFalse(record.isLeftBorderModified());
+ record.setLeftBorderModified(true);
+ assertTrue(record.isLeftBorderModified());
+
+ assertFalse(record.isRightBorderModified());
+ record.setRightBorderModified(true);
+ assertTrue(record.isRightBorderModified());
+
+ assertFalse(record.isTopBorderModified());
+ record.setTopBorderModified(true);
+ assertTrue(record.isTopBorderModified());
+
+ assertFalse(record.isBottomBorderModified());
+ record.setBottomBorderModified(true);
+ assertTrue(record.isBottomBorderModified());
+
+ assertFalse(record.isTopLeftBottomRightBorderModified());
+ record.setTopLeftBottomRightBorderModified(true);
+ assertTrue(record.isTopLeftBottomRightBorderModified());
+
+ assertFalse(record.isBottomLeftTopRightBorderModified());
+ record.setBottomLeftTopRightBorderModified(true);
+ assertTrue(record.isBottomLeftTopRightBorderModified());
+
+
+ PatternFormatting patternFormatting = new PatternFormatting();
+ testPatternFormattingAccessors(patternFormatting);
+ assertFalse(record.containsPatternFormattingBlock());
+ record.setPatternFormatting(patternFormatting);
+ assertTrue(record.containsPatternFormattingBlock());
+
+ assertFalse(record.isPatternBackgroundColorModified());
+ record.setPatternBackgroundColorModified(true);
+ assertTrue(record.isPatternBackgroundColorModified());
+
+ assertFalse(record.isPatternColorModified());
+ record.setPatternColorModified(true);
+ assertTrue(record.isPatternColorModified());
+
+ assertFalse(record.isPatternStyleModified());
+ record.setPatternStyleModified(true);
+ assertTrue(record.isPatternStyleModified());
}
private void testPatternFormattingAccessors(PatternFormatting patternFormatting)
@@ -131,10 +129,9 @@
patternFormatting.setFillForegroundColor(HSSFColor.INDIGO.index);
assertEquals(HSSFColor.INDIGO.index,patternFormatting.getFillForegroundColor());
-
+
patternFormatting.setFillPattern(PatternFormatting.DIAMONDS);
assertEquals(PatternFormatting.DIAMONDS,patternFormatting.getFillPattern());
-
}
private void testBorderFormattingAccessors(BorderFormatting borderFormatting)
@@ -143,13 +140,13 @@
assertFalse(borderFormatting.isBackwardDiagonalOn());
borderFormatting.setBackwardDiagonalOn(true);
assertTrue(borderFormatting.isBackwardDiagonalOn());
-
+
borderFormatting.setBorderBottom(BorderFormatting.BORDER_DOTTED);
assertEquals(BorderFormatting.BORDER_DOTTED, borderFormatting.getBorderBottom());
-
+
borderFormatting.setBorderDiagonal(BorderFormatting.BORDER_MEDIUM);
assertEquals(BorderFormatting.BORDER_MEDIUM, borderFormatting.getBorderDiagonal());
-
+
borderFormatting.setBorderLeft(BorderFormatting.BORDER_MEDIUM_DASH_DOT_DOT);
assertEquals(BorderFormatting.BORDER_MEDIUM_DASH_DOT_DOT, borderFormatting.getBorderLeft());
@@ -178,119 +175,137 @@
borderFormatting.setTopBorderColor(HSSFColor.GOLD.index);
assertEquals(HSSFColor.GOLD.index, borderFormatting.getTopBorderColor());
}
-
-
+
+
private void testFontFormattingAccessors(FontFormatting fontFormatting)
{
// Check for defaults
- assertFalse(fontFormatting.isEscapementTypeModified());
- assertFalse(fontFormatting.isFontCancellationModified());
- assertFalse(fontFormatting.isFontCondenseModified());
- assertFalse(fontFormatting.isFontOutlineModified());
- assertFalse(fontFormatting.isFontShadowModified());
- assertFalse(fontFormatting.isFontStyleModified());
- assertFalse(fontFormatting.isUnderlineTypeModified());
-
- assertFalse(fontFormatting.isBold());
- assertFalse(fontFormatting.isCondenseOn());
- assertFalse(fontFormatting.isItalic());
- assertFalse(fontFormatting.isOutlineOn());
- assertFalse(fontFormatting.isShadowOn());
- assertFalse(fontFormatting.isStruckout());
-
- assertEquals(0, fontFormatting.getEscapementType());
- assertEquals(-1, fontFormatting.getFontColorIndex());
- assertEquals(-1, fontFormatting.getFontHeight());
- assertEquals(400, fontFormatting.getFontWeight());
- assertEquals(0, fontFormatting.getUnderlineType());
-
- fontFormatting.setBold(true);
- assertTrue(fontFormatting.isBold());
- fontFormatting.setBold(false);
- assertFalse(fontFormatting.isBold());
-
- fontFormatting.setCondense(true);
- assertTrue(fontFormatting.isCondenseOn());
- fontFormatting.setCondense(false);
- assertFalse(fontFormatting.isCondenseOn());
-
- fontFormatting.setEscapementType(FontFormatting.SS_SUB);
- assertEquals(FontFormatting.SS_SUB, fontFormatting.getEscapementType());
- fontFormatting.setEscapementType(FontFormatting.SS_SUPER);
- assertEquals(FontFormatting.SS_SUPER, fontFormatting.getEscapementType());
- fontFormatting.setEscapementType(FontFormatting.SS_NONE);
- assertEquals(FontFormatting.SS_NONE, fontFormatting.getEscapementType());
-
- fontFormatting.setEscapementTypeModified(false);
- assertFalse(fontFormatting.isEscapementTypeModified());
- fontFormatting.setEscapementTypeModified(true);
- assertTrue(fontFormatting.isEscapementTypeModified());
-
- fontFormatting.setFontCancellationModified(false);
- assertFalse(fontFormatting.isFontCancellationModified());
- fontFormatting.setFontCancellationModified(true);
- assertTrue(fontFormatting.isFontCancellationModified());
-
- fontFormatting.setFontColorIndex((short)10);
- assertEquals(10,fontFormatting.getFontColorIndex());
-
- fontFormatting.setFontCondenseModified(false);
- assertFalse(fontFormatting.isFontCondenseModified());
- fontFormatting.setFontCondenseModified(true);
- assertTrue(fontFormatting.isFontCondenseModified());
-
- fontFormatting.setFontHeight((short)100);
- assertEquals(100,fontFormatting.getFontHeight());
-
- fontFormatting.setFontOutlineModified(false);
- assertFalse(fontFormatting.isFontOutlineModified());
- fontFormatting.setFontOutlineModified(true);
- assertTrue(fontFormatting.isFontOutlineModified());
-
- fontFormatting.setFontShadowModified(false);
- assertFalse(fontFormatting.isFontShadowModified());
- fontFormatting.setFontShadowModified(true);
- assertTrue(fontFormatting.isFontShadowModified());
-
- fontFormatting.setFontStyleModified(false);
- assertFalse(fontFormatting.isFontStyleModified());
- fontFormatting.setFontStyleModified(true);
- assertTrue(fontFormatting.isFontStyleModified());
-
- fontFormatting.setItalic(false);
- assertFalse(fontFormatting.isItalic());
- fontFormatting.setItalic(true);
- assertTrue(fontFormatting.isItalic());
-
- fontFormatting.setOutline(false);
- assertFalse(fontFormatting.isOutlineOn());
- fontFormatting.setOutline(true);
- assertTrue(fontFormatting.isOutlineOn());
-
- fontFormatting.setShadow(false);
- assertFalse(fontFormatting.isShadowOn());
- fontFormatting.setShadow(true);
- assertTrue(fontFormatting.isShadowOn());
-
- fontFormatting.setStrikeout(false);
- assertFalse(fontFormatting.isStruckout());
- fontFormatting.setStrikeout(true);
- assertTrue(fontFormatting.isStruckout());
-
- fontFormatting.setUnderlineType(FontFormatting.U_DOUBLE_ACCOUNTING);
- assertEquals(FontFormatting.U_DOUBLE_ACCOUNTING, fontFormatting.getUnderlineType());
-
- fontFormatting.setUnderlineTypeModified(false);
- assertFalse(fontFormatting.isUnderlineTypeModified());
- fontFormatting.setUnderlineTypeModified(true);
- assertTrue(fontFormatting.isUnderlineTypeModified());
+ assertFalse(fontFormatting.isEscapementTypeModified());
+ assertFalse(fontFormatting.isFontCancellationModified());
+ assertFalse(fontFormatting.isFontCondenseModified());
+ assertFalse(fontFormatting.isFontOutlineModified());
+ assertFalse(fontFormatting.isFontShadowModified());
+ assertFalse(fontFormatting.isFontStyleModified());
+ assertFalse(fontFormatting.isUnderlineTypeModified());
+
+ assertFalse(fontFormatting.isBold());
+ assertFalse(fontFormatting.isCondenseOn());
+ assertFalse(fontFormatting.isItalic());
+ assertFalse(fontFormatting.isOutlineOn());
+ assertFalse(fontFormatting.isShadowOn());
+ assertFalse(fontFormatting.isStruckout());
+
+ assertEquals(0, fontFormatting.getEscapementType());
+ assertEquals(-1, fontFormatting.getFontColorIndex());
+ assertEquals(-1, fontFormatting.getFontHeight());
+ assertEquals(400, fontFormatting.getFontWeight());
+ assertEquals(0, fontFormatting.getUnderlineType());
+
+ fontFormatting.setBold(true);
+ assertTrue(fontFormatting.isBold());
+ fontFormatting.setBold(false);
+ assertFalse(fontFormatting.isBold());
+
+ fontFormatting.setCondense(true);
+ assertTrue(fontFormatting.isCondenseOn());
+ fontFormatting.setCondense(false);
+ assertFalse(fontFormatting.isCondenseOn());
+
+ fontFormatting.setEscapementType(FontFormatting.SS_SUB);
+ assertEquals(FontFormatting.SS_SUB, fontFormatting.getEscapementType());
+ fontFormatting.setEscapementType(FontFormatting.SS_SUPER);
+ assertEquals(FontFormatting.SS_SUPER, fontFormatting.getEscapementType());
+ fontFormatting.setEscapementType(FontFormatting.SS_NONE);
+ assertEquals(FontFormatting.SS_NONE, fontFormatting.getEscapementType());
+
+ fontFormatting.setEscapementTypeModified(false);
+ assertFalse(fontFormatting.isEscapementTypeModified());
+ fontFormatting.setEscapementTypeModified(true);
+ assertTrue(fontFormatting.isEscapementTypeModified());
+
+ fontFormatting.setFontCancellationModified(false);
+ assertFalse(fontFormatting.isFontCancellationModified());
+ fontFormatting.setFontCancellationModified(true);
+ assertTrue(fontFormatting.isFontCancellationModified());
+
+ fontFormatting.setFontColorIndex((short)10);
+ assertEquals(10,fontFormatting.getFontColorIndex());
+
+ fontFormatting.setFontCondenseModified(false);
+ assertFalse(fontFormatting.isFontCondenseModified());
+ fontFormatting.setFontCondenseModified(true);
+ assertTrue(fontFormatting.isFontCondenseModified());
+
+ fontFormatting.setFontHeight((short)100);
+ assertEquals(100,fontFormatting.getFontHeight());
+
+ fontFormatting.setFontOutlineModified(false);
+ assertFalse(fontFormatting.isFontOutlineModified());
+ fontFormatting.setFontOutlineModified(true);
+ assertTrue(fontFormatting.isFontOutlineModified());
+
+ fontFormatting.setFontShadowModified(false);
+ assertFalse(fontFormatting.isFontShadowModified());
+ fontFormatting.setFontShadowModified(true);
+ assertTrue(fontFormatting.isFontShadowModified());
+
+ fontFormatting.setFontStyleModified(false);
+ assertFalse(fontFormatting.isFontStyleModified());
+ fontFormatting.setFontStyleModified(true);
+ assertTrue(fontFormatting.isFontStyleModified());
+
+ fontFormatting.setItalic(false);
+ assertFalse(fontFormatting.isItalic());
+ fontFormatting.setItalic(true);
+ assertTrue(fontFormatting.isItalic());
+
+ fontFormatting.setOutline(false);
+ assertFalse(fontFormatting.isOutlineOn());
+ fontFormatting.setOutline(true);
+ assertTrue(fontFormatting.isOutlineOn());
+
+ fontFormatting.setShadow(false);
+ assertFalse(fontFormatting.isShadowOn());
+ fontFormatting.setShadow(true);
+ assertTrue(fontFormatting.isShadowOn());
+
+ fontFormatting.setStrikeout(false);
+ assertFalse(fontFormatting.isStruckout());
+ fontFormatting.setStrikeout(true);
+ assertTrue(fontFormatting.isStruckout());
+
+ fontFormatting.setUnderlineType(FontFormatting.U_DOUBLE_ACCOUNTING);
+ assertEquals(FontFormatting.U_DOUBLE_ACCOUNTING, fontFormatting.getUnderlineType());
+
+ fontFormatting.setUnderlineTypeModified(false);
+ assertFalse(fontFormatting.isUnderlineTypeModified());
+ fontFormatting.setUnderlineTypeModified(true);
+ assertTrue(fontFormatting.isUnderlineTypeModified());
}
-
-
- public static void main(String[] ignored_args)
+
+ public void testWrite() {
+ Workbook workbook = Workbook.createWorkbook();
+ CFRuleRecord rr = CFRuleRecord.create(workbook, ComparisonOperator.BETWEEN, "5", "10");
+
+ PatternFormatting patternFormatting = new PatternFormatting();
+ patternFormatting.setFillPattern(PatternFormatting.BRICKS);
+ rr.setPatternFormatting(patternFormatting);
+
+ byte[] data = rr.serialize();
+ assertEquals(26, data.length);
+ assertEquals(3, LittleEndian.getShort(data, 6));
+ assertEquals(3, LittleEndian.getShort(data, 8));
+
+ int flags = LittleEndian.getInt(data, 10);
+ assertEquals("unused flags should be 111", 0x00380000, flags & 0x00380000);
+ assertEquals("undocumented flags should be 0000", 0, flags & 0x03C00000); // Otherwise Excel gets unhappy
+ assertEquals(0xA03FFFFF, flags);
+ }
+
+
+ public static void main(String[] ignored_args)
{
System.out.println("Testing org.apache.poi.hssf.record.CFRuleRecord");
junit.textui.TestRunner.run(TestCFRuleRecord.class);
}
-
}
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java Sat Apr 5 06:07:22 2008
@@ -44,7 +44,7 @@
}
}
}
-
+
public void testBasicSize() {
ExternalNameRecord enr = createSimpleENR();
if(enr.getRecordSize() == 13) {
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/aggregates/TestCFRecordsAggregate.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/aggregates/TestCFRecordsAggregate.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/aggregates/TestCFRecordsAggregate.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/aggregates/TestCFRecordsAggregate.java Sat Apr 5 06:07:22 2008
@@ -24,9 +24,11 @@
import junit.framework.TestCase;
+import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.hssf.record.CFHeaderRecord;
import org.apache.poi.hssf.record.CFRuleRecord;
import org.apache.poi.hssf.record.RecordFactory;
+import org.apache.poi.hssf.record.CFRuleRecord.ComparisonOperator;
import org.apache.poi.hssf.record.cf.CellRange;
/**
@@ -35,77 +37,71 @@
*
* @author Dmitriy Kumshayev
*/
-public class TestCFRecordsAggregate
- extends TestCase
+public final class TestCFRecordsAggregate extends TestCase
{
- public TestCFRecordsAggregate(String name)
- {
- super(name);
- }
-
- public void testCFRecordsAggregate()
- {
- CFRecordsAggregate record = new CFRecordsAggregate();
- List recs = new ArrayList();
- CFHeaderRecord header = new CFHeaderRecord();
- CFRuleRecord rule1 = new CFRuleRecord();
- CFRuleRecord rule2 = new CFRuleRecord();
- CFRuleRecord rule3 = new CFRuleRecord();
- header.setNumberOfConditionalFormats(3);
- CellRange range1 = new CellRange(0,1,(short)0,(short)0);
- CellRange range2 = new CellRange(0,1,(short)2,(short)2);
- List cellRanges = new ArrayList();
- cellRanges.add(range1);
- cellRanges.add(range2);
- header.setCellRanges(cellRanges);
- recs.add(header);
- recs.add(rule1);
- recs.add(rule2);
- recs.add(rule3);
- record = CFRecordsAggregate.createCFAggregate(recs, 0);
-
- // Serialize
- byte [] serializedRecord = record.serialize();
- InputStream in = new ByteArrayInputStream(serializedRecord);
-
- //Parse
- recs = RecordFactory.createRecords(in);
-
- // Verify
- assertNotNull(recs);
- assertEquals(4, recs.size());
-
- header = (CFHeaderRecord)recs.get(0);
- rule1 = (CFRuleRecord)recs.get(1);
- rule2 = (CFRuleRecord)recs.get(2);
- rule3 = (CFRuleRecord)recs.get(3);
- cellRanges = header.getCellRanges();
-
- assertEquals(2, cellRanges.size());
- assertEquals(3, header.getNumberOfConditionalFormats());
-
- record = CFRecordsAggregate.createCFAggregate(recs, 0);
-
- record = record.cloneCFAggregate();
-
- assertNotNull(record.getHeader());
- assertEquals(3,record.getRules().size());
-
- header = record.getHeader();
- rule1 = (CFRuleRecord)record.getRules().get(0);
- rule2 = (CFRuleRecord)record.getRules().get(1);
- rule3 = (CFRuleRecord)record.getRules().get(2);
- cellRanges = header.getCellRanges();
-
- assertEquals(2, cellRanges.size());
- assertEquals(3, header.getNumberOfConditionalFormats());
- }
+ public void testCFRecordsAggregate()
+ {
+ Workbook workbook = Workbook.createWorkbook();
+ List recs = new ArrayList();
+ CFHeaderRecord header = new CFHeaderRecord();
+ CFRuleRecord rule1 = CFRuleRecord.create(workbook, "7");
+ CFRuleRecord rule2 = CFRuleRecord.create(workbook, ComparisonOperator.BETWEEN, "2", "5");
+ CFRuleRecord rule3 = CFRuleRecord.create(workbook, ComparisonOperator.GE, "100", null);
+ header.setNumberOfConditionalFormats(3);
+ CellRange[] cellRanges = {
+ new CellRange(0,1,0,0),
+ new CellRange(0,1,2,2),
+ };
+ header.setCellRanges(cellRanges);
+ recs.add(header);
+ recs.add(rule1);
+ recs.add(rule2);
+ recs.add(rule3);
+ CFRecordsAggregate record;
+ record = CFRecordsAggregate.createCFAggregate(recs, 0);
+
+ // Serialize
+ byte [] serializedRecord = record.serialize();
+ InputStream in = new ByteArrayInputStream(serializedRecord);
+
+ //Parse
+ recs = RecordFactory.createRecords(in);
+
+ // Verify
+ assertNotNull(recs);
+ assertEquals(4, recs.size());
+
+ header = (CFHeaderRecord)recs.get(0);
+ rule1 = (CFRuleRecord)recs.get(1);
+ rule2 = (CFRuleRecord)recs.get(2);
+ rule3 = (CFRuleRecord)recs.get(3);
+ cellRanges = header.getCellRanges();
+
+ assertEquals(2, cellRanges.length);
+ assertEquals(3, header.getNumberOfConditionalFormats());
+
+ record = CFRecordsAggregate.createCFAggregate(recs, 0);
+
+ record = record.cloneCFAggregate();
+
+ assertNotNull(record.getHeader());
+ assertEquals(3,record.getNumberOfRules());
+
+ header = record.getHeader();
+ rule1 = record.getRule(0);
+ rule2 = record.getRule(1);
+ rule3 = record.getRule(2);
+ cellRanges = header.getCellRanges();
+
+ assertEquals(2, cellRanges.length);
+ assertEquals(3, header.getNumberOfConditionalFormats());
+ }
- public static void main(String[] ignored_args)
+ public static void main(String[] ignored_args)
{
System.out.println("Testing org.apache.poi.hssf.record.aggregates.CFRecordsAggregate");
junit.textui.TestRunner.run(TestCFRecordsAggregate.class);
}
-
+
}
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/aggregates/TestColumnInfoRecordsAggregate.java Sat Apr 5 06:07:22 2008
@@ -23,7 +23,7 @@
/**
* @author Glen Stampoultzis
*/
-public class TestColumnInfoRecordsAggregate extends TestCase
+public final class TestColumnInfoRecordsAggregate extends TestCase
{
ColumnInfoRecordsAggregate columnInfoRecordsAggregate;
@@ -35,7 +35,7 @@
columnInfoRecordsAggregate.insertColumn( createColumn( (short)8, (short)8 ));
// columnInfoRecordsAggregate.setColumn( (short)2, new Short( (short)200 ), new Integer( 1 ), new Boolean( true ), null);
columnInfoRecordsAggregate.groupColumnRange( (short)2, (short)5, true );
- System.out.println( "columnInfoRecordsAggregate = " + columnInfoRecordsAggregate.getNumColumns() );
+ assertEquals(6, columnInfoRecordsAggregate.getNumColumns());
assertEquals(columnInfoRecordsAggregate.getRecordSize(), columnInfoRecordsAggregate.serialize().length);
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/cf/TestCellRange.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/cf/TestCellRange.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/cf/TestCellRange.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/cf/TestCellRange.java Sat Apr 5 06:07:22 2008
@@ -24,13 +24,13 @@
*/
public class TestCellRange extends TestCase
{
- private static final CellRange biggest = new CellRange(0, -1,(short) 0,(short)-1);
- private static final CellRange tenthColumn = new CellRange(0, -1,(short)10,(short)10);
- private static final CellRange tenthRow = new CellRange(10,10,(short) 0,(short)-1);
- private static final CellRange box10x10 = new CellRange(0, 10,(short) 0,(short)10);
- private static final CellRange box9x9 = new CellRange(0, 9,(short) 0,(short) 9);
- private static final CellRange box10to20c = new CellRange(0, 10,(short)10,(short)20);
- private static final CellRange oneCell = new CellRange(10,10,(short)10,(short)10);
+ private static final CellRange biggest = new CellRange( 0, -1, 0,-1);
+ private static final CellRange tenthColumn = new CellRange( 0, -1,10,10);
+ private static final CellRange tenthRow = new CellRange(10, 10, 0,-1);
+ private static final CellRange box10x10 = new CellRange( 0, 10, 0,10);
+ private static final CellRange box9x9 = new CellRange( 0, 9, 0, 9);
+ private static final CellRange box10to20c = new CellRange( 0, 10,10,20);
+ private static final CellRange oneCell = new CellRange(10, 10,10,10);
boolean [][] contanis = new boolean[][]
{
@@ -61,62 +61,62 @@
}
}
}
-
- private static final CellRange col1 = new CellRange(0, -1,(short) 1,(short)1);
- private static final CellRange col2 = new CellRange(0, -1,(short) 2,(short)2);
- private static final CellRange row1 = new CellRange(1, 1,(short) 0,(short)-1);
- private static final CellRange row2 = new CellRange(2, 2,(short) 0,(short)-1);
-
- private static final CellRange box0 = new CellRange( 0, 2,(short) 0,(short)2);
- private static final CellRange box1 = new CellRange( 0, 1,(short) 0,(short)1);
- private static final CellRange box2 = new CellRange( 0, 1,(short) 2,(short)3);
- private static final CellRange box3 = new CellRange( 2, 3,(short) 0,(short)1);
- private static final CellRange box4 = new CellRange( 2, 3,(short) 2,(short)3);
- private static final CellRange box5 = new CellRange( 1, 3,(short) 1,(short)3);
+
+ private static final CellRange col1 = new CellRange( 0, -1, 1,1);
+ private static final CellRange col2 = new CellRange( 0, -1, 2,2);
+ private static final CellRange row1 = new CellRange( 1, 1, 0,-1);
+ private static final CellRange row2 = new CellRange( 2, 2, 0,-1);
+
+ private static final CellRange box0 = new CellRange( 0, 2, 0,2);
+ private static final CellRange box1 = new CellRange( 0, 1, 0,1);
+ private static final CellRange box2 = new CellRange( 0, 1, 2,3);
+ private static final CellRange box3 = new CellRange( 2, 3, 0,1);
+ private static final CellRange box4 = new CellRange( 2, 3, 2,3);
+ private static final CellRange box5 = new CellRange( 1, 3, 1,3);
public void testHasSharedBorderMethod()
{
- assertFalse(col1.hasSharedBorder(col1));
- assertFalse(col2.hasSharedBorder(col2));
- assertTrue(col1.hasSharedBorder(col2));
- assertTrue(col2.hasSharedBorder(col1));
-
- assertFalse(row1.hasSharedBorder(row1));
- assertFalse(row2.hasSharedBorder(row2));
- assertTrue(row1.hasSharedBorder(row2));
- assertTrue(row2.hasSharedBorder(row1));
+ assertFalse(col1.hasExactSharedBorder(col1));
+ assertFalse(col2.hasExactSharedBorder(col2));
+ assertTrue(col1.hasExactSharedBorder(col2));
+ assertTrue(col2.hasExactSharedBorder(col1));
+
+ assertFalse(row1.hasExactSharedBorder(row1));
+ assertFalse(row2.hasExactSharedBorder(row2));
+ assertTrue(row1.hasExactSharedBorder(row2));
+ assertTrue(row2.hasExactSharedBorder(row1));
- assertFalse(row1.hasSharedBorder(col1));
- assertFalse(row1.hasSharedBorder(col2));
- assertFalse(col1.hasSharedBorder(row1));
- assertFalse(col2.hasSharedBorder(row1));
- assertFalse(row2.hasSharedBorder(col1));
- assertFalse(row2.hasSharedBorder(col2));
- assertFalse(col1.hasSharedBorder(row2));
- assertFalse(col2.hasSharedBorder(row2));
- assertTrue(col2.hasSharedBorder(col1));
+ assertFalse(row1.hasExactSharedBorder(col1));
+ assertFalse(row1.hasExactSharedBorder(col2));
+ assertFalse(col1.hasExactSharedBorder(row1));
+ assertFalse(col2.hasExactSharedBorder(row1));
+ assertFalse(row2.hasExactSharedBorder(col1));
+ assertFalse(row2.hasExactSharedBorder(col2));
+ assertFalse(col1.hasExactSharedBorder(row2));
+ assertFalse(col2.hasExactSharedBorder(row2));
+ assertTrue(col2.hasExactSharedBorder(col1));
- assertFalse(box1.hasSharedBorder(box1));
- assertTrue(box1.hasSharedBorder(box2));
- assertTrue(box1.hasSharedBorder(box3));
- assertFalse(box1.hasSharedBorder(box4));
+ assertFalse(box1.hasExactSharedBorder(box1));
+ assertTrue(box1.hasExactSharedBorder(box2));
+ assertTrue(box1.hasExactSharedBorder(box3));
+ assertFalse(box1.hasExactSharedBorder(box4));
- assertTrue(box2.hasSharedBorder(box1));
- assertFalse(box2.hasSharedBorder(box2));
- assertFalse(box2.hasSharedBorder(box3));
- assertTrue(box2.hasSharedBorder(box4));
+ assertTrue(box2.hasExactSharedBorder(box1));
+ assertFalse(box2.hasExactSharedBorder(box2));
+ assertFalse(box2.hasExactSharedBorder(box3));
+ assertTrue(box2.hasExactSharedBorder(box4));
- assertTrue(box3.hasSharedBorder(box1));
- assertFalse(box3.hasSharedBorder(box2));
- assertFalse(box3.hasSharedBorder(box3));
- assertTrue(box3.hasSharedBorder(box4));
+ assertTrue(box3.hasExactSharedBorder(box1));
+ assertFalse(box3.hasExactSharedBorder(box2));
+ assertFalse(box3.hasExactSharedBorder(box3));
+ assertTrue(box3.hasExactSharedBorder(box4));
- assertFalse(box4.hasSharedBorder(box1));
- assertTrue(box4.hasSharedBorder(box2));
- assertTrue(box4.hasSharedBorder(box3));
- assertFalse(box4.hasSharedBorder(box4));
+ assertFalse(box4.hasExactSharedBorder(box1));
+ assertTrue(box4.hasExactSharedBorder(box2));
+ assertTrue(box4.hasExactSharedBorder(box3));
+ assertFalse(box4.hasExactSharedBorder(box4));
}
-
+
public void testIntersectMethod()
{
assertEquals( CellRange.OVERLAP,box0.intersect(box5));
@@ -135,5 +135,4 @@
assertEquals(CellRange.INSIDE,tenthColumn.intersect(tenthColumn));
assertEquals(CellRange.INSIDE,tenthRow.intersect(tenthRow));
}
-
}
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/AllFormulaTests.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/AllFormulaTests.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/AllFormulaTests.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/AllFormulaTests.java Sat Apr 5 06:07:22 2008
@@ -17,13 +17,15 @@
package org.apache.poi.hssf.record.formula;
+import org.apache.poi.hssf.record.formula.eval.AllFormulaEvalTests;
import org.apache.poi.hssf.record.formula.function.AllFormulaFunctionTests;
+import org.apache.poi.hssf.record.formula.functions.AllIndividualFunctionEvaluationTests;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
- * Collects all tests for this package.
+ * Collects all tests for <tt>org.apache.poi.hssf.record.formula</tt>.
*
* @author Josh Micich
*/
@@ -31,6 +33,10 @@
public static Test suite() {
TestSuite result = new TestSuite(AllFormulaTests.class.getName());
+ result.addTest(AllFormulaEvalTests.suite());
+ result.addTest(AllFormulaFunctionTests.suite());
+ result.addTest(AllIndividualFunctionEvaluationTests.suite());
+
result.addTestSuite(TestArea3DPtg.class);
result.addTestSuite(TestAreaErrPtg.class);
result.addTestSuite(TestAreaPtg.class);
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/AllFormulaFunctionTests.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/AllFormulaFunctionTests.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/AllFormulaFunctionTests.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/AllFormulaFunctionTests.java Sat Apr 5 06:07:22 2008
@@ -21,7 +21,7 @@
import junit.framework.TestSuite;
/**
- * Collects all tests for this package.
+ * Collects all tests for this <tt>org.apache.poi.hssf.record.formula.function</tt>.
*
* @author Josh Micich
*/
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/ExcelFileFormatDocFunctionExtractor.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/ExcelFileFormatDocFunctionExtractor.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/ExcelFileFormatDocFunctionExtractor.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/ExcelFileFormatDocFunctionExtractor.java Sat Apr 5 06:07:22 2008
@@ -49,14 +49,14 @@
import org.xml.sax.helpers.XMLReaderFactory;
/**
- * This class is not used during normal POI run-time but is used at development time to generate
+ * This class is not used during normal POI run-time but is used at development time to generate
* the file 'functionMetadata.txt'. There are more than 300 built-in functions in Excel and the
* intention of this class is to make it easier to maintain the metadata, by extracting it from
* a reliable source.
*
* @author Josh Micich
*/
-public class ExcelFileFormatDocFunctionExtractor {
+public final class ExcelFileFormatDocFunctionExtractor {
private static final String SOURCE_DOC_FILE_NAME = "excelfileformat.odt";
@@ -195,19 +195,19 @@
"table:table-row", "table:table-cell", "text:p", "text:span", "text:note-ref",
};
-
+
private final Stack _elemNameStack;
/** <code>true</code> only when parsing the target tables */
private boolean _isInsideTable;
-
+
private final List _rowData;
private final StringBuffer _textNodeBuffer;
private final List _rowNoteFlags;
private boolean _cellHasNote;
-
+
private final FunctionDataCollector _fdc;
private String _lastHeadingText;
-
+
public EFFDocHandler(FunctionDataCollector fdc) {
_fdc = fdc;
_elemNameStack = new Stack();
@@ -216,7 +216,7 @@
_textNodeBuffer = new StringBuffer();
_rowNoteFlags = new ArrayList();
}
-
+
private boolean matchesTargetPath() {
return matchesPath(0, TABLE_BASE_PATH_NAMES);
}
@@ -365,7 +365,7 @@
xr.setContentHandler(new EFFDocHandler(fdc));
InputSource inSrc = new InputSource(is);
-
+
try {
xr.parse(inSrc);
is.close();
@@ -407,30 +407,30 @@
}
private static void outputLicenseHeader(PrintStream ps) {
- String[] lines= {
- "Licensed to the Apache Software Foundation (ASF) under one or more",
- "contributor license agreements. See the NOTICE file distributed with",
- "this work for additional information regarding copyright ownership.",
- "The ASF licenses this file to You under the Apache License, Version 2.0",
- "(the \"License\"); you may not use this file except in compliance with",
- "the License. You may obtain a copy of the License at",
- "",
- " http://www.apache.org/licenses/LICENSE-2.0",
- "",
- "Unless required by applicable law or agreed to in writing, software",
- "distributed under the License is distributed on an \"AS IS\" BASIS,",
- "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
- "See the License for the specific language governing permissions and",
- "limitations under the License.",
- };
- for (int i = 0; i < lines.length; i++) {
- ps.print("# ");
- ps.println(lines[i]);
- }
- ps.println();
- }
+ String[] lines= {
+ "Licensed to the Apache Software Foundation (ASF) under one or more",
+ "contributor license agreements. See the NOTICE file distributed with",
+ "this work for additional information regarding copyright ownership.",
+ "The ASF licenses this file to You under the Apache License, Version 2.0",
+ "(the \"License\"); you may not use this file except in compliance with",
+ "the License. You may obtain a copy of the License at",
+ "",
+ " http://www.apache.org/licenses/LICENSE-2.0",
+ "",
+ "Unless required by applicable law or agreed to in writing, software",
+ "distributed under the License is distributed on an \"AS IS\" BASIS,",
+ "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
+ "See the License for the specific language governing permissions and",
+ "limitations under the License.",
+ };
+ for (int i = 0; i < lines.length; i++) {
+ ps.print("# ");
+ ps.println(lines[i]);
+ }
+ ps.println();
+ }
- /**
+ /**
* Helps identify the source file
*/
private static String getFileCRC(File f) {
@@ -451,10 +451,10 @@
}
return "0x" + Long.toHexString(crc.getValue()).toUpperCase();
}
-
+
private static File getSourceFile() {
- if (true) {
- File dir = new File("c:/josh/ref-docs");
+ if (false) {
+ File dir = new File("c:/temp");
File effDocFile = new File(dir, SOURCE_DOC_FILE_NAME);
return effDocFile;
}
@@ -464,7 +464,7 @@
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
-
+
File result;
byte[]buf = new byte[2048];
try {
@@ -488,16 +488,15 @@
System.out.println("file downloaded ok");
return result;
}
-
+
public static void main(String[] args) {
-
+
File effDocFile = getSourceFile();
if(!effDocFile.exists()) {
throw new RuntimeException("file '" + effDocFile.getAbsolutePath() + "' does not exist");
}
-
+
File outFile = new File("functionMetadata-asGenerated.txt");
processFile(effDocFile, outFile);
}
-
}
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestFunctionMetadataRegistry.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestFunctionMetadataRegistry.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestFunctionMetadataRegistry.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestFunctionMetadataRegistry.java Sat Apr 5 06:07:22 2008
@@ -18,26 +18,27 @@
package org.apache.poi.hssf.record.formula.function;
import junit.framework.TestCase;
+
/**
*
* @author Josh Micich
*/
public final class TestFunctionMetadataRegistry extends TestCase {
- public void testWellKnownFunctions() {
- confirmFunction(0, "COUNT");
- confirmFunction(1, "IF");
-
- }
+ public void testWellKnownFunctions() {
+ confirmFunction(0, "COUNT");
+ confirmFunction(1, "IF");
+
+ }
+
+ private static void confirmFunction(int index, String funcName) {
+ FunctionMetadata fm;
+ fm = FunctionMetadataRegistry.getFunctionByIndex(index);
+ assertNotNull(fm);
+ assertEquals(funcName, fm.getName());
- private static void confirmFunction(int index, String funcName) {
- FunctionMetadata fm;
- fm = FunctionMetadataRegistry.getFunctionByIndex(index);
- assertNotNull(fm);
- assertEquals(funcName, fm.getName());
-
- fm = FunctionMetadataRegistry.getFunctionByName(funcName);
- assertNotNull(fm);
- assertEquals(index, fm.getIndex());
- }
+ fm = FunctionMetadataRegistry.getFunctionByName(funcName);
+ assertNotNull(fm);
+ assertEquals(index, fm.getIndex());
+ }
}
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestParseMissingBuiltInFuncs.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestParseMissingBuiltInFuncs.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestParseMissingBuiltInFuncs.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestParseMissingBuiltInFuncs.java Sat Apr 5 06:07:22 2008
@@ -44,8 +44,8 @@
}
AbstractFunctionPtg func = (AbstractFunctionPtg) ptgF;
if(func.getFunctionIndex() == 255) {
- throw new AssertionFailedError("Failed to recognise built-in function in formula '"
- + formula + "'");
+ throw new AssertionFailedError("Failed to recognise built-in function in formula '"
+ + formula + "'");
}
assertEquals(expPtgArraySize, ptgs.length);
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestReadMissingBuiltInFuncs.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestReadMissingBuiltInFuncs.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestReadMissingBuiltInFuncs.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/function/TestReadMissingBuiltInFuncs.java Sat Apr 5 06:07:22 2008
@@ -48,7 +48,7 @@
}
sht = wb.getSheetAt(0);
}
-
+
public void testDatedif() {
String formula;
@@ -56,9 +56,9 @@
formula = getCellFormula(0);
} catch (IllegalStateException e) {
if(e.getMessage().startsWith("Too few arguments")) {
- if(e.getMessage().indexOf("AttrPtg") > 0) {
- throw afe("tAttrVolatile not supported in FormulaParser.toFormulaString");
- }
+ if(e.getMessage().indexOf("AttrPtg") > 0) {
+ throw afe("tAttrVolatile not supported in FormulaParser.toFormulaString");
+ }
throw afe("NOW() registered with 1 arg instead of 0");
}
if(e.getMessage().startsWith("too much stuff")) {
@@ -70,7 +70,7 @@
assertEquals("DATEDIF(NOW(),NOW(),\"d\")", formula);
}
public void testDdb() {
-
+
String formula = getCellFormula(1);
if("externalflag(1,1,1,1,1)".equals(formula)) {
throw afe("DDB() not registered");
@@ -78,14 +78,14 @@
assertEquals("DDB(1,1,1,1,1)", formula);
}
public void testAtan() {
-
+
String formula = getCellFormula(2);
if(formula.equals("ARCTAN(1)")) {
throw afe("func ix 18 registered as ARCTAN() instead of ATAN()");
}
assertEquals("ATAN(1)", formula);
}
-
+
public void testUsdollar() {
String formula = getCellFormula(3);
@@ -128,7 +128,7 @@
}
assertEquals("ISNONTEXT(\"abc\")", formula);
}
-
+
private String getCellFormula(int rowIx) {
String result = sht.getRow(rowIx).getCell((short)0).getCellFormula();
if (false) {
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/AllIndividualFunctionEvaluationTests.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/AllIndividualFunctionEvaluationTests.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/AllIndividualFunctionEvaluationTests.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/AllIndividualFunctionEvaluationTests.java Sat Apr 5 06:07:22 2008
@@ -27,9 +27,8 @@
*/
public final class AllIndividualFunctionEvaluationTests {
- // TODO - have this suite incorporated into a higher level one
public static Test suite() {
- TestSuite result = new TestSuite("Tests for org.apache.poi.hssf.record.formula.functions");
+ TestSuite result = new TestSuite(AllIndividualFunctionEvaluationTests.class.getName());
result.addTestSuite(TestAverage.class);
result.addTestSuite(TestCountFuncs.class);
result.addTestSuite(TestDate.class);
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestPmt.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestPmt.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestPmt.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/record/formula/functions/TestPmt.java Sat Apr 5 06:07:22 2008
@@ -30,7 +30,7 @@
* @author Josh Micich
*/
public final class TestPmt extends TestCase {
-
+
private static void confirm(double expected, NumberEval ne) {
// only asserting accuracy to 4 fractional digits
assertEquals(expected, ne.getNumberValue(), 0.00005);
@@ -61,12 +61,12 @@
confirm(expected, invokeNormal(args));
}
-
+
public void testBasic() {
confirm(-1037.0321, (0.08/12), 10, 10000, 0, false);
confirm(-1030.1643, (0.08/12), 10, 10000, 0, true);
}
-
+
public void test3args() {
Eval[] args = {
Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=645088&r1=645087&r2=645088&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Sat Apr 5 06:07:22 2008
@@ -357,14 +357,14 @@
book.createSheet("TEST");
HSSFSheet sheet = book.cloneSheet(0);
book.setSheetName(1,"CLONE");
- sheet.createRow(0).createCell((short)0).setCellValue("Test");
+ sheet.createRow(0).createCell((short)0).setCellValue(new HSSFRichTextString("Test"));
book.write(out);
book = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
sheet = book.getSheet("CLONE");
HSSFRow row = sheet.getRow(0);
HSSFCell cell = row.getCell((short)0);
- System.out.println(cell.getStringCellValue());
+ assertEquals("Test", cell.getRichStringCellValue().getString());
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org