whitespace
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1763999 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d5c20ccb0d
commit
95e8c4b4a2
@ -97,68 +97,68 @@ public class TestWorkbookProtection {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldReadWorkbookProtection() throws Exception {
|
public void shouldReadWorkbookProtection() throws Exception {
|
||||||
XSSFWorkbook workbook = openSampleWorkbook("workbookProtection_not_protected.xlsx");
|
XSSFWorkbook workbook = openSampleWorkbook("workbookProtection_not_protected.xlsx");
|
||||||
assertFalse(workbook.isStructureLocked());
|
assertFalse(workbook.isStructureLocked());
|
||||||
assertFalse(workbook.isWindowsLocked());
|
assertFalse(workbook.isWindowsLocked());
|
||||||
assertFalse(workbook.isRevisionLocked());
|
assertFalse(workbook.isRevisionLocked());
|
||||||
|
|
||||||
workbook = openSampleWorkbook("workbookProtection_workbook_structure_protected.xlsx");
|
workbook = openSampleWorkbook("workbookProtection_workbook_structure_protected.xlsx");
|
||||||
assertTrue(workbook.isStructureLocked());
|
assertTrue(workbook.isStructureLocked());
|
||||||
assertFalse(workbook.isWindowsLocked());
|
assertFalse(workbook.isWindowsLocked());
|
||||||
assertFalse(workbook.isRevisionLocked());
|
assertFalse(workbook.isRevisionLocked());
|
||||||
|
|
||||||
workbook = openSampleWorkbook("workbookProtection_workbook_windows_protected.xlsx");
|
workbook = openSampleWorkbook("workbookProtection_workbook_windows_protected.xlsx");
|
||||||
assertTrue(workbook.isWindowsLocked());
|
assertTrue(workbook.isWindowsLocked());
|
||||||
assertFalse(workbook.isStructureLocked());
|
assertFalse(workbook.isStructureLocked());
|
||||||
assertFalse(workbook.isRevisionLocked());
|
assertFalse(workbook.isRevisionLocked());
|
||||||
|
|
||||||
workbook = openSampleWorkbook("workbookProtection_workbook_revision_protected.xlsx");
|
workbook = openSampleWorkbook("workbookProtection_workbook_revision_protected.xlsx");
|
||||||
assertTrue(workbook.isRevisionLocked());
|
assertTrue(workbook.isRevisionLocked());
|
||||||
assertFalse(workbook.isWindowsLocked());
|
assertFalse(workbook.isWindowsLocked());
|
||||||
assertFalse(workbook.isStructureLocked());
|
assertFalse(workbook.isStructureLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldWriteStructureLock() throws Exception {
|
public void shouldWriteStructureLock() throws Exception {
|
||||||
XSSFWorkbook workbook = openSampleWorkbook("workbookProtection_not_protected.xlsx");
|
XSSFWorkbook workbook = openSampleWorkbook("workbookProtection_not_protected.xlsx");
|
||||||
assertFalse(workbook.isStructureLocked());
|
assertFalse(workbook.isStructureLocked());
|
||||||
|
|
||||||
workbook.lockStructure();
|
workbook.lockStructure();
|
||||||
|
|
||||||
assertTrue(workbook.isStructureLocked());
|
assertTrue(workbook.isStructureLocked());
|
||||||
|
|
||||||
workbook.unLockStructure();
|
workbook.unLockStructure();
|
||||||
|
|
||||||
assertFalse(workbook.isStructureLocked());
|
assertFalse(workbook.isStructureLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldWriteWindowsLock() throws Exception {
|
public void shouldWriteWindowsLock() throws Exception {
|
||||||
XSSFWorkbook workbook = openSampleWorkbook("workbookProtection_not_protected.xlsx");
|
XSSFWorkbook workbook = openSampleWorkbook("workbookProtection_not_protected.xlsx");
|
||||||
assertFalse(workbook.isWindowsLocked());
|
assertFalse(workbook.isWindowsLocked());
|
||||||
|
|
||||||
workbook.lockWindows();
|
workbook.lockWindows();
|
||||||
|
|
||||||
assertTrue(workbook.isWindowsLocked());
|
assertTrue(workbook.isWindowsLocked());
|
||||||
|
|
||||||
workbook.unLockWindows();
|
workbook.unLockWindows();
|
||||||
|
|
||||||
assertFalse(workbook.isWindowsLocked());
|
assertFalse(workbook.isWindowsLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldWriteRevisionLock() throws Exception {
|
public void shouldWriteRevisionLock() throws Exception {
|
||||||
XSSFWorkbook workbook = openSampleWorkbook("workbookProtection_not_protected.xlsx");
|
XSSFWorkbook workbook = openSampleWorkbook("workbookProtection_not_protected.xlsx");
|
||||||
assertFalse(workbook.isRevisionLocked());
|
assertFalse(workbook.isRevisionLocked());
|
||||||
|
|
||||||
workbook.lockRevision();
|
workbook.lockRevision();
|
||||||
|
|
||||||
assertTrue(workbook.isRevisionLocked());
|
assertTrue(workbook.isRevisionLocked());
|
||||||
|
|
||||||
workbook.unLockRevision();
|
workbook.unLockRevision();
|
||||||
|
|
||||||
assertFalse(workbook.isRevisionLocked());
|
assertFalse(workbook.isRevisionLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
@Test
|
@Test
|
||||||
@ -175,19 +175,19 @@ public class TestWorkbookProtection {
|
|||||||
|
|
||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
@Test
|
@Test
|
||||||
public void testIntegration() throws Exception {
|
public void testIntegration() throws Exception {
|
||||||
XSSFWorkbook wb = new XSSFWorkbook();
|
XSSFWorkbook wb = new XSSFWorkbook();
|
||||||
wb.createSheet("Testing purpose sheet");
|
wb.createSheet("Testing purpose sheet");
|
||||||
assertFalse(wb.isRevisionLocked());
|
assertFalse(wb.isRevisionLocked());
|
||||||
|
|
||||||
wb.lockRevision();
|
wb.lockRevision();
|
||||||
wb.setRevisionsPassword("test", null);
|
wb.setRevisionsPassword("test", null);
|
||||||
|
|
||||||
wb = writeOutAndReadBack(wb);
|
wb = writeOutAndReadBack(wb);
|
||||||
|
|
||||||
assertTrue(wb.isRevisionLocked());
|
assertTrue(wb.isRevisionLocked());
|
||||||
assertTrue(wb.validateRevisionsPassword("test"));
|
assertTrue(wb.validateRevisionsPassword("test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("bug 60230: currently failing due to regression from bug 59857 r1762726")
|
@Ignore("bug 60230: currently failing due to regression from bug 59857 r1762726")
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user