Skip to content

Commit

Permalink
Merge pull request #47 from spyhunter99/master
Browse files Browse the repository at this point in the history
#36 basic android connectedCheck tests
  • Loading branch information
Michael Spinelli authored Oct 27, 2016
2 parents ec54bcd + 72046bc commit 8e48c4a
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 11 deletions.
83 changes: 83 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
language: android
jdk: oraclejdk7
android:
components:
# The BuildTools version used by your project
- tools
- platform-tools
- build-tools-23.0.2 # 23.0.2 was not available on build
- build-tools-23.0.1
- build-tools-23.0.3
- build-tools-19.1.0
# The SDK version used to compile your project
- android-23
- android-22
- android-21
- android-19
- android-18
- android-15
- android-10
- android-8
- addon-google_apis-google-10
- addon-google_apis-google-15
- addon-google_apis-google-18
- addon-google_apis-google-19
- addon-google_apis-google-21
- addon-google_apis-google-22
- addon-google_apis-google-23
- addon-google_apis-google-8

# Additional components
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-19
- sys-img-armeabi-android-8
- sys-img-armeabi-android-10
- sys-img-armeabi-android-15
- sys-img-armeabi-android-19
- sys-img-armeabi-android-21
- sys-img-x86-android-22
- sys-img-x86-android-23
- addon-google_apis-google-23

sudo: required

# fun fact, travis doesn't really support multiple AVDs running currently for a single build (tried it, build timed out constantly while starting up the AVDs)
# thus we're using a build matrix (which makes more sense anyhow)
env:
global:
#minutes (2 minutes by default), prevents CommandShellUnresponsiveExceptions
- ADB_INSTALL_TIMEOUT=14

matrix:
#note when changing these, updating the gradle build file for the GoogleWrapper project
# first env var is just for display purposes
#api15 with google
- API=15g ANDROID_TARGET=14 ANDROID_ABI=armeabi-v7a

before_install:
# create and start emulators
- android list targets
- echo no | android create avd --force -n test$ANDROID_TARGET -t $ANDROID_TARGET --abi $ANDROID_ABI --sdcard 200M
- emulator -memory 1536 -avd test$ANDROID_TARGET -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &

# mvn sdk deploy
before_script:

- android-wait-for-emulator
- adb shell input keyevent 82 &

#build
script:
- ./gradlew -version
- ./gradlew connectedCheck
# FIXME one day add in -Pprofile=ci to the above line
# removed for now because travis will abort the build because the logout is too high

after_failure:
# run this on failure
# dumps the log then exits
- adb logcat -d
7 changes: 7 additions & 0 deletions RendererTester/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ apply from: "$rootDir/gradle/android-support.gradle"
android {
defaultConfig {
applicationId "armyc2.c2sd.renderer.test1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}

dependencies {
compile "com.android.support:support-v4:${project.property('android-support.version')}"
compile "com.android.support:support-annotations:${project.property('android-support.version')}"
compile project(':Renderer')

//on device testing
androidTestCompile 'com.android.support:support-annotations:23+'
androidTestCompile 'com.android.support.test:runner:0.4.+'
androidTestCompile 'com.android.support.test:rules:0.4.+'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package armyc2.c2sd.renderer.test1;

import android.test.ActivityInstrumentationTestCase2;


public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {

public MainActivityTest() {
super(MainActivity.class);
}

public void testActivity() {
MainActivity activity = getActivity();
assertNotNull(activity);
}

public void testDraw(){
final MainActivity activity = getActivity();
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.findViewById(R.id.btnDraw).performClick();
}
});

}
}

7 changes: 7 additions & 0 deletions TestAndroidRenderer3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ android {

defaultConfig {
applicationId "armyc2.c2sd.renderer.test3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}

dependencies {
compile "com.android.support:support-v4:${project.property('android-support.version')}"
compile "com.android.support:support-annotations:${project.property('android-support.version')}"
compile project(':Renderer')

//on device testing
androidTestCompile 'com.android.support:support-annotations:23+'
androidTestCompile 'com.android.support.test:runner:0.4.+'
androidTestCompile 'com.android.support.test:rules:0.4.+'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package armyc2.c2sd.renderer.test3;

import android.test.ActivityInstrumentationTestCase2;

import armyc2.c2sd.renderer.test3.MainActivity;
import armyc2.c2sd.renderer.test3.R;


public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {

public MainActivityTest() {
super(MainActivity.class);
}

public void testActivity() {
MainActivity activity = getActivity();
assertNotNull(activity);
}

}

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ org.gradle.jvmargs=-Xms256m -Xmx1024m -XX:MaxPermSize=256m


android-plugin.version=2.1.0
android-support.version=23.3.0
android-support.version=23.+
commons-lang3.version=3.4
commons-io.version=2.5
commons-cli.version=1.3
Expand Down
7 changes: 7 additions & 0 deletions mapfragment-demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ android {

defaultConfig {
applicationId "armyc2.c2sd.renderer.test2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}

dependencies {
compile "com.android.support:support-v4:${project.property('android-support.version')}"
compile "com.android.support:support-annotations:${project.property('android-support.version')}"
compile project(':Renderer')
compile 'com.google.android.gms:play-services:6.5.87'

//on device testing
androidTestCompile "com.android.support:support-annotations:${project.property('android-support.version')}"
androidTestCompile 'com.android.support.test:runner:0.4.+'
androidTestCompile 'com.android.support.test:rules:0.4.+'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package armyc2.c2sd.renderer.test2;

import android.test.ActivityInstrumentationTestCase2;


public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {

public MainActivityTest() {
super(MainActivity.class);
}

public void testActivity() {
MainActivity activity = getActivity();
assertNotNull(activity);
}

}

Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package armyc2.c2sd.renderer.test2;

import android.app.Activity;
import android.os.Bundle;
//import com.google.android.gms.location.LocationClient;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.CameraPosition;
import android.widget.EditText;
import android.app.FragmentManager;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Menu;
import armyc2.c2sd.renderer.MilStdIconRenderer;
import armyc2.c2sd.renderer.utilities.RendererSettings;
import android.widget.EditText;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;

import java.util.Locale;
import armyc2.c2sd.renderer.test2.R;

import armyc2.c2sd.renderer.MilStdIconRenderer;
import armyc2.c2sd.renderer.utilities.RendererSettings;

public class MainActivity extends Activity {

private MapFragment mapFragment;
private GoogleMap map;
//private LocationClient mLocationClient;
private EditText editText;
private MyView myView = null;
MilStdIconRenderer mir = null;
Expand Down

0 comments on commit 8e48c4a

Please sign in to comment.