}
}
}
+
+ HSSFOptimiser.optimiseFonts(wb);
}
private static final Set<String> EXPECTED_ADDITIONAL_FAILURES = new HashSet<>();
public void handleAdditional(File file) throws Exception {
// redirect stdout as the examples often write lots of text
PrintStream oldOut = System.out;
+ String fileWithParent = file.getParentFile().getName() + "/" + file.getName();
try {
System.setOut(new PrintStream(new OutputStream() {
@Override
BiffViewer.main(new String[]{file.getAbsolutePath()});
assertFalse("Expected Extraction to fail for file " + file + " and handler " + this + ", but did not fail!",
- EXPECTED_ADDITIONAL_FAILURES.contains(file.getParentFile().getName() + "/" + file.getName()));
+ EXPECTED_ADDITIONAL_FAILURES.contains(fileWithParent));
} catch (OldExcelFormatException e) {
// old excel formats are not supported here
} catch (RuntimeException e) {
- if(!EXPECTED_ADDITIONAL_FAILURES.contains(file.getParentFile().getName() + "/" + file.getName())) {
+ if(!EXPECTED_ADDITIONAL_FAILURES.contains(fileWithParent)) {
throw e;
}
} finally {
private static void confirmSize(int expectedSize, UnicodeString s) {
confirmSize(expectedSize, s, 0);
}
+
/**
* Note - a value of zero for <tt>amountUsedInCurrentRecord</tt> would only ever occur just
- * after a {@link ContinueRecord} had been started. In the initial {@link SSTRecord} this
+ * after a {@link ContinueRecord} had been started. In the initial {@link SSTRecord} this
* value starts at 8 (for the first {@link UnicodeString} written). In general, it can be
* any value between 0 and {@link #MAX_DATA_SIZE}
*/
}
@Test
- public void formatRun() throws Exception {
+ public void formatRun() {
FormatRun fr = new FormatRun((short)4, (short)0x15c);
assertEquals(4, fr.getCharacterPos());
assertEquals(0x15c, fr.getFontIndex());
}
@Test
- public void extRstFromEmpty() throws Exception {
+ public void extRstFromEmpty() {
ExtRst ext = new ExtRst();
assertEquals(0, ext.getNumberOfRuns());
assertEquals(-1, b[0]);
assertEquals(-1, b[1]);
assertEquals(14, b[2]);
- assertEquals(00, b[3]);
+ assertEquals(0, b[3]);
// Reserved
assertEquals(1, b[4]);
assertEquals(0, b[5]);
// Data size
assertEquals(10, b[6]);
- assertEquals(00, b[7]);
+ assertEquals(0, b[7]);
// Font*2
assertEquals(0, b[8]);
assertEquals(0, b[9]);
}
@Test
- public void extRstFromData() throws Exception {
+ public void extRstFromData() {
byte[] data = new byte[] {
- 01, 00, 0x0C, 00,
- 00, 00, 0x37, 00,
- 00, 00,
- 00, 00, 00, 00,
- 00, 00 // Cruft at the end, as found from real files
+ 1, 0, 0x0C, 0,
+ 0, 0, 0x37, 0,
+ 0, 0,
+ 0, 0, 0, 0,
+ 0, 0 // Cruft at the end, as found from real files
};
assertEquals(16, data.length);
}
@Test
- public void corruptExtRstDetection() throws Exception {
+ public void corruptExtRstDetection() {
byte[] data = new byte[] {
0x79, 0x79, 0x11, 0x11,
0x22, 0x22, 0x33, 0x33,
* @return a string of the specified number of characters
*/
private static UnicodeString makeUnicodeString(int numChars, boolean is16Bit) {
- StringBuilder b = new StringBuilder(numChars);
+ StringBuilder b = new StringBuilder(numChars);
int charBase = is16Bit ? 0x8A00 : 'A';
for (int i = 0; i < numChars; i++) {
char ch = (char) ((i % 16) + charBase);