Skip to content

Commit 8891373

Browse files
aar-instrumented-tester - Run unit tests on released AAR
1 parent 47c09d9 commit 8891373

28 files changed

Lines changed: 338 additions & 0 deletions

File tree

aar-instrumented-tester/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/.gradle
2+
/.idea
3+
/build
4+
/local.properties
5+
*.iml
6+
7+
/gradle
8+
/build.gradle
9+
/gradle.properties
10+
/gradlew
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
THIS_FILE=$(readlink -f "$0")
5+
BASEDIR=$(dirname "$THIS_FILE")
6+
7+
function symlinkFromMain() {
8+
if test ! -e "$BASEDIR/$1"
9+
then
10+
ln -s $BASEDIR/../$1 $BASEDIR/$1
11+
fi
12+
}
13+
14+
symlinkFromMain gradle
15+
symlinkFromMain pdf2htmlEX/src/androidTest/assets
16+
symlinkFromMain build.gradle
17+
symlinkFromMain gradle.properties
18+
symlinkFromMain gradlew
19+
20+
function copyTestFile() {
21+
SRC=$BASEDIR/../pdf2htmlEX/src/androidTest/java/com/viliussutkus89/android/pdf2htmlex/${1}.java
22+
DST=$BASEDIR/pdf2htmlEX/src/androidTest/java/com/viliussutkus89/android/tester/${1}AAR.java
23+
24+
cp $SRC $DST
25+
26+
SRC_PKGNAME="com.viliussutkus89.android.pdf2htmlex"
27+
sed -i "s/package $SRC_PKGNAME\;/package com.viliussutkus89.android.tester;\nimport $SRC_PKGNAME.pdf2htmlEX\;/g" $DST
28+
sed -i "s/public class $1/public class ${1}AAR/g" $DST
29+
}
30+
31+
copyTestFile InstrumentedTests
32+
33+
# Fontconfig tests unavailable through aar, because required jni call is unavail
34+
#copee FontconfigInstrumentedTests
35+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 29
5+
buildToolsVersion "29.0.2"
6+
defaultConfig {
7+
applicationId "com.viliussutkus89.android.pdf2htmlex.tester"
8+
minSdkVersion 16
9+
targetSdkVersion 29
10+
11+
ndk.abiFilters = project.hasProperty('abi') ? [ project.property('abi') ] : null
12+
13+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14+
}
15+
ndkVersion "20.1.5948944"
16+
}
17+
18+
dependencies {
19+
implementation 'androidx.annotation:annotation:1.1.0'
20+
21+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
22+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
23+
24+
// Either depend on local .aar (and all it's dependencies)
25+
// files('libs/pdf2htmlex-android-release.aar')
26+
// implementation 'com.viliussutkus89:tmpfile-android:1.0.2'
27+
28+
// Or a released version in Bintray
29+
implementation 'com.viliussutkus89:pdf2htmlex-android:0.18.3'
30+
}
31+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.aar
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/assets
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*AAR.java
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.viliussutkus89.android.pdf2htmlex.sampleapp">
4+
<application
5+
android:allowBackup="true"
6+
android:icon="@mipmap/ic_launcher"
7+
android:label="@string/app_name"
8+
android:roundIcon="@mipmap/ic_launcher_round"
9+
android:supportsRtl="true">
10+
</application>
11+
</manifest>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.viliussutkus89.android.pdf2htmlex.tester;
2+
3+
import android.app.Activity;
4+
5+
public class MainActivity extends Activity {
6+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportWidth="108"
6+
android:viewportHeight="108">
7+
<path
8+
android:fillType="evenOdd"
9+
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
10+
android:strokeWidth="1"
11+
android:strokeColor="#00000000">
12+
<aapt:attr name="android:fillColor">
13+
<gradient
14+
android:endX="78.5885"
15+
android:endY="90.9159"
16+
android:startX="48.7653"
17+
android:startY="61.0927"
18+
android:type="linear">
19+
<item
20+
android:color="#44000000"
21+
android:offset="0.0" />
22+
<item
23+
android:color="#00000000"
24+
android:offset="1.0" />
25+
</gradient>
26+
</aapt:attr>
27+
</path>
28+
<path
29+
android:fillColor="#FFFFFF"
30+
android:fillType="nonZero"
31+
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
32+
android:strokeWidth="1"
33+
android:strokeColor="#00000000" />
34+
</vector>

0 commit comments

Comments
 (0)