mirror of https://github.com/apache/poi.git
add test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892179 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
df9bc05a94
commit
d7dd7abf78
|
@ -396,7 +396,6 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
|
|||
|
||||
@Test
|
||||
void testChangeReference() throws IOException {
|
||||
try (XSSFWorkbook wb = new XSSFWorkbook()) {
|
||||
XSSFHyperlink hyperlink = new XSSFHyperlink(HyperlinkType.URL);
|
||||
hyperlink.setCellReference("B2");
|
||||
assertEquals(1, hyperlink.getFirstRow());
|
||||
|
@ -435,5 +434,46 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
|
|||
assertEquals(2, hyperlink.getFirstColumn());
|
||||
assertEquals(2, hyperlink.getLastColumn());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testChangeRowsAndColumns() throws IOException {
|
||||
XSSFHyperlink hyperlink = new XSSFHyperlink(HyperlinkType.URL);
|
||||
hyperlink.setCellReference("B2");
|
||||
hyperlink.setLastRow(0);
|
||||
assertEquals("B1", hyperlink.getCellRef());
|
||||
assertEquals(0, hyperlink.getFirstRow());
|
||||
assertEquals(0, hyperlink.getLastRow());
|
||||
assertEquals(1, hyperlink.getFirstColumn());
|
||||
assertEquals(1, hyperlink.getLastColumn());
|
||||
hyperlink.setLastColumn(0);
|
||||
assertEquals("A1", hyperlink.getCellRef());
|
||||
assertEquals(0, hyperlink.getFirstRow());
|
||||
assertEquals(0, hyperlink.getLastRow());
|
||||
assertEquals(0, hyperlink.getFirstColumn());
|
||||
assertEquals(0, hyperlink.getLastColumn());
|
||||
hyperlink.setFirstRow(1);
|
||||
assertEquals("A2", hyperlink.getCellRef());
|
||||
assertEquals(1, hyperlink.getFirstRow());
|
||||
assertEquals(1, hyperlink.getLastRow());
|
||||
assertEquals(0, hyperlink.getFirstColumn());
|
||||
assertEquals(0, hyperlink.getLastColumn());
|
||||
hyperlink.setFirstColumn(1);
|
||||
assertEquals("B2", hyperlink.getCellRef());
|
||||
assertEquals(1, hyperlink.getFirstRow());
|
||||
assertEquals(1, hyperlink.getLastRow());
|
||||
assertEquals(1, hyperlink.getFirstColumn());
|
||||
assertEquals(1, hyperlink.getLastColumn());
|
||||
hyperlink.setLastRow(2);
|
||||
assertEquals("B2:B3", hyperlink.getCellRef());
|
||||
assertEquals(1, hyperlink.getFirstRow());
|
||||
assertEquals(2, hyperlink.getLastRow());
|
||||
assertEquals(1, hyperlink.getFirstColumn());
|
||||
assertEquals(1, hyperlink.getLastColumn());
|
||||
hyperlink.setLastColumn(2);
|
||||
assertEquals("B2:C3", hyperlink.getCellRef());
|
||||
assertEquals(1, hyperlink.getFirstRow());
|
||||
assertEquals(2, hyperlink.getLastRow());
|
||||
assertEquals(1, hyperlink.getFirstColumn());
|
||||
assertEquals(2, hyperlink.getLastColumn());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue