Skip to content

Commit ba5b725

Browse files
Run unit tests on EXE too, not just JNI
1 parent fc9d7f8 commit ba5b725

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

pdf2htmlEX/src/androidTest/java/com/viliussutkus89/android/pdf2htmlex/InstrumentedTests.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* InstrumentedTests.java
33
*
4-
* Copyright (C) 2019,2020 Vilius Sutkus'89
4+
* Copyright (C) 2019, 2020 Vilius Sutkus'89
55
*
66
* This program is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -93,15 +93,22 @@ private void copyFile(InputStream input, OutputStream output) throws IOException
9393
@Test
9494
public void testAllSuppliedPDFs() throws IOException {
9595
Context ctx = InstrumentationRegistry.getInstrumentation().getTargetContext();
96+
testAllSuppliedPDFs(new pdf2htmlEX(ctx));
97+
}
9698

97-
pdf2htmlEX pdf2htmlEX = new pdf2htmlEX(ctx);
99+
@Test
100+
public void testAllSuppliedPDFs_exe() throws IOException {
101+
Context ctx = InstrumentationRegistry.getInstrumentation().getTargetContext();
102+
testAllSuppliedPDFs(new pdf2htmlEX_exe(ctx));
103+
}
98104

105+
public void testAllSuppliedPDFs(pdf2htmlEX converter) throws IOException {
99106
for (String i: m_PDFsToTest) {
100107
File pdfFile = extractAssetPDF(i);
101108
File htmlFile;
102109

103110
try {
104-
htmlFile = pdf2htmlEX.convert(pdfFile);
111+
htmlFile = converter.convert(pdfFile);
105112
} catch (IOException | pdf2htmlEX.ConversionFailedException e) {
106113
pdfFile.delete();
107114
e.printStackTrace();
@@ -119,11 +126,21 @@ public void testAllSuppliedPDFs() throws IOException {
119126

120127
@Test
121128
public void encryptedPdfTest() throws IOException {
129+
Context ctx = InstrumentationRegistry.getInstrumentation().getTargetContext();
130+
encryptedPdfTest(new pdf2htmlEX(ctx));
131+
}
132+
133+
@Test
134+
public void encryptedPdfTest_exe() throws IOException {
135+
Context ctx = InstrumentationRegistry.getInstrumentation().getTargetContext();
136+
encryptedPdfTest(new pdf2htmlEX_exe(ctx));
137+
}
138+
139+
public void encryptedPdfTest(pdf2htmlEX converter) throws IOException {
122140
// encrypted_fontfile3_opentype.pdf was generated using:
123141
// qpdf --encrypt sample-user-password sample-owner-password 256 -- fontfile3_opentype.pdf encrypted_fontfile3_opentype.pdf
124142
File pdfFile = extractAssetPDF("encrypted_fontfile3_opentype.pdf");
125143

126-
pdf2htmlEX converter = new pdf2htmlEX(InstrumentationRegistry.getInstrumentation().getTargetContext());
127144
converter.setInputPDF(pdfFile);
128145

129146
try {

0 commit comments

Comments
 (0)