mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-12-22 14:48:23 -05:00
Properly rename defaultBookName to Initials
This commit is contained in:
parent
fad6e30077
commit
d79f898bce
@ -1,58 +0,0 @@
|
||||
package org.bspeice.minimalbible.test.format.osisparser;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import org.bspeice.minimalbible.service.format.osisparser.OsisParser;
|
||||
import org.crosswire.jsword.book.OSISUtil;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* State machine testing, oh boy!
|
||||
*/
|
||||
public class OsisParserTest {
|
||||
|
||||
OsisParser parser;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
parser = new OsisParser();
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testDoWriteEnabledVerse() {
|
||||
Attributes attributes = mock(Attributes.class);
|
||||
parser.startElement("", OSISUtil.OSIS_ELEMENT_VERSE, "", attributes);
|
||||
assertTrue(parser.getDoWrite().peek());
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void parserAssert(OsisParser parser, String element) {
|
||||
Attributes attributes = mock(Attributes.class);
|
||||
parser.startElement("", element, "", attributes);
|
||||
assertFalse(parser.getDoWrite().isEmpty());
|
||||
parser.getDoWrite().pop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoWriteAlwaysAdded() {
|
||||
parserAssert(parser, OSISUtil.OSIS_ELEMENT_VERSE);
|
||||
parserAssert(parser, "");
|
||||
parserAssert(parser, "random string");
|
||||
parserAssert(parser, OSISUtil.OSIS_ELEMENT_CELL);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testEndElementPopsQueue() {
|
||||
parser.getDoWrite().add(true);
|
||||
parser.endElement("", "", "");
|
||||
assertTrue(parser.getDoWrite().isEmpty());
|
||||
}
|
||||
}
|
@ -78,7 +78,7 @@ public class BibleViewerModules {
|
||||
})
|
||||
.toBlocking().first();
|
||||
|
||||
prefs.defaultBookName(fallback.getName());
|
||||
prefs.defaultBookInitials(fallback.getName());
|
||||
return fallback;
|
||||
} catch (NoSuchElementException e) {
|
||||
// If no books are installed, there's really nothing we can do...
|
||||
|
@ -15,5 +15,6 @@ public interface BibleViewerPreferences {
|
||||
|
||||
@Default(ofInt = 14)
|
||||
int baseTextSize();
|
||||
|
||||
void baseTextSize(int baseTextSize);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user