From 60185c934a577692a70dda3dd161c4d0b7bc83bd Mon Sep 17 00:00:00 2001 From: DjBushido Date: Sat, 5 Jul 2014 15:59:34 -0400 Subject: [PATCH] Test cases pass now with the navbar --- .travis.yml | 1 - app/build.gradle | 1 - .../bspeice/minimalbible/DownloadActivityTest.java | 14 ++++++-------- .../org/bspeice/minimalbible/DownloadActivity.java | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a75c22..dd37e02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ env: - ANDROID_SDKS=android-19,sysimg-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a before_install: - - echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI - emulator -avd test -no-skin -no-audio -no-window & diff --git a/app/build.gradle b/app/build.gradle index de65d31..300ff19 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -48,7 +48,6 @@ android { } dependencies { - compile 'com.squareup.dagger:dagger:1.2.1' provided 'com.squareup.dagger:dagger-compiler:1.2.1' diff --git a/app/src/androidTest/java/org/bspeice/minimalbible/DownloadActivityTest.java b/app/src/androidTest/java/org/bspeice/minimalbible/DownloadActivityTest.java index c0e123a..ad245a3 100644 --- a/app/src/androidTest/java/org/bspeice/minimalbible/DownloadActivityTest.java +++ b/app/src/androidTest/java/org/bspeice/minimalbible/DownloadActivityTest.java @@ -1,26 +1,24 @@ package org.bspeice.minimalbible; import android.content.Intent; +import android.test.ActivityInstrumentationTestCase2; import android.test.ActivityUnitTestCase; import android.util.Log; /** * Created by Bradlee Speice on 7/5/2014. */ -public class DownloadActivityTest extends ActivityUnitTestCase { +/* Please note that it is necessary to extend the ActivityInstrumentationTestCase2 if you plan + on using an activity that sets up any underlying fragments (includes navigation drawers). + The ActivityUnitTestCase doesn't set up enough of the Activity lifecycle. + */ +public class DownloadActivityTest extends ActivityInstrumentationTestCase2 { public DownloadActivityTest() { super(DownloadActivity.class); } public void testAndroidTestInjection() { - MinimalBible m = new MinimalBible(); - m.buildObjGraph(); - setApplication(m); - - startActivity(new Intent(getInstrumentation().getTargetContext(), - DownloadActivity.class), null, null); - DownloadActivity a = getActivity(); assertNotNull(a); diff --git a/app/src/main/java/org/bspeice/minimalbible/DownloadActivity.java b/app/src/main/java/org/bspeice/minimalbible/DownloadActivity.java index 2f7a754..f047bd8 100644 --- a/app/src/main/java/org/bspeice/minimalbible/DownloadActivity.java +++ b/app/src/main/java/org/bspeice/minimalbible/DownloadActivity.java @@ -4,6 +4,7 @@ import android.app.Activity; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; +import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.util.Log; @@ -45,12 +46,11 @@ public class DownloadActivity extends ActionBarActivity mTitle = getTitle(); Log.w("DownloadActivity", "Title: " + mTitle.toString()); - /* // Set up the drawer. mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); - */ + } @Override