Add Android Library Test
This commit is contained in:
parent
5a7c31e8f3
commit
31c26d60eb
|
@ -81,7 +81,7 @@ dependencies {
|
|||
|
||||
implementation project(path: ':services:news:shatteredNews')
|
||||
|
||||
// implementation project(path: ':services:analytics:analyticsFirebase')
|
||||
implementation project(path: ':services:analyticsfirebase')
|
||||
|
||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
|
||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:label="${appName}"
|
||||
android:exported="true"
|
||||
android:name=".AndroidGame"
|
||||
android:screenOrientation="nosensor"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize">
|
||||
|
|
|
@ -23,9 +23,9 @@ allprojects {
|
|||
|
||||
appJavaCompatibility = JavaVersion.VERSION_11
|
||||
|
||||
appAndroidCompileSDK = 30
|
||||
appAndroidCompileSDK = 33
|
||||
appAndroidMinSDK = 19
|
||||
appAndroidTargetSDK = 30
|
||||
appAndroidTargetSDK = 33
|
||||
|
||||
gdxControllersVersion = '2.2.1'
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.services.analyticsfirebase;
|
||||
|
||||
public class Beta {
|
||||
public static FireBaseService service;
|
||||
}
|
1
services/analyticsfirebase/.gitignore
vendored
Normal file
1
services/analyticsfirebase/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
37
services/analyticsfirebase/build.gradle
Normal file
37
services/analyticsfirebase/build.gradle
Normal file
|
@ -0,0 +1,37 @@
|
|||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.shatteredpixel.shatteredpixeldungeon.services.analyticsfirebase'
|
||||
compileSdk 33
|
||||
|
||||
defaultConfig {
|
||||
minSdk 19
|
||||
targetSdk 33
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':SPD-classes')
|
||||
api project(':services')
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'com.google.android.material:material:1.5.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
}
|
0
services/analyticsfirebase/consumer-rules.pro
Normal file
0
services/analyticsfirebase/consumer-rules.pro
Normal file
21
services/analyticsfirebase/proguard-rules.pro
vendored
Normal file
21
services/analyticsfirebase/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
|
@ -0,0 +1,26 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.services.analyticsfirebase;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.shatteredpixel.shatteredpixeldungeon.services.analyticsfirebase.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
4
services/analyticsfirebase/src/main/AndroidManifest.xml
Normal file
4
services/analyticsfirebase/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,4 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.services.analyticsfirebase;
|
||||
|
||||
public class FireBaseLing {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.services.analyticsfirebase;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,7 @@
|
|||
apply plugin: 'java-library'
|
||||
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
sourceCompatibility = targetCompatibility = appJavaCompatibility
|
||||
sourceCompatibility = targetCompatibility = appJavaCompatibility
|
||||
dependencies {
|
||||
implementation project(path: ':services:analyticsfirebase')
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.services.analyticsfirebase;
|
||||
public class FireBaseService {
|
||||
}
|
|
@ -11,3 +11,4 @@ include ':services'
|
|||
|
||||
//news
|
||||
include ':services:news:shatteredNews'
|
||||
include ':services:analyticsfirebase'
|
||||
|
|
Loading…
Reference in New Issue
Block a user