mirror of
https://github.com/MinimalBible/MinimalBible
synced 2025-07-07 00:34:42 -04:00
@ -1,66 +0,0 @@
|
||||
package org.bspeice.minimalbible;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.acra.ReportingInteractionMode;
|
||||
import org.acra.annotation.ReportsCrashes;
|
||||
import org.crosswire.jsword.book.sword.SwordBookPath;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import dagger.ObjectGraph;
|
||||
|
||||
/**
|
||||
* Created by bspeice on 9/12/14.
|
||||
*/
|
||||
@ReportsCrashes(formKey = "",
|
||||
mailTo = "bspeice.nc@gmail.com",
|
||||
mode = ReportingInteractionMode.SILENT
|
||||
)
|
||||
@SuppressWarnings("unused")
|
||||
public class MinimalBibleTest extends MinimalBible implements Injector {
|
||||
private String TAG = "MinimalBible";
|
||||
private ObjectGraph mObjectGraph;
|
||||
|
||||
public static MinimalBibleTest get(Context ctx) {
|
||||
return (MinimalBibleTest) ctx.getApplicationContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
buildObjGraph();
|
||||
setJswordHome();
|
||||
ACRA.init(this);
|
||||
}
|
||||
|
||||
public void buildObjGraph() {
|
||||
mObjectGraph = ObjectGraph.create(Modules.list(this));
|
||||
}
|
||||
|
||||
public void inject(Object o) {
|
||||
mObjectGraph.inject(o);
|
||||
}
|
||||
|
||||
public ObjectGraph plus(Object... modules) {
|
||||
return mObjectGraph.plus(modules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify jSword that it needs to store files in the Android internal directory
|
||||
* NOTE: Android will uninstall these files if you uninstall MinimalBible.
|
||||
*/
|
||||
@SuppressWarnings("null")
|
||||
private void setJswordHome() {
|
||||
// We need to set the download directory for jSword to stick with
|
||||
// Android.
|
||||
String home = this.getFilesDir().toString();
|
||||
Log.d(TAG, "Setting jsword.home to: " + home);
|
||||
System.setProperty("jsword.home", home);
|
||||
System.setProperty("sword.home", home);
|
||||
SwordBookPath.setDownloadDir(new File(home));
|
||||
Log.d(TAG, "Sword download path: " + SwordBookPath.getSwordDownloadDir());
|
||||
}
|
||||
}
|
@ -2,7 +2,17 @@ package org.bspeice.minimalbible.test.activity.viewer;
|
||||
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
|
||||
import org.bspeice.minimalbible.Modules;
|
||||
import org.bspeice.minimalbible.activity.viewer.BibleViewer;
|
||||
import org.bspeice.minimalbible.service.manager.BookManager;
|
||||
import org.crosswire.jsword.book.Book;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import rx.Observable;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class BibleViewerTest extends ActivityInstrumentationTestCase2<BibleViewer> {
|
||||
|
||||
@ -19,10 +29,7 @@ public class BibleViewerTest extends ActivityInstrumentationTestCase2<BibleViewe
|
||||
/**
|
||||
* It may happen to be the case that we start and there are no installed books.
|
||||
* This likely triggers a runtime exception from Rx, and is no excuse for dying.
|
||||
*
|
||||
* Test disabled until I can get some refactoring done
|
||||
*/
|
||||
/*
|
||||
public void testInitializationNoInstalledBooks() {
|
||||
BookManager mockBookManager = mock(BookManager.class);
|
||||
when(mockBookManager.getInstalledBooks()).thenReturn(
|
||||
@ -31,5 +38,5 @@ public class BibleViewerTest extends ActivityInstrumentationTestCase2<BibleViewe
|
||||
|
||||
assertNotNull(getActivity());
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
Reference in New Issue
Block a user