Ejemplo n.º 1
0
		public void GetBCVRefAtPosWithinPara_MiddleOfPara()
		{
			CheckDisposed();

			ChapterVerseFound retVal;
			BCVRef refStart, refEnd;

			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, m_para.Hvo);
			retVal = scrPara.GetBCVRefAtPosWithinPara(-1, 25, out refStart, out refEnd);

			// verify the results
			Assert.AreEqual(ChapterVerseFound.Verse, retVal);
			Assert.AreEqual(new BCVRef(0, 0, 16), refStart);
			Assert.AreEqual(new BCVRef(0, 0, 16), refEnd);
		}
Ejemplo n.º 2
0
		public void SectionReferences_BookTitle()
		{
			CheckDisposed();

			// add title
			StText title = m_scrInMemoryCache.AddTitleToMockedBook(m_book.Hvo, "This is the title");

			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, title.ParagraphsOS[0].Hvo);

			BCVRef sectRefStart, sectRefEnd;
			scrPara.CallGetSectionStartAndEndRefs(out sectRefStart, out sectRefEnd);

			// verify the results
			Assert.AreEqual(new BCVRef(40, 1, 0), sectRefStart);
			Assert.AreEqual(new BCVRef(40, 1, 0), sectRefEnd);
		}
Ejemplo n.º 3
0
		public void GetBCVRefAtPosWithinPara_InvalidPos()
		{
			CheckDisposed();

			ChapterVerseFound retVal;
			BCVRef refStart, refEnd;

			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, m_para.Hvo);
			retVal = scrPara.GetBCVRefAtPosWithinPara(-1, -1, out refStart, out refEnd);

			// verify the results
			Assert.AreEqual(ChapterVerseFound.None, retVal);
		}
Ejemplo n.º 4
0
		public void GetSectionStartAndEndRefs_SectionHeading()
		{
			CheckDisposed();

			// add section and heading
			IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(m_book.Hvo);
			StTxtPara paraHeading = m_scrInMemoryCache.AddSectionHeadParaToSection(section.Hvo,
				"This is the heading", ScrStyleNames.SectionHead);
			// and content
			StTxtPara para = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo,
				ScrStyleNames.NormalParagraph);
			m_scrInMemoryCache.AddRunToMockedPara(para, "15", ScrStyleNames.ChapterNumber);
			m_scrInMemoryCache.AddRunToMockedPara(para, "1", ScrStyleNames.VerseNumber);
			m_scrInMemoryCache.AddRunToMockedPara(para, "some text", null);
			m_scrInMemoryCache.AddRunToMockedPara(para, "4", ScrStyleNames.VerseNumber);
			m_scrInMemoryCache.AddRunToMockedPara(para, "some text", null);
			section.AdjustReferences();

			DummyScrTxtPara headingPara = new DummyScrTxtPara(Cache, paraHeading.Hvo);

			BCVRef sectRefStart, sectRefEnd;
			headingPara.CallGetSectionStartAndEndRefs(out sectRefStart, out sectRefEnd);

			// verify the results
			Assert.AreEqual(40015001, sectRefStart);
			Assert.AreEqual(40015004, sectRefEnd);
		}
Ejemplo n.º 5
0
		public void SectionReferences_IntroPara()
		{
			CheckDisposed();

			// add section and empty paragraph
			IScrSection section = m_scrInMemoryCache.AddIntroSectionToMockedBook(m_book.Hvo);
			StTxtPara para = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo,
				ScrStyleNames.IntroParagraph);
			section.AdjustReferences();

			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, para.Hvo);

			BCVRef sectRefStart, sectRefEnd;
			scrPara.CallGetSectionStartAndEndRefs(out sectRefStart, out sectRefEnd);

			// verify the results
			Assert.AreEqual(new BCVRef(40, 1, 0), sectRefStart);
			Assert.AreEqual(new BCVRef(40, 1, 0), sectRefEnd);
		}
Ejemplo n.º 6
0
		public void ChapterNumberInPara()
		{
			CheckDisposed();

			// Insert a new paragraph at the end of the first section
			StTxtPara newPara = m_scrInMemoryCache.AddParaToMockedSectionContent(m_section1.Hvo,
				ScrStyleNames.NormalParagraph);
			m_scrInMemoryCache.AddRunToMockedPara(newPara, "42", ScrStyleNames.ChapterNumber);
			m_scrInMemoryCache.AddRunToMockedPara(newPara, "Some more text", null);

			BCVRef refStart, refEnd;
			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, newPara.Hvo);
			scrPara.GetBCVRefAtPosition(5, out refStart, out refEnd);

			// verify the results
			Assert.AreEqual(new BCVRef(40, 42, 1), refStart);
			Assert.AreEqual(new BCVRef(40, 42, 1), refEnd);
		}
Ejemplo n.º 7
0
		public void ChapterNumberInPrevPara()
		{
			CheckDisposed();

			BCVRef refStart, refEnd;
			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, m_para3.Hvo);
			scrPara.GetBCVRefAtPosition(5, out refStart, out refEnd);

			// verify the results
			Assert.AreEqual(new BCVRef(40, 2, 4), refStart);
			Assert.AreEqual(new BCVRef(40, 2, 4), refEnd);
		}
Ejemplo n.º 8
0
		public void NewParaInExistingSection_Begin()
		{
			CheckDisposed();

			// Insert a new paragraph at the beginning of the first section
			StText text = new StText(Cache, m_para1.OwnerHVO);
			StTxtPara newPara = new StTxtPara();
			text.ParagraphsOS.InsertAt(newPara, 0);
			newPara.Contents.Text = "Some text at beginning of section without previous verse";

			BCVRef refStart, refEnd;
			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, newPara.Hvo);
			scrPara.GetBCVRefAtPosition(0, out refStart, out refEnd);

			// verify the results
			Assert.AreEqual(new BCVRef(40, 1, 15), refStart);
			Assert.AreEqual(new BCVRef(40, 1, 15), refEnd);
		}
Ejemplo n.º 9
0
		public void NewParaInExistingSection_End()
		{
			CheckDisposed();

			// Insert a new paragraph at the end of the first section
			StTxtPara newPara = m_scrInMemoryCache.AddParaToMockedSectionContent(m_section1.Hvo,
				ScrStyleNames.NormalParagraph);
			m_scrInMemoryCache.AddRunToMockedPara(newPara, "Text at the end of the section.", null);

			BCVRef refStart, refEnd;
			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, newPara.Hvo);
			scrPara.GetBCVRefAtPosition(1, out refStart, out refEnd);

			// verify the results
			Assert.AreEqual(new BCVRef(40, 1, 17), refStart);
			Assert.AreEqual(new BCVRef(40, 1, 17), refEnd);
		}
Ejemplo n.º 10
0
		public void FromPrevParagraph_FirstSection()
		{
			CheckDisposed();

			BCVRef refStart, refEnd;

			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, m_para1.Hvo);
			scrPara.GetBCVRefAtPosition(-1, out refStart, out refEnd);

			// verify the results
			// for this test the needed result is not precisely defined yet
			// when it is defined, modify this to that spec, but for now...
			Assert.AreEqual(new BCVRef(40, 1, 15), refStart);  // Phm_1_0?  Phm_1_1-25
			Assert.AreEqual(new BCVRef(40, 1, 15), refEnd);
		}
Ejemplo n.º 11
0
		public void NewParaInNewSection()
		{
			CheckDisposed();

			IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(m_book.Hvo);
			StTxtPara para = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo,
				ScrStyleNames.NormalParagraph);
			m_scrInMemoryCache.AddRunToMockedPara(para, "This is a test.", null);
			section.AdjustReferences();

			BCVRef refStart, refEnd;

			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, para.Hvo);
			scrPara.GetBCVRefAtPosition(1, out refStart, out refEnd);

			// verify the results
			Assert.AreEqual(40002005, refStart);
			Assert.AreEqual(40002005, refEnd);
		}
Ejemplo n.º 12
0
		public void FromPrevParagraph_SecondSection()
		{
			CheckDisposed();

			BCVRef refStart, refEnd;

			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, m_para3.Hvo);
			scrPara.GetBCVRefAtPosition(-1, out refStart, out refEnd);

			// verify the results
			Assert.AreEqual(new BCVRef(40, 2, 3), refStart);
			Assert.AreEqual(new BCVRef(40, 2, 3), refEnd);
		}
Ejemplo n.º 13
0
		public void StartOfPara_StartOfSection()
		{
			CheckDisposed();

			BCVRef refStart, refEnd;

			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, m_para1.Hvo);
			scrPara.GetBCVRefAtPosition(0, out refStart, out refEnd);

			// verify the results
			Assert.AreEqual(new BCVRef(40, 1, 15), refStart);
			Assert.AreEqual(new BCVRef(40, 1, 15), refEnd);
		}
Ejemplo n.º 14
0
		public void GetBCVRefAtPosWithinPara_WithNonNumericChapter()
		{
			CheckDisposed();

			m_scrInMemoryCache.AddRunToMockedPara(m_para, "A", ScrStyleNames.ChapterNumber);
			m_section.AdjustReferences();

			ChapterVerseFound retVal;
			BCVRef refStart, refEnd;

			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, m_para.Hvo);
			retVal = scrPara.GetBCVRefAtPosWithinPara(-1, m_para.Contents.Length, out refStart, out refEnd);

			// verify the results
			Assert.AreEqual(ChapterVerseFound.Verse | ChapterVerseFound.Chapter, retVal);
			Assert.AreEqual(new BCVRef(0, 2, 17), refStart);
			Assert.AreEqual(new BCVRef(0, 2, 17), refEnd);

		}
Ejemplo n.º 15
0
		public void GetBCVRefAtPosWithinPara_BeforeChapterNumber_AssocPrevTrue()
		{
			CheckDisposed();

			ChapterVerseFound retVal;
			BCVRef refStart, refEnd;

			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, m_para.Hvo);
			retVal = scrPara.GetBCVRefAtPosWithinPara(-1, 20, true, out refStart, out refEnd);

			// verify the results
			Assert.AreEqual(ChapterVerseFound.Verse | ChapterVerseFound.Chapter, retVal);
			Assert.AreEqual(new BCVRef(0, 1, 1), refStart);
			Assert.AreEqual(new BCVRef(0, 1, 1), refEnd);
		}
Ejemplo n.º 16
0
		public void GetBCVRefAtPosWithinPara_AtEnd()
		{
			CheckDisposed();

			ChapterVerseFound retVal;
			BCVRef refStart, refEnd;

			DummyScrTxtPara scrPara = new DummyScrTxtPara(Cache, m_para.Hvo);
			retVal = scrPara.GetBCVRefAtPosWithinPara(-1, m_para.Contents.Length-1, out refStart,
				out refEnd);

			// verify the results
			Assert.AreEqual(ChapterVerseFound.Verse | ChapterVerseFound.Chapter, retVal);
			Assert.AreEqual(new BCVRef(0, 2, 17), refStart);
			Assert.AreEqual(new BCVRef(0, 2, 17), refEnd);
		}