public void Hyphen_IncludesZeroWidthSpace() { var location = VerseHelper.Find("Genesis", 33, 20); var verse = Bible.FormattedVerse(location.AbsoluteVerseNumber); Assert.Equal(" And he erected there an altar, and called it Elelohe-\u200BIsrael.", verse.Text); }
public void History_ThreeItems_JumpInMiddle() { var app = new StubbedApp(); var verse1 = VerseHelper.Find("Luke", 3, 13).AbsoluteVerseNumber; var verse2 = VerseHelper.Find("Psalms", 23).AbsoluteVerseNumber; app.Recreate(verse1); app.StubHistoryControls.RaiseBackClick(); app.Recreate(verse2); Assert.True(app.StubHistoryControls.BackEnabled); Assert.True(app.StubHistoryControls.ForwardEnabled); Assert.Equal(verse2, app.StubVerseView.CurrentAbsoluteVerseNumber); app.StubHistoryControls.RaiseBackClick(); Assert.False(app.StubHistoryControls.BackEnabled); Assert.True(app.StubHistoryControls.ForwardEnabled); Assert.Equal(Bible.John_1_1, app.StubVerseView.CurrentAbsoluteVerseNumber); app.StubHistoryControls.RaiseForwardClick(); Assert.True(app.StubHistoryControls.BackEnabled); Assert.True(app.StubHistoryControls.ForwardEnabled); Assert.Equal(verse2, app.StubVerseView.CurrentAbsoluteVerseNumber); app.StubHistoryControls.RaiseForwardClick(); Assert.True(app.StubHistoryControls.BackEnabled); Assert.False(app.StubHistoryControls.ForwardEnabled); Assert.Equal(verse1, app.StubVerseView.CurrentAbsoluteVerseNumber); }
public void NestedSpans() { var location = VerseHelper.Find("Psalms", 11, 1); var verse = Bible.FormattedVerse(location.AbsoluteVerseNumber); Assert.Equal(" To the chief Musician, A Psalm of David. In the LORD put I my trust: how say ye to my soul, Flee as a bird to your mountain?", verse.Text); Assert.Equal(new[] { new FormattedVerse.Span { Type = FormattedVerse.SpanType.Colophon, Begin = 1, End = 41, }, new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 24, End = 31, }, new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 98, End = 100, }, }, verse.Spans, Comparers.SpanComparer); }
public void DoubleCapitalization() { // A few words in the text have the first *two* letters capitalized. var location = VerseHelper.Find("John", 3, 23); var verse = Bible.FormattedVerse(location.AbsoluteVerseNumber); Assert.Equal(" And John also was baptizing in AEnon near to Salim, because there was much water there: and they came, and were baptized.", verse.Text); }
public void LongHyphen_DoesNotIncludeZeroWidthSpace() { // This is the only verse with a long hyphen. var location = VerseHelper.Find("Exodus", 32, 32); var verse = Bible.FormattedVerse(location.AbsoluteVerseNumber); Assert.Equal(" Yet now, if thou wilt forgive their sin—; and if not, blot me, I pray thee, out of thy book which thou hast written.", verse.Text); }
public void ScrollToSameChapter_DoesNotChangeChapterHeading() { var app = new StubbedApp(); var john1ChapterHeading = app.StubChapterHeading.Text; app.StubVerseView.RaiseOnScroll(VerseHelper.Find("John", 1).Chapter.EndVerse - 1); Assert.Equal(john1ChapterHeading, app.StubChapterHeading.Text); }
public void JumpToDifferentChapter_ChangesChapterHeading() { var app = new StubbedApp(); var john1ChapterHeading = app.StubChapterHeading.Text; app.Recreate(VerseHelper.Find("John", 2).AbsoluteVerseNumber); Assert.Equal(VerseHelper.Find("John", 2).ChapterHeadingText, app.StubChapterHeading.Text); Assert.NotEqual(john1ChapterHeading, app.StubChapterHeading.Text); }
public void ScrollToPreviousChapter_ChangesChapterHeading() { var app = new StubbedApp(); var john1ChapterHeading = app.StubChapterHeading.Text; app.StubVerseView.RaiseOnScroll(app.StubVerseView.CurrentAbsoluteVerseNumber - 1); Assert.Equal(VerseHelper.Find("Luke", 24).ChapterHeadingText, app.StubChapterHeading.Text); Assert.NotEqual(john1ChapterHeading, app.StubChapterHeading.Text); }
public void JumpToSameChapter_DoesNotChangeChapterHeading() { var app = new StubbedApp(); app.StubVerseView.RaiseOnScroll(VerseHelper.Find("John", 2).Chapter.EndVerse - 1); var john2ChapterHeading = app.StubChapterHeading.Text; app.Recreate(VerseHelper.Find("John", 2).AbsoluteVerseNumber); Assert.Equal(john2ChapterHeading, app.StubChapterHeading.Text); }
public void ScrollToNextChapter_ChangesChapterHeading() { var app = new StubbedApp(); var john1ChapterHeading = app.StubChapterHeading.Text; app.StubVerseView.RaiseOnScroll(VerseHelper.Find("John", 1).Chapter.EndVerse - 1); app.StubVerseView.RaiseOnScroll(VerseHelper.Find("John", 2).Chapter.BeginVerse); Assert.Equal(VerseHelper.Find("John", 2).ChapterHeadingText, app.StubChapterHeading.Text); Assert.NotEqual(john1ChapterHeading, app.StubChapterHeading.Text); }
public void SwipeLeft_MovesToNextChapter() { var app = new StubbedApp(); var john1ChapterHeading = app.StubChapterHeading.Text; app.StubVerseView.RaiseOnSwipeLeft(); var expectedVerse = VerseHelper.Find("John", 2); Assert.Equal(expectedVerse.AbsoluteVerseNumber, app.StubVerseView.CurrentAbsoluteVerseNumber); Assert.Equal(expectedVerse.ChapterHeadingText, app.StubChapterHeading.Text); Assert.NotEqual(john1ChapterHeading, app.StubChapterHeading.Text); }
public void ScrollDuringSwipeRight_UsesOriginalLocation() { var app = new StubbedApp(); var john1ChapterHeading = app.StubChapterHeading.Text; var john1Location = app.StubVerseView.CurrentVerseLocation; app.StubVerseView.RaiseOnScroll(app.StubVerseView.CurrentAbsoluteVerseNumber - 1); var expectedVerse = VerseHelper.Find("John").PreviousChapter(); app.StubVerseView.RaiseOnSwipeRight(john1Location); Assert.Equal(expectedVerse.AbsoluteVerseNumber, app.StubVerseView.CurrentAbsoluteVerseNumber); Assert.Equal(expectedVerse.ChapterHeadingText, app.StubChapterHeading.Text); Assert.NotEqual(john1ChapterHeading, app.StubChapterHeading.Text); }
public void Scrolling_UpdatesHistory() { var app = new StubbedApp(); var verse1 = Location.Create(Bible.John_1_1 + 13).AbsoluteVerseNumber; var verse2 = VerseHelper.Find("Psalms", 23).AbsoluteVerseNumber; app.StubVerseView.RaiseOnScroll(verse1); app.Recreate(verse2); app.StubHistoryControls.RaiseBackClick(); Assert.Equal(verse1, app.StubVerseView.CurrentAbsoluteVerseNumber); app.StubHistoryControls.RaiseForwardClick(); Assert.Equal(verse2, app.StubVerseView.CurrentAbsoluteVerseNumber); }
public void Rev22_21_Formatted() { var verse = Bible.FormattedVerse(VerseHelper.Find("Revelation", 22, 21).AbsoluteVerseNumber); Assert.Equal(" The grace of our Lord Jesus Christ be with you all. Amen.", verse.Text); Assert.Equal(new [] { new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 36, End = 38, } }, verse.Spans, Comparers.SpanComparer); }
public void AllVerses_PassBasicChecks() { for (var i = 0; i != VerseHelper.Find("Revelation", 22).Chapter.EndVerse; ++i) { var verse = Bible.FormattedVerse(i); Assert.False(string.IsNullOrWhiteSpace(verse.Text)); foreach (var span in verse.Spans) { Assert.True(span.Begin >= 0, $"Invalid span begin for {i}"); Assert.True(span.End <= verse.Text.Length, $"Invalid span end for {i}"); Assert.True(span.Begin < span.End, $"Invalid span for {i}"); Assert.False(string.IsNullOrWhiteSpace(verse.Text.Substring(span.Begin, span.End - span.Begin)), $"Invalid span text for {i}"); } } }
public void History_JumpToNextLocation_DoesNotAddDuplicate() { var app = new StubbedApp(); var verse1 = VerseHelper.Find("Luke", 3, 13).AbsoluteVerseNumber; app.Recreate(verse1); app.StubHistoryControls.RaiseBackClick(); app.Recreate(verse1); Assert.False(app.StubHistoryControls.ForwardEnabled); Assert.Equal(verse1, app.StubVerseView.CurrentAbsoluteVerseNumber); app.StubHistoryControls.RaiseBackClick(); Assert.False(app.StubHistoryControls.BackEnabled); Assert.Equal(Bible.John_1_1, app.StubVerseView.CurrentAbsoluteVerseNumber); }
public void MostSpans() { // This verse has the most spans. var location = VerseHelper.Find("2 Corinthians", 11, 26); var verse = Bible.FormattedVerse(location.AbsoluteVerseNumber); Assert.Equal(" In journeyings often, in perils of waters, in perils of robbers, in perils by mine own countrymen, in perils by the heathen, in perils in the city, in perils in the wilderness, in perils in the sea, in perils among false brethren;", verse.Text); Assert.Equal(new [] { new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 1, End = 3, }, new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 23, End = 25, }, new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 44, End = 46, }, new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 66, End = 68, }, new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 79, End = 87, }, new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 100, End = 102, }, new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 126, End = 128, }, new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 149, End = 151, }, new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 178, End = 180, }, new FormattedVerse.Span { Type = FormattedVerse.SpanType.Italics, Begin = 200, End = 202, }, }, verse.Spans, Comparers.SpanComparer); }
public void Rev22_21_Words() { var verse = Bible.VerseWords(VerseHelper.Find("Revelation", 22, 21).AbsoluteVerseNumber).ToArray(); Assert.Equal(new[] { "The", "grace", "of", "our", "Lord", "Jesus", "Christ", "[", "be", "]", "with", "you", "all", ".", "Amen", "." }, verse); }