The termux plugins should use this library instead of hardcoding "com.termux" values in their source code. The library can be included as a dependency by plugins and third party apps by including the following line in the build.gradle where x.xxx is the version number, once its published. `implementation 'com.termux:termux-shared:x.xxx'` The `TermuxConstants` class has been updated to `v0.17.0`, `TermuxPreferenceConstants` to `v0.9.0` and `TermuxPropertyConstants` to `v0.6.0`. Check their Changelog sections for info on changes. Some typos and redundant code has also been fixed.
27 lines
754 B
Java
27 lines
754 B
Java
package com.termux.shared;
|
|
|
|
import android.content.Context;
|
|
|
|
import androidx.test.platform.app.InstrumentationRegistry;
|
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
/**
|
|
* 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.termux.shared.test", appContext.getPackageName());
|
|
}
|
|
}
|