Skip to content

Commit

Permalink
Add "check if no crash" test for noGraphicsMode. assert graphics mode…
Browse files Browse the repository at this point in the history
… output bigger than no graphcis
  • Loading branch information
ViliusSutkus89 committed Jan 15, 2020
1 parent 5271d7a commit fe5a052
Showing 1 changed file with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.junit.runner.RunWith;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -77,4 +76,44 @@ public void testAllSuppliedDOCs() {
}
}

@Test
public void testAllSuppliedDOCsInNoGraphicsMode() {
wvWare converter = new wvWare(InstrumentationRegistry.getInstrumentation().getTargetContext())
.setNoGraphicsMode();

for (String i: m_DOCsToTest) {
File docFile = extractAssetDOC(i);
converter.setInputDOC(docFile);
try {
File htmlFile = converter.convertToHTML();
assertTrue("Converted HTML file not found! " + i, htmlFile.exists());
assertTrue("Converted HTML file empty! " + i, htmlFile.length() > 0);
htmlFile.delete();
} catch (wvWare.ConversionFailedException | IOException e) {
e.printStackTrace();
fail("Failed to convert DOC to HTML: " + i);
} finally {
docFile.delete();
}
}
}

@Test
public void HtmlFileLargerWithImageEmbedded() {
wvWare converter = new wvWare(InstrumentationRegistry.getInstrumentation().getTargetContext());

File docFile = extractAssetDOC("sample.doc");
converter.setInputDOC(docFile);
try {
File html = converter.convertToHTML();
File htmlNoGraphics = converter.setNoGraphicsMode().convertToHTML();
assertTrue(html.length() > htmlNoGraphics.length());
} catch (wvWare.ConversionFailedException | IOException e) {
e.printStackTrace();
fail();
} finally {
docFile.delete();
}
}

}

0 comments on commit fe5a052

Please sign in to comment.