Start testing the contents of FeatRecord

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@894091 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2009-12-27 18:22:02 +00:00
parent 9d432275a9
commit e4a4574a1e
2 changed files with 52 additions and 0 deletions

View File

@ -104,4 +104,38 @@ public final class FeatRecord extends StandardRecord {
(cellRefs.length * CellRangeAddress.ENCODED_SIZE)
+rgbFeat.length;
}
public int getIsf_sharedFeatureType() {
return isf_sharedFeatureType;
}
public void setIsf_sharedFeatureType(int isfSharedFeatureType) {
isf_sharedFeatureType = isfSharedFeatureType;
}
public long getCbFeatData() {
return cbFeatData;
}
public void setCbFeatData(long cbFeatData) {
this.cbFeatData = cbFeatData;
}
public CellRangeAddress[] getCellRefs() {
return cellRefs;
}
public void setCellRefs(CellRangeAddress[] cellRefs) {
this.cellRefs = cellRefs;
}
public byte[] getRgbFeat() {
return rgbFeat;
}
public void setRgbFeat(byte[] rgbFeat) {
this.rgbFeat = rgbFeat;
if(isf_sharedFeatureType == FeatHdrRecord.SHAREDFEATURES_ISFFEC2) {
cbFeatData = rgbFeat.length;
} else {
cbFeatData = 0;
}
}
}

View File

@ -88,6 +88,7 @@ public final class TestFeatRecord extends TestCase {
InternalWorkbook wb = HSSFTestHelper.getWorkbookForTest(hssf);
FeatRecord fr = null;
FeatHdrRecord fhr = null;
assertEquals(1, hssf.getNumberOfSheets());
@ -125,6 +126,7 @@ public final class TestFeatRecord extends TestCase {
countFR++;
}
if(r instanceof FeatHdrRecord) {
fhr = (FeatHdrRecord)r;
countFRH++;
} else if (r.getSid() == FeatHdrRecord.sid) {
countFRH++;
@ -135,7 +137,23 @@ public final class TestFeatRecord extends TestCase {
assertEquals(1, countFR);
assertEquals(1, countFRH);
assertNotNull(fr);
assertNotNull(fhr);
// Now check the contents are as expected
assertEquals(
FeatHdrRecord.SHAREDFEATURES_ISFFEC2,
fr.getIsf_sharedFeatureType()
);
// Applies to one cell only
assertEquals(1, fr.getCellRefs().length);
assertEquals(0, fr.getCellRefs()[0].getFirstRow());
assertEquals(0, fr.getCellRefs()[0].getLastRow());
assertEquals(0, fr.getCellRefs()[0].getFirstColumn());
assertEquals(0, fr.getCellRefs()[0].getLastColumn());
// TODO - more checking of shared features stuff
assertEquals(4, fr.getCbFeatData());
assertEquals(4, fr.getRgbFeat().length);
}
}