change HyperLink getType to return HyperlinkType

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808737 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2017-09-18 15:55:48 +00:00
parent aaad224db9
commit 318fe3e597
22 changed files with 183 additions and 176 deletions

View File

@ -179,7 +179,7 @@ public class ExcelComparator {
private void compareDataInCell(Locator loc1, Locator loc2) {
if (isCellTypeMatches(loc1, loc2)) {
final CellType loc1cellType = loc1.cell.getCellTypeEnum();
final CellType loc1cellType = loc1.cell.getCellType();
switch(loc1cellType) {
case BLANK:
case STRING:
@ -579,8 +579,8 @@ public class ExcelComparator {
* Checks if cell type matches.
*/
private boolean isCellTypeMatches(Locator loc1, Locator loc2) {
CellType type1 = loc1.cell.getCellTypeEnum();
CellType type2 = loc2.cell.getCellTypeEnum();
CellType type1 = loc1.cell.getCellType();
CellType type2 = loc2.cell.getCellType();
if (type1 == type2) return true;
addMessage(loc1, loc2,
"Cell Data-Type does not Match in :: ",

View File

@ -56,16 +56,17 @@ public interface Hyperlink {
*
* @return the type of this hyperlink
* @see HyperlinkType#forInt(int)
* @deprecated POI 3.15 beta 3. Use {@link #getTypeEnum()}
* getType will return a HyperlinkType enum in the future.
*/
public int getType();
public HyperlinkType getType();
/**
* Return the type of this hyperlink
*
* @return the type of this hyperlink
* @since POI 3.15 beta 3
* @deprecated use <code>getType()</code> instead
*/
@Deprecated
@Removal(version = "4.2")
public HyperlinkType getTypeEnum();
}

View File

@ -20,6 +20,7 @@ import org.apache.poi.common.usermodel.HyperlinkType;
import org.apache.poi.hssf.record.HyperlinkRecord;
import org.apache.poi.ss.usermodel.Hyperlink;
import org.apache.poi.util.Internal;
import org.apache.poi.util.Removal;
/**
* Represents an Excel hyperlink.
@ -258,22 +259,23 @@ public class HSSFHyperlink implements Hyperlink {
*
* @return the type of this hyperlink
* @see HyperlinkType#forInt
* @deprecated POI 3.15. Use {@link #getTypeEnum()} instead.
* getType will return a HyperlinkType enum in the future.
*/
@Override
public int getType() {
return link_type.getCode();
public HyperlinkType getType() {
return link_type;
}
/**
* Return the type of this hyperlink
*
* @return the type of this hyperlink
* @deprecated use <code>getType()</code> instead
*/
@Deprecated
@Removal(version = "4.2")
@Override
public HyperlinkType getTypeEnum() {
return link_type;
return getType();
}
/**

View File

@ -142,7 +142,7 @@ public class HSSFOptimiser {
HSSFSheet s = workbook.getSheetAt(sheetNum);
for (Row row : s) {
for (Cell cell : row) {
if(cell.getCellTypeEnum() == CellType.STRING) {
if(cell.getCellType() == CellType.STRING) {
HSSFRichTextString rtr = (HSSFRichTextString)cell.getRichStringCellValue();
UnicodeString u = rtr.getRawUnicodeString();

View File

@ -208,7 +208,7 @@ public interface Cell {
* Return a formula for the cell, for example, <code>SUM(C4:E4)</code>
*
* @return a formula for the cell
* @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()} is not {@link CellType#FORMULA}
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is not {@link CellType#FORMULA}
*/
String getCellFormula();
@ -219,7 +219,7 @@ public interface Cell {
* For formulas or error cells we return the precalculated value;
* </p>
* @return the value of the cell as a number
* @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()} is {@link CellType#STRING}
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING}
* @exception NumberFormatException if the cell value isn't a parsable <code>double</code>.
* @see DataFormatter for turning this number into a string similar to that which Excel would render this number as.
*/
@ -231,7 +231,7 @@ public interface Cell {
* For strings we throw an exception. For blank cells we return a null.
* </p>
* @return the value of the cell as a date
* @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()} is {@link CellType#STRING}
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING}
* @exception NumberFormatException if the cell value isn't a parsable <code>double</code>.
* @see DataFormatter for formatting this date into a string similar to how excel does.
*/
@ -283,7 +283,7 @@ public interface Cell {
* For strings, numbers, and errors, we throw an exception. For blank cells we return a false.
* </p>
* @return the value of the cell as a boolean
* @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()}
* @throws IllegalStateException if the cell type returned by {@link #getCellType()}
* is not {@link CellType#BOOLEAN}, {@link CellType#BLANK} or {@link CellType#FORMULA}
*/
boolean getBooleanCellValue();
@ -296,7 +296,7 @@ public interface Cell {
* </p>
*
* @return the value of the cell as an error code
* @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()} isn't {@link CellType#ERROR}
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} isn't {@link CellType#ERROR}
* @see FormulaError for error codes
*/
byte getErrorCellValue();

View File

@ -26,6 +26,7 @@ import org.apache.poi.openxml4j.opc.TargetMode;
import org.apache.poi.sl.usermodel.Hyperlink;
import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.util.Internal;
import org.apache.poi.util.Removal;
import org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink;
public class XSLFHyperlink implements Hyperlink<XSLFShape,XSLFTextParagraph> {
@ -69,17 +70,8 @@ public class XSLFHyperlink implements Hyperlink<XSLFShape,XSLFTextParagraph> {
_link.setTooltip(label);
}
/* (non-Javadoc)
* @deprecated POI 3.15. Use {@link #getTypeEnum()} instead.
* Will return a HyperlinkType enum in the future
*/
@Override
public int getType() {
return getTypeEnum().getCode();
}
@Override
public HyperlinkType getTypeEnum() {
public HyperlinkType getType() {
String action = _link.getAction();
if (action == null) {
action = "";
@ -87,7 +79,7 @@ public class XSLFHyperlink implements Hyperlink<XSLFShape,XSLFTextParagraph> {
if (action.equals("ppaction://hlinksldjump") || action.startsWith("ppaction://hlinkshowjump")) {
return HyperlinkType.DOCUMENT;
}
String address = getAddress();
if (address == null) {
address = "";
@ -99,6 +91,13 @@ public class XSLFHyperlink implements Hyperlink<XSLFShape,XSLFTextParagraph> {
}
}
@Deprecated
@Removal(version = "4.2")
@Override
public HyperlinkType getTypeEnum() {
return getType();
}
@Override
public void linkToEmail(String emailAddress) {
linkToExternal("mailto:"+emailAddress);

View File

@ -343,7 +343,7 @@ public class SXSSFCell implements Cell {
* Return a formula for the cell, for example, <code>SUM(C4:E4)</code>
*
* @return a formula for the cell
* @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()} is not CellType.FORMULA
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is not CellType.FORMULA
*/
@Override
public String getCellFormula()
@ -360,14 +360,14 @@ public class SXSSFCell implements Cell {
* For formulas or error cells we return the precalculated value;
* </p>
* @return the value of the cell as a number
* @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()} is CellType.STRING
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is CellType.STRING
* @exception NumberFormatException if the cell value isn't a parsable <code>double</code>.
* @see org.apache.poi.ss.usermodel.DataFormatter for turning this number into a string similar to that which Excel would render this number as.
*/
@Override
public double getNumericCellValue()
{
CellType cellType = getCellTypeEnum();
CellType cellType = getCellType();
switch(cellType)
{
case BLANK:
@ -399,7 +399,7 @@ public class SXSSFCell implements Cell {
@Override
public Date getDateCellValue()
{
CellType cellType = getCellTypeEnum();
CellType cellType = getCellType();
if (cellType == CellType.BLANK)
{
return null;
@ -421,8 +421,8 @@ public class SXSSFCell implements Cell {
@Override
public RichTextString getRichStringCellValue()
{
CellType cellType = getCellTypeEnum();
if(getCellTypeEnum() != CellType.STRING)
CellType cellType = getCellType();
if(getCellType() != CellType.STRING)
throw typeMismatch(CellType.STRING, cellType, false);
StringValue sval = (StringValue)_value;
@ -446,7 +446,7 @@ public class SXSSFCell implements Cell {
@Override
public String getStringCellValue()
{
CellType cellType = getCellTypeEnum();
CellType cellType = getCellType();
switch(cellType)
{
case BLANK:
@ -518,7 +518,7 @@ public class SXSSFCell implements Cell {
@Override
public boolean getBooleanCellValue()
{
CellType cellType = getCellTypeEnum();
CellType cellType = getCellType();
switch(cellType)
{
case BLANK:
@ -553,7 +553,7 @@ public class SXSSFCell implements Cell {
@Override
public byte getErrorCellValue()
{
CellType cellType = getCellTypeEnum();
CellType cellType = getCellType();
switch(cellType)
{
case BLANK:
@ -746,7 +746,7 @@ public class SXSSFCell implements Cell {
case STRING:
return getRichStringCellValue().toString();
default:
return "Unknown Cell Type: " + getCellTypeEnum();
return "Unknown Cell Type: " + getCellType();
}
}
@ -979,7 +979,7 @@ public class SXSSFCell implements Cell {
}
private boolean convertCellValueToBoolean() {
CellType cellType = getCellTypeEnum();
CellType cellType = getCellType();
if (cellType == CellType.FORMULA) {
cellType = getCachedFormulaResultType();
@ -1002,7 +1002,7 @@ public class SXSSFCell implements Cell {
}
private String convertCellValueToString() {
CellType cellType = getCellTypeEnum();
CellType cellType = getCellType();
return convertCellValueToString(cellType);
}
private String convertCellValueToString(CellType cellType) {

View File

@ -25,6 +25,7 @@ import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.ss.usermodel.Hyperlink;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.Internal;
import org.apache.poi.util.Removal;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHyperlink;
/**
@ -108,13 +109,13 @@ public class XSSFHyperlink implements Hyperlink {
public XSSFHyperlink(Hyperlink other) {
if (other instanceof XSSFHyperlink) {
XSSFHyperlink xlink = (XSSFHyperlink) other;
_type = xlink.getTypeEnum();
_type = xlink.getType();
_location = xlink._location;
_externalRel = xlink._externalRel;
_ctHyperlink = (CTHyperlink) xlink._ctHyperlink.copy();
}
else {
_type = other.getTypeEnum();
_type = other.getType();
_location = other.getAddress();
_externalRel = null;
_ctHyperlink = CTHyperlink.Factory.newInstance();
@ -156,22 +157,23 @@ public class XSSFHyperlink implements Hyperlink {
*
* @return the type of this hyperlink
* @see HyperlinkType#forInt
* @deprecated POI 3.15 beta 3. Use {@link #getTypeEnum()} instead.
* getType will return a HyperlinkType enum in the future.
*/
@Override
public int getType() {
return _type.getCode();
public HyperlinkType getType() {
return _type;
}
/**
* Return the type of this hyperlink
*
* @return the type of this hyperlink
* @deprecated use <code>getType</code> instead
*/
@Deprecated
@Removal(version = "4.2")
@Override
public HyperlinkType getTypeEnum() {
return _type;
return getType();
}
/**

View File

@ -147,13 +147,13 @@ public class TestXSLFHyperlink {
hl1 = tb1.getTextParagraphs().get(0).getTextRuns().get(0).getHyperlink();
assertNotNull(hl1);
assertEquals("dev@poi.apache.org", hl1.getLabel());
assertEquals(HyperlinkType.EMAIL, hl1.getTypeEnum());
assertEquals(HyperlinkType.EMAIL, hl1.getType());
tb2 = (XSLFTextBox)slides.get(1).getShapes().get(0);
hl2 = tb2.getTextParagraphs().get(0).getTextRuns().get(0).getHyperlink();
assertNotNull(hl2);
assertEquals("lastslide", hl2.getXmlObject().getAction().split("=")[1]);
assertEquals(HyperlinkType.DOCUMENT, hl2.getTypeEnum());
assertEquals(HyperlinkType.DOCUMENT, hl2.getType());
tb3 = (XSLFTextBox)slides.get(2).getShapes().get(0);
XSLFHyperlink hl3 = tb3.getTextParagraphs().get(0).getTextRuns().get(1).getHyperlink();
@ -161,19 +161,19 @@ public class TestXSLFHyperlink {
hl3 = tb3.getTextParagraphs().get(0).getTextRuns().get(3).getHyperlink();
assertNotNull(hl3);
assertEquals("/ppt/slides/slide1.xml", hl3.getAddress());
assertEquals(HyperlinkType.DOCUMENT, hl3.getTypeEnum());
assertEquals(HyperlinkType.DOCUMENT, hl3.getType());
tb4 = (XSLFTextBox)slides.get(3).getShapes().get(0);
hl4 = tb4.getTextParagraphs().get(0).getTextRuns().get(0).getHyperlink();
assertNotNull(hl4);
assertEquals("http://poi.apache.org", hl4.getLabel());
assertEquals(HyperlinkType.URL, hl4.getTypeEnum());
assertEquals(HyperlinkType.URL, hl4.getType());
tb5 = (XSLFTextBox)slides.get(4).getShapes().get(0);
hl5 = tb5.getHyperlink();
assertNotNull(hl5);
assertEquals("firstslide", hl5.getXmlObject().getAction().split("=")[1]);
assertEquals(HyperlinkType.DOCUMENT, hl5.getTypeEnum());
assertEquals(HyperlinkType.DOCUMENT, hl5.getType());
ppt2.close();
}

View File

@ -42,7 +42,7 @@ public final class TestCalculationChain extends TestCase {
XSSFSheet sheet = wb.getSheet("Test");
XSSFCell cell = sheet.getRow(0).getCell(4);
assertEquals(CellType.FORMULA, cell.getCellTypeEnum());
assertEquals(CellType.FORMULA, cell.getCellType());
cell.setCellFormula(null);
//the count of items is less by one
@ -53,9 +53,9 @@ public final class TestCalculationChain extends TestCase {
assertEquals(10, c.getI());
assertEquals("C1", c.getR());
assertEquals(CellType.STRING, cell.getCellTypeEnum());
assertEquals(CellType.STRING, cell.getCellType());
cell.setCellValue("ABC");
assertEquals(CellType.STRING, cell.getCellTypeEnum());
assertEquals(CellType.STRING, cell.getCellType());
}

View File

@ -165,7 +165,7 @@ public final class TestMatrixFormulasFromXMLSpreadsheet {
Cell c = sheet.getRow(rowNum).getCell(colNum);
if (c == null || c.getCellTypeEnum() != CellType.FORMULA) {
if (c == null || c.getCellType() != CellType.FORMULA) {
continue;
}
@ -178,27 +178,27 @@ public final class TestMatrixFormulasFromXMLSpreadsheet {
assertNotNull(msg + " - Bad setup data expected value is null", expValue);
assertNotNull(msg + " - actual value was null", actValue);
final CellType cellType = expValue.getCellTypeEnum();
final CellType cellType = expValue.getCellType();
switch (cellType) {
case BLANK:
assertEquals(msg, CellType.BLANK, actValue.getCellTypeEnum());
assertEquals(msg, CellType.BLANK, actValue.getCellType());
break;
case BOOLEAN:
assertEquals(msg, CellType.BOOLEAN, actValue.getCellTypeEnum());
assertEquals(msg, CellType.BOOLEAN, actValue.getCellType());
assertEquals(msg, expValue.getBooleanCellValue(), actValue.getBooleanValue());
break;
case ERROR:
assertEquals(msg, CellType.ERROR, actValue.getCellTypeEnum());
assertEquals(msg, CellType.ERROR, actValue.getCellType());
assertEquals(msg, ErrorEval.getText(expValue.getErrorCellValue()), ErrorEval.getText(actValue.getErrorValue()));
break;
case FORMULA: // will never be used, since we will call method after formula evaluation
fail("Cannot expect formula as result of formula evaluation: " + msg);
case NUMERIC:
assertEquals(msg, CellType.NUMERIC, actValue.getCellTypeEnum());
assertEquals(msg, CellType.NUMERIC, actValue.getCellType());
TestMathX.assertEquals(msg, expValue.getNumericCellValue(), actValue.getNumberValue(), TestMathX.POS_ZERO, TestMathX.DIFF_TOLERANCE_FACTOR);
break;
case STRING:
assertEquals(msg, CellType.STRING, actValue.getCellTypeEnum());
assertEquals(msg, CellType.STRING, actValue.getCellType());
assertEquals(msg, expValue.getRichStringCellValue().getString(), actValue.getStringValue());
break;
default:
@ -222,15 +222,15 @@ public final class TestMatrixFormulasFromXMLSpreadsheet {
System.err.println("Warning - Row " + r.getRowNum() + " has no cell " + Navigator.START_OPERATORS_COL_INDEX + ", can't figure out function name");
return null;
}
if(cell.getCellTypeEnum() == CellType.BLANK) {
if(cell.getCellType() == CellType.BLANK) {
return null;
}
if(cell.getCellTypeEnum() == CellType.STRING) {
if(cell.getCellType() == CellType.STRING) {
return cell.getRichStringCellValue().getString();
}
throw new AssertionFailedError("Bad cell type for 'function name' column: ("
+ cell.getCellTypeEnum() + ") row (" + (r.getRowNum() +1) + ")");
+ cell.getCellType() + ") row (" + (r.getRowNum() +1) + ")");
}

View File

@ -176,7 +176,7 @@ public final class TestMultiSheetFormulaEvaluatorOnXSSF {
Cell c = r.getCell(SS.COLUMN_INDEX_ACTUAL_VALUE);
assumeNotNull(c);
assumeTrue(c.getCellTypeEnum() == CellType.FORMULA);
assumeTrue(c.getCellType() == CellType.FORMULA);
CellValue actValue = evaluator.evaluate(c);
@ -185,17 +185,17 @@ public final class TestMultiSheetFormulaEvaluatorOnXSSF {
assertNotNull(msg + " - actual value was null", actValue);
final CellType expectedCellType = expValue.getCellTypeEnum();
final CellType expectedCellType = expValue.getCellType();
switch (expectedCellType) {
case BLANK:
assertEquals(msg, CellType.BLANK, actValue.getCellTypeEnum());
assertEquals(msg, CellType.BLANK, actValue.getCellType());
break;
case BOOLEAN:
assertEquals(msg, CellType.BOOLEAN, actValue.getCellTypeEnum());
assertEquals(msg, CellType.BOOLEAN, actValue.getCellType());
assertEquals(msg, expValue.getBooleanCellValue(), actValue.getBooleanValue());
break;
case ERROR:
assertEquals(msg, CellType.ERROR, actValue.getCellTypeEnum());
assertEquals(msg, CellType.ERROR, actValue.getCellType());
// if(false) { // TODO: fix ~45 functions which are currently returning incorrect error values
// assertEquals(msg, expected.getErrorCellValue(), actual.getErrorValue());
// }
@ -203,14 +203,14 @@ public final class TestMultiSheetFormulaEvaluatorOnXSSF {
case FORMULA: // will never be used, since we will call method after formula evaluation
fail("Cannot expect formula as result of formula evaluation: " + msg);
case NUMERIC:
assertEquals(msg, CellType.NUMERIC, actValue.getCellTypeEnum());
assertEquals(msg, CellType.NUMERIC, actValue.getCellType());
TestMathX.assertEquals(msg, expValue.getNumericCellValue(), actValue.getNumberValue(), TestMathX.POS_ZERO, TestMathX.DIFF_TOLERANCE_FACTOR);
// double delta = Math.abs(expected.getNumericCellValue()-actual.getNumberValue());
// double pctExpected = Math.abs(0.00001*expected.getNumericCellValue());
// assertTrue(msg, delta <= pctExpected);
break;
case STRING:
assertEquals(msg, CellType.STRING, actValue.getCellTypeEnum());
assertEquals(msg, CellType.STRING, actValue.getCellType());
assertEquals(msg, expValue.getRichStringCellValue().getString(), actValue.getStringValue());
break;
default:
@ -231,15 +231,15 @@ public final class TestMultiSheetFormulaEvaluatorOnXSSF {
logger.log(POILogger.WARN, "Warning - Row " + r.getRowNum() + " has no cell " + SS.COLUMN_INDEX_FUNCTION_NAME + ", can't figure out function name");
return null;
}
if(cell.getCellTypeEnum() == CellType.BLANK) {
if(cell.getCellType() == CellType.BLANK) {
return null;
}
if(cell.getCellTypeEnum() == CellType.STRING) {
if(cell.getCellType() == CellType.STRING) {
return cell.getRichStringCellValue().getString();
}
fail("Bad cell type for 'function name' column: ("
+ cell.getCellTypeEnum() + ") row (" + (r.getRowNum() +1) + ")");
+ cell.getCellType() + ") row (" + (r.getRowNum() +1) + ")");
return "";
}
/**
@ -255,15 +255,15 @@ public final class TestMultiSheetFormulaEvaluatorOnXSSF {
logger.log(POILogger.WARN, "Warning - Row " + r.getRowNum() + " has no cell " + SS.COLUMN_INDEX_TEST_NAME + ", can't figure out test name");
return null;
}
if(cell.getCellTypeEnum() == CellType.BLANK) {
if(cell.getCellType() == CellType.BLANK) {
return null;
}
if(cell.getCellTypeEnum() == CellType.STRING) {
if(cell.getCellType() == CellType.STRING) {
return cell.getRichStringCellValue().getString();
}
fail("Bad cell type for 'test name' column: ("
+ cell.getCellTypeEnum() + ") row (" + (r.getRowNum() +1) + ")");
+ cell.getCellType() + ") row (" + (r.getRowNum() +1) + ")");
return "";
}

View File

@ -33,6 +33,7 @@ import org.apache.poi.hslf.record.Record;
import org.apache.poi.hslf.record.TxInteractiveInfoAtom;
import org.apache.poi.sl.usermodel.Hyperlink;
import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.util.Removal;
/**
* Represents a hyperlink in a PowerPoint document
@ -128,11 +129,26 @@ public final class HSLFHyperlink implements Hyperlink<HSLFShape,HSLFTextParagrap
*
* @return the hyperlink URL
* @see InteractiveInfoAtom
* @deprecated POI 3.15 beta 3. Use {@link #getTypeEnum()}
*/
@Override
public int getType() {
return getTypeEnum().getCode();
public HyperlinkType getType() {
switch (info.getInteractiveInfoAtom().getHyperlinkType()) {
case InteractiveInfoAtom.LINK_Url:
return (exHyper.getLinkURL().startsWith("mailto:")) ? HyperlinkType.EMAIL : HyperlinkType.URL;
case InteractiveInfoAtom.LINK_NextSlide:
case InteractiveInfoAtom.LINK_PreviousSlide:
case InteractiveInfoAtom.LINK_FirstSlide:
case InteractiveInfoAtom.LINK_LastSlide:
case InteractiveInfoAtom.LINK_SlideNumber:
return HyperlinkType.DOCUMENT;
case InteractiveInfoAtom.LINK_CustomShow:
case InteractiveInfoAtom.LINK_OtherPresentation:
case InteractiveInfoAtom.LINK_OtherFile:
return HyperlinkType.FILE;
default:
case InteractiveInfoAtom.LINK_NULL:
return HyperlinkType.NONE;
}
}
/**
@ -141,26 +157,13 @@ public final class HSLFHyperlink implements Hyperlink<HSLFShape,HSLFTextParagrap
*
* @return the hyperlink URL
* @see InteractiveInfoAtom
* @deprecated use <code>getType</code> instead
*/
@Deprecated
@Removal(version = "4.2")
@Override
public HyperlinkType getTypeEnum() {
switch (info.getInteractiveInfoAtom().getHyperlinkType()) {
case InteractiveInfoAtom.LINK_Url:
return (exHyper.getLinkURL().startsWith("mailto:")) ? HyperlinkType.EMAIL : HyperlinkType.URL;
case InteractiveInfoAtom.LINK_NextSlide:
case InteractiveInfoAtom.LINK_PreviousSlide:
case InteractiveInfoAtom.LINK_FirstSlide:
case InteractiveInfoAtom.LINK_LastSlide:
case InteractiveInfoAtom.LINK_SlideNumber:
return HyperlinkType.DOCUMENT;
case InteractiveInfoAtom.LINK_CustomShow:
case InteractiveInfoAtom.LINK_OtherPresentation:
case InteractiveInfoAtom.LINK_OtherFile:
return HyperlinkType.FILE;
default:
case InteractiveInfoAtom.LINK_NULL:
return HyperlinkType.NONE;
}
return getType();
}
@Override

View File

@ -438,7 +438,7 @@ public final class TestCellStyle extends TestCase {
Cell cell = row.getCell(idxCell);
cell.getCellStyle().getDataFormatString();
if (cell.getCellTypeEnum() == CellType.NUMERIC) {
if (cell.getCellType() == CellType.NUMERIC) {
boolean isDate = HSSFDateUtil.isCellDateFormatted(cell);
if (idxCell > 0 && isDate) {
fail("cell " + idxCell + " is not a date: " + idxCell);

View File

@ -65,7 +65,7 @@ public final class TestHSSFHyperlink extends BaseTestHyperlink {
assertEquals("POI", link.getLabel());
assertEquals("POI", cell.getRichStringCellValue().getString());
assertEquals("http://poi.apache.org/", link.getAddress());
assertEquals(HyperlinkType.URL, link.getTypeEnum());
assertEquals(HyperlinkType.URL, link.getType());
cell = sheet.getRow(8).getCell(0);
link = cell.getHyperlink();
@ -73,7 +73,7 @@ public final class TestHSSFHyperlink extends BaseTestHyperlink {
assertEquals("HSSF", link.getLabel());
assertEquals("HSSF", cell.getRichStringCellValue().getString());
assertEquals("http://poi.apache.org/hssf/", link.getAddress());
assertEquals(HyperlinkType.URL, link.getTypeEnum());
assertEquals(HyperlinkType.URL, link.getType());
sheet = wb.getSheet("Emails");
cell = sheet.getRow(4).getCell(0);
@ -82,7 +82,7 @@ public final class TestHSSFHyperlink extends BaseTestHyperlink {
assertEquals("dev", link.getLabel());
assertEquals("dev", cell.getRichStringCellValue().getString());
assertEquals("mailto:dev@poi.apache.org", link.getAddress());
assertEquals(HyperlinkType.EMAIL, link.getTypeEnum());
assertEquals(HyperlinkType.EMAIL, link.getType());
sheet = wb.getSheet("Internal");
cell = sheet.getRow(4).getCell(0);
@ -92,7 +92,7 @@ public final class TestHSSFHyperlink extends BaseTestHyperlink {
assertEquals("Link To First Sheet", cell.getRichStringCellValue().getString());
assertEquals("WebLinks!A1", link.getTextMark());
assertEquals("WebLinks!A1", link.getAddress());
assertEquals(HyperlinkType.DOCUMENT, link.getTypeEnum());
assertEquals(HyperlinkType.DOCUMENT, link.getType());
}
@Test

View File

@ -164,7 +164,7 @@ public final class TestMatrixFormulasFromBinarySpreadsheet {
Cell c = sheet.getRow(rowNum).getCell(colNum);
if (c == null || c.getCellTypeEnum() != CellType.FORMULA) {
if (c == null || c.getCellType() != CellType.FORMULA) {
continue;
}
@ -177,27 +177,27 @@ public final class TestMatrixFormulasFromBinarySpreadsheet {
assertNotNull(msg + " - Bad setup data expected value is null", expValue);
assertNotNull(msg + " - actual value was null", actValue);
final CellType cellType = expValue.getCellTypeEnum();
final CellType cellType = expValue.getCellType();
switch (cellType) {
case BLANK:
assertEquals(msg, CellType.BLANK, actValue.getCellTypeEnum());
assertEquals(msg, CellType.BLANK, actValue.getCellType());
break;
case BOOLEAN:
assertEquals(msg, CellType.BOOLEAN, actValue.getCellTypeEnum());
assertEquals(msg, CellType.BOOLEAN, actValue.getCellType());
assertEquals(msg, expValue.getBooleanCellValue(), actValue.getBooleanValue());
break;
case ERROR:
assertEquals(msg, CellType.ERROR, actValue.getCellTypeEnum());
assertEquals(msg, CellType.ERROR, actValue.getCellType());
assertEquals(msg, ErrorEval.getText(expValue.getErrorCellValue()), ErrorEval.getText(actValue.getErrorValue()));
break;
case FORMULA: // will never be used, since we will call method after formula evaluation
fail("Cannot expect formula as result of formula evaluation: " + msg);
case NUMERIC:
assertEquals(msg, CellType.NUMERIC, actValue.getCellTypeEnum());
assertEquals(msg, CellType.NUMERIC, actValue.getCellType());
TestMathX.assertEquals(msg, expValue.getNumericCellValue(), actValue.getNumberValue(), TestMathX.POS_ZERO, TestMathX.DIFF_TOLERANCE_FACTOR);
break;
case STRING:
assertEquals(msg, CellType.STRING, actValue.getCellTypeEnum());
assertEquals(msg, CellType.STRING, actValue.getCellType());
assertEquals(msg, expValue.getRichStringCellValue().getString(), actValue.getStringValue());
break;
default:
@ -221,15 +221,15 @@ public final class TestMatrixFormulasFromBinarySpreadsheet {
System.err.println("Warning - Row " + r.getRowNum() + " has no cell " + Navigator.START_OPERATORS_COL_INDEX + ", can't figure out function name");
return null;
}
if(cell.getCellTypeEnum() == CellType.BLANK) {
if(cell.getCellType() == CellType.BLANK) {
return null;
}
if(cell.getCellTypeEnum() == CellType.STRING) {
if(cell.getCellType() == CellType.STRING) {
return cell.getRichStringCellValue().getString();
}
throw new AssertionFailedError("Bad cell type for 'function name' column: ("
+ cell.getCellTypeEnum() + ") row (" + (r.getRowNum() +1) + ")");
+ cell.getCellType() + ") row (" + (r.getRowNum() +1) + ")");
}

View File

@ -66,7 +66,7 @@ public abstract class BaseTestCircularReferences {
* Makes sure that the specified evaluated cell value represents a circular reference error.
*/
private static void confirmCycleErrorCode(CellValue cellValue) {
assertTrue(cellValue.getCellTypeEnum() == CellType.ERROR);
assertTrue(cellValue.getCellType() == CellType.ERROR);
assertEquals(ErrorEval.CIRCULAR_REF_ERROR.getErrorCode(), cellValue.getErrorValue());
}
@ -96,7 +96,7 @@ public abstract class BaseTestCircularReferences {
CellValue cellValue = evaluateWithCycles(wb, testCell);
assertTrue(cellValue.getCellTypeEnum() == CellType.NUMERIC);
assertTrue(cellValue.getCellType() == CellType.NUMERIC);
assertEquals(2, cellValue.getNumberValue(), 0);
wb.close();
}
@ -166,24 +166,24 @@ public abstract class BaseTestCircularReferences {
// Happy day flow - evaluate A1 first
cv = fe.evaluate(cellA1);
assertEquals(CellType.NUMERIC, cv.getCellTypeEnum());
assertEquals(CellType.NUMERIC, cv.getCellType());
assertEquals(42.0, cv.getNumberValue(), 0.0);
cv = fe.evaluate(cellB1); // no circ-ref-error because A1 result is cached
assertEquals(CellType.NUMERIC, cv.getCellTypeEnum());
assertEquals(CellType.NUMERIC, cv.getCellType());
assertEquals(46.0, cv.getNumberValue(), 0.0);
// Show the bug - evaluate another cell from the loop first
fe.clearAllCachedResultValues();
cv = fe.evaluate(cellB1);
// Identified bug 46898
assertNotEquals(cv.getCellTypeEnum(), ErrorEval.CIRCULAR_REF_ERROR.getErrorCode());
assertEquals(CellType.NUMERIC, cv.getCellTypeEnum());
assertNotEquals(cv.getCellType(), ErrorEval.CIRCULAR_REF_ERROR.getErrorCode());
assertEquals(CellType.NUMERIC, cv.getCellType());
assertEquals(46.0, cv.getNumberValue(), 0.0);
// start evaluation on another cell
fe.clearAllCachedResultValues();
cv = fe.evaluate(cellE1);
assertEquals(CellType.NUMERIC, cv.getCellTypeEnum());
assertEquals(CellType.NUMERIC, cv.getCellType());
assertEquals(43.0, cv.getNumberValue(), 0.0);
wb.close();

View File

@ -106,28 +106,28 @@ public final class TestMultiSheetEval extends TestCase {
throw new AssertionFailedError(msg + " - actual value was null");
}
final CellType cellType = expected.getCellTypeEnum();
final CellType cellType = expected.getCellType();
switch (cellType) {
case BLANK:
assertEquals(msg, CellType.BLANK, actual.getCellTypeEnum());
assertEquals(msg, CellType.BLANK, actual.getCellType());
break;
case BOOLEAN:
assertEquals(msg, CellType.BOOLEAN, actual.getCellTypeEnum());
assertEquals(msg, CellType.BOOLEAN, actual.getCellType());
assertEquals(msg, expected.getBooleanCellValue(), actual.getBooleanValue());
break;
case ERROR:
assertEquals(msg, CellType.ERROR, actual.getCellTypeEnum());
assertEquals(msg, CellType.ERROR, actual.getCellType());
assertEquals(msg, ErrorEval.getText(expected.getErrorCellValue()), ErrorEval.getText(actual.getErrorValue()));
break;
case FORMULA: // will never be used, since we will call method after formula evaluation
throw new AssertionFailedError("Cannot expect formula as result of formula evaluation: " + msg);
case NUMERIC:
assertEquals(msg, CellType.NUMERIC, actual.getCellTypeEnum());
assertEquals(msg, CellType.NUMERIC, actual.getCellType());
TestMathX.assertEquals(msg, expected.getNumericCellValue(), actual.getNumberValue(), TestMathX.POS_ZERO, TestMathX.DIFF_TOLERANCE_FACTOR);
break;
case STRING:
assertEquals(msg, CellType.STRING, actual.getCellTypeEnum());
assertEquals(msg, CellType.STRING, actual.getCellType());
assertEquals(msg, expected.getRichStringCellValue().getString(), actual.getStringValue());
break;
default:
@ -232,7 +232,7 @@ public final class TestMultiSheetEval extends TestCase {
int result = Result.NO_EVALUATIONS_FOUND; // so far
Cell c = formulasRow.getCell(SS.COLUMN_INDEX_ACTUAL_VALUE);
if (c == null || c.getCellTypeEnum() != CellType.FORMULA) {
if (c == null || c.getCellType() != CellType.FORMULA) {
return result;
}
@ -301,15 +301,15 @@ public final class TestMultiSheetEval extends TestCase {
System.err.println("Warning - Row " + r.getRowNum() + " has no cell " + SS.COLUMN_INDEX_FUNCTION_NAME + ", can't figure out function name");
return null;
}
if(cell.getCellTypeEnum() == CellType.BLANK) {
if(cell.getCellType() == CellType.BLANK) {
return null;
}
if(cell.getCellTypeEnum() == CellType.STRING) {
if(cell.getCellType() == CellType.STRING) {
return cell.getRichStringCellValue().getString();
}
throw new AssertionFailedError("Bad cell type for 'function name' column: ("
+ cell.getCellTypeEnum() + ") row (" + (r.getRowNum() +1) + ")");
+ cell.getCellType() + ") row (" + (r.getRowNum() +1) + ")");
}
/**
* @return <code>null</code> if cell is missing, empty or blank
@ -324,15 +324,15 @@ public final class TestMultiSheetEval extends TestCase {
System.err.println("Warning - Row " + r.getRowNum() + " has no cell " + SS.COLUMN_INDEX_TEST_NAME + ", can't figure out test name");
return null;
}
if(cell.getCellTypeEnum() == CellType.BLANK) {
if(cell.getCellType() == CellType.BLANK) {
return null;
}
if(cell.getCellTypeEnum() == CellType.STRING) {
if(cell.getCellType() == CellType.STRING) {
return cell.getRichStringCellValue().getString();
}
throw new AssertionFailedError("Bad cell type for 'test name' column: ("
+ cell.getCellTypeEnum() + ") row (" + (r.getRowNum() +1) + ")");
+ cell.getCellType() + ") row (" + (r.getRowNum() +1) + ")");
}
}

View File

@ -256,36 +256,36 @@ public abstract class BaseTestRow {
row.createCell(5).setCellValue(4);
// First up, no policy given, uses default
assertEquals(CellType.STRING, row.getCell(0).getCellTypeEnum());
assertEquals(CellType.NUMERIC, row.getCell(1).getCellTypeEnum());
assertEquals(CellType.STRING, row.getCell(0).getCellType());
assertEquals(CellType.NUMERIC, row.getCell(1).getCellType());
assertEquals(null, row.getCell(2));
assertEquals(null, row.getCell(3));
assertEquals(CellType.BLANK, row.getCell(4).getCellTypeEnum());
assertEquals(CellType.NUMERIC, row.getCell(5).getCellTypeEnum());
assertEquals(CellType.BLANK, row.getCell(4).getCellType());
assertEquals(CellType.NUMERIC, row.getCell(5).getCellType());
// RETURN_NULL_AND_BLANK - same as default
assertEquals(CellType.STRING, row.getCell(0, MissingCellPolicy.RETURN_NULL_AND_BLANK).getCellTypeEnum());
assertEquals(CellType.NUMERIC, row.getCell(1, MissingCellPolicy.RETURN_NULL_AND_BLANK).getCellTypeEnum());
assertEquals(CellType.STRING, row.getCell(0, MissingCellPolicy.RETURN_NULL_AND_BLANK).getCellType());
assertEquals(CellType.NUMERIC, row.getCell(1, MissingCellPolicy.RETURN_NULL_AND_BLANK).getCellType());
assertEquals(null, row.getCell(2, MissingCellPolicy.RETURN_NULL_AND_BLANK));
assertEquals(null, row.getCell(3, MissingCellPolicy.RETURN_NULL_AND_BLANK));
assertEquals(CellType.BLANK, row.getCell(4, MissingCellPolicy.RETURN_NULL_AND_BLANK).getCellTypeEnum());
assertEquals(CellType.NUMERIC, row.getCell(5, MissingCellPolicy.RETURN_NULL_AND_BLANK).getCellTypeEnum());
assertEquals(CellType.BLANK, row.getCell(4, MissingCellPolicy.RETURN_NULL_AND_BLANK).getCellType());
assertEquals(CellType.NUMERIC, row.getCell(5, MissingCellPolicy.RETURN_NULL_AND_BLANK).getCellType());
// RETURN_BLANK_AS_NULL - nearly the same
assertEquals(CellType.STRING, row.getCell(0, MissingCellPolicy.RETURN_BLANK_AS_NULL).getCellTypeEnum());
assertEquals(CellType.NUMERIC, row.getCell(1, MissingCellPolicy.RETURN_BLANK_AS_NULL).getCellTypeEnum());
assertEquals(CellType.STRING, row.getCell(0, MissingCellPolicy.RETURN_BLANK_AS_NULL).getCellType());
assertEquals(CellType.NUMERIC, row.getCell(1, MissingCellPolicy.RETURN_BLANK_AS_NULL).getCellType());
assertEquals(null, row.getCell(2, MissingCellPolicy.RETURN_BLANK_AS_NULL));
assertEquals(null, row.getCell(3, MissingCellPolicy.RETURN_BLANK_AS_NULL));
assertEquals(null, row.getCell(4, MissingCellPolicy.RETURN_BLANK_AS_NULL));
assertEquals(CellType.NUMERIC, row.getCell(5, MissingCellPolicy.RETURN_BLANK_AS_NULL).getCellTypeEnum());
assertEquals(CellType.NUMERIC, row.getCell(5, MissingCellPolicy.RETURN_BLANK_AS_NULL).getCellType());
// CREATE_NULL_AS_BLANK - creates as needed
assertEquals(CellType.STRING, row.getCell(0, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellTypeEnum());
assertEquals(CellType.NUMERIC, row.getCell(1, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellTypeEnum());
assertEquals(CellType.BLANK, row.getCell(2, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellTypeEnum());
assertEquals(CellType.BLANK, row.getCell(3, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellTypeEnum());
assertEquals(CellType.BLANK, row.getCell(4, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellTypeEnum());
assertEquals(CellType.NUMERIC, row.getCell(5, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellTypeEnum());
assertEquals(CellType.STRING, row.getCell(0, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellType());
assertEquals(CellType.NUMERIC, row.getCell(1, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellType());
assertEquals(CellType.BLANK, row.getCell(2, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellType());
assertEquals(CellType.BLANK, row.getCell(3, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellType());
assertEquals(CellType.BLANK, row.getCell(4, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellType());
assertEquals(CellType.NUMERIC, row.getCell(5, MissingCellPolicy.CREATE_NULL_AS_BLANK).getCellType());
// Check created ones get the right column
assertEquals(0, row.getCell(0, MissingCellPolicy.CREATE_NULL_AS_BLANK).getColumnIndex());
@ -300,12 +300,12 @@ public abstract class BaseTestRow {
// that that is now used if no policy given
workbook.setMissingCellPolicy(MissingCellPolicy.RETURN_BLANK_AS_NULL);
assertEquals(CellType.STRING, row.getCell(0).getCellTypeEnum());
assertEquals(CellType.NUMERIC, row.getCell(1).getCellTypeEnum());
assertEquals(CellType.STRING, row.getCell(0).getCellType());
assertEquals(CellType.NUMERIC, row.getCell(1).getCellType());
assertEquals(null, row.getCell(2));
assertEquals(null, row.getCell(3));
assertEquals(null, row.getCell(4));
assertEquals(CellType.NUMERIC, row.getCell(5).getCellTypeEnum());
assertEquals(CellType.NUMERIC, row.getCell(5).getCellType());
workbook.close();
}
@ -420,7 +420,7 @@ public abstract class BaseTestRow {
assertTrue(cell5 == it.next());
assertTrue(it.hasNext());
assertTrue(cell2 == it.next());
assertEquals(CellType.STRING, cell5.getCellTypeEnum());
assertEquals(CellType.STRING, cell5.getCellType());
wb.close();
}

View File

@ -133,7 +133,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
for(Cell acell : cells){
assertTrue(acell.isPartOfArrayFormulaGroup());
assertEquals(CellType.FORMULA, acell.getCellTypeEnum());
assertEquals(CellType.FORMULA, acell.getCellType());
assertEquals("SUM(A1:A3*B1:B3)", acell.getCellFormula());
//retrieve the range and check it is the same
assertEquals(range.formatAsString(), acell.getArrayFormulaRange().formatAsString());
@ -210,7 +210,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
for(Cell acell : cr){
assertFalse(acell.isPartOfArrayFormulaGroup());
assertEquals(CellType.BLANK, acell.getCellTypeEnum());
assertEquals(CellType.BLANK, acell.getCellType());
}
// cells C4:C6 are not included in array formula,
@ -279,7 +279,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
CellRange<? extends Cell> srange =
sheet.setArrayFormula("SUM(A4:A6,B4:B6)", CellRangeAddress.valueOf("B5"));
Cell scell = srange.getTopLeftCell();
assertEquals(CellType.FORMULA, scell.getCellTypeEnum());
assertEquals(CellType.FORMULA, scell.getCellType());
assertEquals(0.0, scell.getNumericCellValue(), 0);
scell.setCellValue(1.1);
assertEquals(1.1, scell.getNumericCellValue(), 0);
@ -288,7 +288,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
CellRange<? extends Cell> mrange =
sheet.setArrayFormula("A1:A3*B1:B3", CellRangeAddress.valueOf("C1:C3"));
for(Cell mcell : mrange){
assertEquals(CellType.FORMULA, mcell.getCellTypeEnum());
assertEquals(CellType.FORMULA, mcell.getCellType());
assertEquals(0.0, mcell.getNumericCellValue(), 0);
double fmlaResult = 1.2;
mcell.setCellValue(fmlaResult);
@ -307,10 +307,10 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
CellRange<? extends Cell> srange =
sheet.setArrayFormula("SUM(A4:A6,B4:B6)", CellRangeAddress.valueOf("B5"));
Cell scell = srange.getTopLeftCell();
assertEquals(CellType.FORMULA, scell.getCellTypeEnum());
assertEquals(CellType.FORMULA, scell.getCellType());
assertEquals(0.0, scell.getNumericCellValue(), 0);
scell.setCellType(CellType.STRING);
assertEquals(CellType.STRING, scell.getCellTypeEnum());
assertEquals(CellType.STRING, scell.getCellType());
scell.setCellValue("string cell");
assertEquals("string cell", scell.getStringCellValue());
@ -319,7 +319,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
sheet.setArrayFormula("A1:A3*B1:B3", CellRangeAddress.valueOf("C1:C3"));
for(Cell mcell : mrange){
try {
assertEquals(CellType.FORMULA, mcell.getCellTypeEnum());
assertEquals(CellType.FORMULA, mcell.getCellType());
mcell.setCellType(CellType.NUMERIC);
fail("expected exception");
} catch (IllegalStateException e){
@ -329,7 +329,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
}
// a failed invocation of Cell.setCellType leaves the cell
// in the state that it was in prior to the invocation
assertEquals(CellType.FORMULA, mcell.getCellTypeEnum());
assertEquals(CellType.FORMULA, mcell.getCellType());
assertTrue(mcell.isPartOfArrayFormulaGroup());
}
workbook.close();
@ -344,13 +344,13 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
sheet.setArrayFormula("SUM(A4:A6,B4:B6)", CellRangeAddress.valueOf("B5"));
Cell scell = srange.getTopLeftCell();
assertEquals("SUM(A4:A6,B4:B6)", scell.getCellFormula());
assertEquals(CellType.FORMULA, scell.getCellTypeEnum());
assertEquals(CellType.FORMULA, scell.getCellType());
assertTrue(scell.isPartOfArrayFormulaGroup());
scell.setCellFormula("SUM(A4,A6)");
//we are now a normal formula cell
assertEquals("SUM(A4,A6)", scell.getCellFormula());
assertFalse(scell.isPartOfArrayFormulaGroup());
assertEquals(CellType.FORMULA, scell.getCellTypeEnum());
assertEquals(CellType.FORMULA, scell.getCellType());
//check that setting formula result works
assertEquals(0.0, scell.getNumericCellValue(), 0);
scell.setCellValue(33.0);
@ -396,7 +396,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
//re-create the removed cell
scell = srow.createCell(cra.getFirstColumn());
assertEquals(CellType.BLANK, scell.getCellTypeEnum());
assertEquals(CellType.BLANK, scell.getCellType());
assertFalse(scell.isPartOfArrayFormulaGroup());
//we cannot remove cells included in a multi-cell array formula
@ -417,7 +417,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
// in the state that it was in prior to the invocation
assertSame(mcell, mrow.getCell(columnIndex));
assertTrue(mcell.isPartOfArrayFormulaGroup());
assertEquals(CellType.FORMULA, mcell.getCellTypeEnum());
assertEquals(CellType.FORMULA, mcell.getCellType());
}
workbook.close();
@ -433,7 +433,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
CellRange<? extends Cell> srange =
sheet.setArrayFormula("SUM(A4:A6,B4:B6)", cra);
Cell scell = srange.getTopLeftCell();
assertEquals(CellType.FORMULA, scell.getCellTypeEnum());
assertEquals(CellType.FORMULA, scell.getCellType());
Row srow = scell.getRow();
assertSame(srow, sheet.getRow(cra.getFirstRow()));
@ -442,7 +442,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
//re-create the removed row and cell
scell = sheet.createRow(cra.getFirstRow()).createCell(cra.getFirstColumn());
assertEquals(CellType.BLANK, scell.getCellTypeEnum());
assertEquals(CellType.BLANK, scell.getCellType());
assertFalse(scell.isPartOfArrayFormulaGroup());
//we cannot remove rows with cells included in a multi-cell array formula
@ -463,7 +463,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
assertSame(mrow, sheet.getRow(mrow.getRowNum()));
assertSame(mcell, mrow.getCell(columnIndex));
assertTrue(mcell.isPartOfArrayFormulaGroup());
assertEquals(CellType.FORMULA, mcell.getCellTypeEnum());
assertEquals(CellType.FORMULA, mcell.getCellType());
}
workbook.close();
@ -481,7 +481,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
Cell scell = srange.getTopLeftCell();
sheet.addMergedRegion(CellRangeAddress.valueOf("B5:C6"));
//we are still an array formula
assertEquals(CellType.FORMULA, scell.getCellTypeEnum());
assertEquals(CellType.FORMULA, scell.getCellType());
assertTrue(scell.isPartOfArrayFormulaGroup());
assertEquals(1, sheet.getNumMergedRegions());
@ -570,7 +570,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas {
assertEquals(cra.formatAsString(), mcell.getArrayFormulaRange().formatAsString());
assertEquals("A2:A4*B2:B4", mcell.getCellFormula());
assertTrue(mcell.isPartOfArrayFormulaGroup());
assertEquals(CellType.FORMULA, mcell.getCellTypeEnum());
assertEquals(CellType.FORMULA, mcell.getCellType());
}
*/

View File

@ -811,7 +811,7 @@ public class TestDataFormatter {
CellReference ref = new CellReference("D47");
Cell cell = wb.getSheetAt(0).getRow(ref.getRow()).getCell(ref.getCol());
assertEquals(CellType.FORMULA, cell.getCellTypeEnum());
assertEquals(CellType.FORMULA, cell.getCellType());
assertEquals("G9:K9 I7:I12", cell.getCellFormula());
DataFormatter formatter = new DataFormatter();

View File

@ -50,7 +50,7 @@ public final class TestSheetBuilder extends TestCase {
Row firstRow = sheet.getRow(0);
Cell firstCell = firstRow.getCell(0);
assertEquals(firstCell.getCellTypeEnum(), CellType.NUMERIC);
assertEquals(firstCell.getCellType(), CellType.NUMERIC);
assertEquals(1.0, firstCell.getNumericCellValue(), 0.00001);
@ -59,11 +59,11 @@ public final class TestSheetBuilder extends TestCase {
assertNull(secondRow.getCell(2));
Row thirdRow = sheet.getRow(2);
assertEquals(CellType.STRING, thirdRow.getCell(0).getCellTypeEnum());
assertEquals(CellType.STRING, thirdRow.getCell(0).getCellType());
String cellValue = thirdRow.getCell(0).getStringCellValue();
assertEquals(testData[2][0].toString(), cellValue);
assertEquals(CellType.FORMULA, thirdRow.getCell(2).getCellTypeEnum());
assertEquals(CellType.FORMULA, thirdRow.getCell(2).getCellType());
assertEquals("A1+B2", thirdRow.getCell(2).getCellFormula());
}
@ -73,7 +73,7 @@ public final class TestSheetBuilder extends TestCase {
Cell emptyCell = sheet.getRow(1).getCell(1);
assertNotNull(emptyCell);
assertEquals(CellType.BLANK, emptyCell.getCellTypeEnum());
assertEquals(CellType.BLANK, emptyCell.getCellType());
}
public void testSheetName() {