[render-test] Wrap test data inside RenderTestRunner App + Add a new test app (#15887)
* [render-test] Wrap test resources inside app * [render-test] Add test app * fix test app failure * [render-test]add callback + add javaObjectWrapper
This commit is contained in:
@@ -1,9 +1,3 @@
|
||||
# RenderTestRunner
|
||||
|
||||
This app is a purely native application, with no Java source code, that can run **mbgl-render-test-runner** on android devices.
|
||||
|
||||
|
||||
## Setup the test environment
|
||||
- Run render_test_setup.sh so that all the necessary test resources are pushed to the device.
|
||||
|
||||
- Switch on storage permission of the app so that it can read/write data on SD card.
|
||||
This app is a purely native application, with no Java source code, that can run **mbgl-render-test-runner** on android devices.
|
||||
@@ -14,6 +14,7 @@ android {
|
||||
targets 'mbgl-render-test-runner'
|
||||
}
|
||||
}
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
@@ -26,4 +27,7 @@ android {
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-beta01'
|
||||
androidTestImplementation 'androidx.test:rules:1.2.0-beta01'
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package android.app;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import android.util.Log;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class NativeActivityTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<NativeActivity> mActivityTestRule = new ActivityTestRule<>(NativeActivity.class, false, false);
|
||||
|
||||
@Test(timeout = 1200000L)
|
||||
public void runRenderTests() throws Exception {
|
||||
Log.v("Test", "Start the test");
|
||||
mActivityTestRule.launchActivity(null);
|
||||
while (TestState.running) {
|
||||
Log.v("Test", "Test is running");
|
||||
Thread.sleep(1000L);
|
||||
}
|
||||
Log.v("Test", "End the test");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package android.app;
|
||||
|
||||
public class TestState {
|
||||
static boolean running = true;
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
android:fullBackupContent="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:hasCode="false">
|
||||
android:hasCode="true">
|
||||
|
||||
<activity android:name="android.app.NativeActivity"
|
||||
android:label="@string/app_name"
|
||||
|
||||
15
render-test/android/app/src/main/assets/to_zip.txt
Normal file
15
render-test/android/app/src/main/assets/to_zip.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
mapbox-gl-js/test/integration/data/
|
||||
mapbox-gl-js/test/integration/video/
|
||||
mapbox-gl-js/test/integration/tilesets/
|
||||
mapbox-gl-js/test/integration/tiles/
|
||||
mapbox-gl-js/test/integration/styles/
|
||||
mapbox-gl-js/test/integration/render-tests/
|
||||
mapbox-gl-js/test/integration/query-tests/
|
||||
mapbox-gl-js/test/integration/image/
|
||||
mapbox-gl-js/test/integration/glyphs/
|
||||
mapbox-gl-js/test/integration/geojson/
|
||||
mapbox-gl-js/test/integration/sprites/
|
||||
vendor/mapbox-gl-styles/styles/
|
||||
vendor/mapbox-gl-styles/sprites/
|
||||
ignores/
|
||||
android-manifest.json
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
adb shell rm -rf /sdcard/render-test
|
||||
adb shell mkdir /sdcard/render-test
|
||||
adb shell mkdir /sdcard/render-test/vendor
|
||||
adb shell mkdir /sdcard/render-test/ignores
|
||||
adb shell mkdir /sdcard/render-test/render-test/tests
|
||||
|
||||
# push test sources
|
||||
adb push ../../mapbox-gl-js/test/integration/render-tests /sdcard/render-test/mapbox-gl-js/test/integration/render-tests
|
||||
adb push ../../mapbox-gl-js/test/integration/query-tests /sdcard/render-test/mapbox-gl-js/test/integration/query-tests
|
||||
adb push ../../mapbox-gl-js/test/integration/tiles /sdcard/render-test/mapbox-gl-js/test/integration/tiles
|
||||
adb push ../../mapbox-gl-js/test/integration/glyphs /sdcard/render-test/mapbox-gl-js/test/integration/glyphs
|
||||
adb push ../../mapbox-gl-js/test/integration/styles /sdcard/render-test/mapbox-gl-js/test/integration/styles
|
||||
adb push ../../mapbox-gl-js/test/integration/tilesets /sdcard/render-test/mapbox-gl-js/test/integration/tilesets
|
||||
adb push ../../mapbox-gl-js/test/integration/image /sdcard/render-test/mapbox-gl-js/test/integration/image
|
||||
adb push ../../mapbox-gl-js/test/integration/video /sdcard/render-test/mapbox-gl-js/test/integration/video
|
||||
adb push ../../vendor/mapbox-gl-styles/styles /sdcard/render-test/vendor/mapbox-gl-styles/styles
|
||||
adb push ../../vendor/mapbox-gl-styles/sprites /sdcard/render-test/vendor/mapbox-gl-styles/sprites
|
||||
adb push ../../mapbox-gl-js/test/integration/data /sdcard/render-test/mapbox-gl-js/test/integration/data
|
||||
adb push ../../mapbox-gl-js/test/integration/geojson /sdcard/render-test/mapbox-gl-js/test/integration/geojson
|
||||
mkdir sprites
|
||||
cp -r ../../mapbox-gl-js/test/integration/sprites/ sprites
|
||||
adb push sprites /sdcard/render-test/mapbox-gl-js/test/integration/sprites
|
||||
rm -rf sprites
|
||||
|
||||
# push extra expectations
|
||||
adb push ../../render-test/expected/render-tests /sdcard/render-test/render-test/expected/render-tests
|
||||
|
||||
# push default ignore lists
|
||||
adb shell mkdir /sdcard/render-test/platform
|
||||
adb shell mkdir /sdcard/render-test/platform/node
|
||||
adb shell mkdir /sdcard/render-test/platform/node/test
|
||||
adb push ../../platform/node/test/ignores.json /sdcard/render-test/platform/node/test
|
||||
adb shell mkdir /sdcard/render-test/render-test
|
||||
adb push ../linux-ignores.json /sdcard/render-test/render-test
|
||||
adb push ../tests/should-fail.json /sdcard/render-test/render-test/tests
|
||||
|
||||
# push manifest
|
||||
adb push ../android-manifest.json /sdcard/render-test
|
||||
|
||||
adb shell ls /sdcard/render-test/
|
||||
Reference in New Issue
Block a user