예제 #1
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);
		}
예제 #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);
		}
예제 #3
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);
		}