-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
zss.test/src/test/java/org/zkoss/zss/api/impl/Issue500Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package org.zkoss.zss.api.impl; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import java.util.Locale; | ||
|
||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
import org.zkoss.zss.Setup; | ||
import org.zkoss.zss.Util; | ||
import org.zkoss.zss.api.Range; | ||
import org.zkoss.zss.api.Ranges; | ||
import org.zkoss.zss.api.model.Book; | ||
import org.zkoss.zss.api.model.Sheet; | ||
|
||
/** | ||
* @author Hawk | ||
* | ||
*/ | ||
public class Issue500Test { | ||
|
||
@BeforeClass | ||
public static void setUpLibrary() throws Exception { | ||
Setup.touch(); | ||
} | ||
|
||
@Before | ||
public void startUp() throws Exception { | ||
Setup.pushZssContextLocale(Locale.TAIWAN); | ||
} | ||
|
||
@After | ||
public void tearDown() throws Exception { | ||
Setup.popZssContextLocale(); | ||
} | ||
|
||
|
||
@Test | ||
public void testZSS502_2003(){ | ||
Book book = Util.loadBook(this,"book/502-crossSheetReference.xls"); | ||
Sheet sheet = book.getSheet("cell-reference"); | ||
Range referencingCell = Ranges.range(sheet, "C4"); | ||
assertEquals("=row!A1", referencingCell.getCellEditText()); | ||
assertEquals("The first row is freezed.", referencingCell.getCellFormatText()); | ||
|
||
Ranges.range(book.getSheet("row")).deleteSheet(); | ||
|
||
assertEquals("='#REF'!A1", referencingCell.getCellEditText()); | ||
//because ZSS-474 is unresolved, the assert below won't pass | ||
//assertEquals("#REF", referencingCell.getCellFormatText()); | ||
} | ||
|
||
@Test | ||
public void testZSS502_2007(){ | ||
Book book = Util.loadBook(this,"book/502-crossSheetReference.xlsx"); | ||
Sheet sheet = book.getSheet("cell-reference"); | ||
Range referencingCell = Ranges.range(sheet, "C4"); | ||
assertEquals("=row!A1", referencingCell.getCellEditText()); | ||
assertEquals("The first row is freezed.", referencingCell.getCellFormatText()); | ||
|
||
Ranges.range(book.getSheet("row")).deleteSheet(); | ||
|
||
assertEquals("=row!A1", referencingCell.getCellEditText()); | ||
//because ZSS-474 is unresolved, the assert below won't pass | ||
// assertEquals("#REF", referencingCell.getCellFormatText()); | ||
} | ||
|
||
|
||
@Test | ||
public void testZSS502_NonExistingSheet2003(){ | ||
Book book = Util.loadBook(this,"book/blank.xls"); | ||
Sheet sheet = book.getSheetAt(0); | ||
Range cell = Ranges.range(sheet, "A1"); | ||
cell.setCellEditText("=nonExisted!B1"); | ||
assertEquals("='#REF'!B1", cell.getCellEditText()); | ||
assertEquals("#REF!", cell.getCellFormatText()); | ||
} | ||
|
||
@Test | ||
public void testZSS502_NonExistingSheet2007(){ | ||
Book book = Util.loadBook(this,"book/blank.xlsx"); | ||
Sheet sheet = book.getSheetAt(0); | ||
Range cell = Ranges.range(sheet, "A1"); | ||
cell.setCellEditText("=nonExisted!B1"); | ||
assertEquals("=nonExisted!B1", cell.getCellEditText()); | ||
assertEquals("#REF!", cell.getCellFormatText()); | ||
} | ||
} |
Binary file added
BIN
+19.5 KB
zss.test/src/test/java/org/zkoss/zss/api/impl/book/502-crossSheetReference.xls
Binary file not shown.
Binary file added
BIN
+10.1 KB
zss.test/src/test/java/org/zkoss/zss/api/impl/book/502-crossSheetReference.xlsx
Binary file not shown.