-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Thomas Taschauer
committed
Nov 15, 2020
1 parent
8ae53c6
commit e54f830
Showing
7 changed files
with
103 additions
and
16 deletions.
There are no files selected for viewing
Submodule OpenDocument.core
updated
from 43a196 to 1c30b9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
app/src/androidTest/java/at/tomtasche/reader/test/CoreTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package at.tomtasche.reader.test; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.net.URL; | ||
|
||
import androidx.test.InstrumentationRegistry; | ||
import androidx.test.core.app.ApplicationProvider; | ||
import androidx.test.filters.LargeTest; | ||
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner; | ||
import at.tomtasche.reader.background.CoreWrapper; | ||
|
||
@LargeTest | ||
@RunWith(AndroidJUnit4ClassRunner.class) | ||
public class CoreTest { | ||
|
||
private String testFilePath; | ||
|
||
@Before | ||
public void setup() { | ||
// TODO: fix for Android 29+ | ||
|
||
try { | ||
File file = new File(ApplicationProvider.getApplicationContext().getCacheDir(), "test.odt"); | ||
testFilePath = file.getAbsolutePath(); | ||
|
||
if (file.exists()) { | ||
return; | ||
} | ||
|
||
InputStream inputStream = new URL("https://api.libreoffice.org/examples/cpp/DocumentLoader/test.odt").openStream(); | ||
copy(inputStream, file); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
|
||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
private static void copy(InputStream src, File dst) throws IOException { | ||
try (OutputStream out = new FileOutputStream(dst)) { | ||
byte[] buf = new byte[1024]; | ||
int len; | ||
while ((len = src.read(buf)) > 0) { | ||
out.write(buf, 0, len); | ||
} | ||
} finally { | ||
src.close(); | ||
} | ||
} | ||
|
||
@Test | ||
public void test() { | ||
CoreWrapper core = new CoreWrapper(); | ||
core.initialize(); | ||
|
||
File htmlFile = new File(ApplicationProvider.getApplicationContext().getCacheDir(),"html"); | ||
|
||
CoreWrapper.CoreOptions coreOptions = new CoreWrapper.CoreOptions(); | ||
coreOptions.inputPath = testFilePath; | ||
coreOptions.outputPath = htmlFile.getPath(); | ||
coreOptions.editable = true; | ||
|
||
CoreWrapper.CoreResult coreResult = core.parse(coreOptions); | ||
Assert.assertEquals(0, coreResult.errorCode); | ||
|
||
File resultFile = new File(ApplicationProvider.getApplicationContext().getCacheDir(),"result"); | ||
coreOptions.outputPath = resultFile.getPath(); | ||
|
||
String htmlDiff = "{\"modifiedText\":{\"3\":\"This is a simple test document to demonstrate the DocumentLoadewwwwr example!\"}}"; | ||
|
||
CoreWrapper.CoreResult result = core.backtranslate(coreOptions, htmlDiff); | ||
Assert.assertEquals(0, coreResult.errorCode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/bin/bash | ||
|
||
./gradlew app:uploadCrashlyticsSymbolFileRelease | ||
./gradlew app:uploadCrashlyticsSymbolFileLiteRelease | ||
./gradlew app:uploadCrashlyticsSymbolFileProRelease |