Skip to content

Commit ee94685

Browse files
Move test files to root/test/testPDFs
1 parent d888d6a commit ee94685

15 files changed

Lines changed: 11 additions & 6 deletions

pdf2htmlEX/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ android {
6969
}
7070
ndkVersion '26.3.11579264'
7171
sourceSets.main.assets.srcDirs += "build/assets"
72+
sourceSets.androidTest.assets.srcDirs = [ getProject().parent.getLayout().getProjectDirectory().dir("test/androidTestAssets") ]
7273
}
7374

7475
// Assets delivered by conan are gathered by CMake

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* ConversionTests.java
33
*
4-
* Copyright (C) 2019, 2020, 2022 ViliusSutkus89.com
4+
* Copyright (C) 2019, 2020, 2022, 2024 ViliusSutkus89.com
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
@@ -71,8 +71,12 @@ public static List<File> listPDFs() throws IOException {
7171
Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
7272
File extractedToDir = new File(instrumentation.getTargetContext().getCacheDir(), "testPDFs");
7373
List<File> testFiles = new ArrayList<>();
74-
for (String testFilename : instrumentation.getContext().getAssets().list("testPDFs")) {
75-
testFiles.add(new File(extractedToDir, testFilename));
74+
String[] assetFiles = instrumentation.getContext().getAssets().list("testPDFs");
75+
if (assetFiles != null) {
76+
for (String assetFile : assetFiles) {
77+
if (!assetFile.equals("encrypted_fontfile3_opentype.pdf"))
78+
testFiles.add(new File(extractedToDir, assetFile));
79+
}
7680
}
7781
return testFiles;
7882
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* EncryptedPdfTests.java
33
*
4-
* Copyright (C) 2019, 2020, 2022 ViliusSutkus89.com
4+
* Copyright (C) 2019, 2020, 2022, 2024 ViliusSutkus89.com
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
@@ -57,14 +57,14 @@ public static void extractPDF() {
5757
Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
5858
new AssetExtractor(instrumentation.getContext().getAssets())
5959
.setNoOverwrite()
60-
.extract(instrumentation.getTargetContext().getCacheDir(), "encrypted_fontfile3_opentype.pdf");
60+
.extract(instrumentation.getTargetContext().getCacheDir(), "testPDFs/encrypted_fontfile3_opentype.pdf");
6161
}
6262

6363
private final Context ctx = InstrumentationRegistry.getInstrumentation().getTargetContext();
6464

6565
// encrypted_fontfile3_opentype.pdf was generated using:
6666
// qpdf --encrypt sample-user-password sample-owner-password 256 -- fontfile3_opentype.pdf encrypted_fontfile3_opentype.pdf
67-
private final File pdfFile = new File(ctx.getCacheDir(), "encrypted_fontfile3_opentype.pdf");
67+
private final File pdfFile = new File(ctx.getCacheDir(), "testPDFs/encrypted_fontfile3_opentype.pdf");
6868

6969
private final pdf2htmlEX converter = new pdf2htmlEX(ctx).setInputPDF(pdfFile);
7070

File renamed without changes.

pdf2htmlEX/src/androidTest/assets/encrypted_fontfile3_opentype.pdf renamed to test/androidTestAssets/testPDFs/encrypted_fontfile3_opentype.pdf

File renamed without changes.

pdf2htmlEX/src/androidTest/assets/testPDFs/fontfile3_opentype.pdf renamed to test/androidTestAssets/testPDFs/fontfile3_opentype.pdf

File renamed without changes.
File renamed without changes.

pdf2htmlEX/src/androidTest/assets/testPDFs/invalid_unicode_issue477.pdf renamed to test/androidTestAssets/testPDFs/invalid_unicode_issue477.pdf

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)