public void FixOrcsWithoutProps_OrcForMissingObject() { CheckDisposed(); IScrBook exodus = CreateExodusData(); StTxtPara para = AddPara(exodus.SectionsOS[2]); AddVerse(para, 2, 3, "ORC is here, you see, my friend."); // Update the paragraph contents to include the picture ITsStrBldr tsStrBldr = para.Contents.UnderlyingTsString.GetBldr(); ITsStrFactory factory = TsStrFactoryClass.Create(); StringUtils.InsertOrcIntoPara(Guid.NewGuid(), FwObjDataTypes.kodtOwnNameGuidHot, tsStrBldr, 11, 11, 0); para.Contents.UnderlyingTsString = tsStrBldr.GetString(); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List <string> report = (List <string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(1, report.Count); Assert.AreEqual("EXO 2:3 - Deleted corrupted footnote marker or picture anchor", report[0]); Assert.AreEqual(0, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_OrphanedFootnotesOutOfOrder() { CheckDisposed(); IScrBook exodus = CreateExodusData(); CreateFootnote(exodus, 0, 0, 0, 4, ScrStyleNames.NormalFootnoteParagraph, false); CreateFootnote(exodus, 1, 0, 1, 7, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 2, 0, 1 /* this causes this footnote to get inserted before the preceding one*/, 7, ScrStyleNames.CrossRefFootnoteParagraph, false); CreateFootnote(exodus, 2, 0, 3, 14, ScrStyleNames.NormalFootnoteParagraph, true); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List <string> report = (List <string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyResourceForFixedOrphans(); Assert.AreEqual(3, report.Count); Assert.AreEqual("EXO 1:1 - Deleted corrupted footnote marker or picture anchor", report[0]); // Note that the last ORC gets hooked up to the first orpaned footnote, rather than to // its original footnote, leaving the last one as an orphan still. Assert.AreEqual("EXO 1:7 - Connected footnote to marker in the vernacular text", report[1]); Assert.AreEqual("EXO - Footnote 4 has no corresponding marker in the vernacular text", report[2]); Assert.AreEqual(4, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_OrphanedFootnoteAndValidPicture() { CheckDisposed(); IScrBook exodus = CreateExodusData(); StTxtPara para = AddPara(exodus.SectionsOS[2]); AddVerse(para, 2, 3, "ORC is here, you see, my friend."); // Update the paragraph contents to include the picture ITsStrBldr tsStrBldr = para.Contents.UnderlyingTsString.GetBldr(); ITsStrFactory factory = TsStrFactoryClass.Create(); CmPicture pict = new CmPicture(Cache, "c:\\junk.jpg", factory.MakeString("Test picture", Cache.DefaultVernWs), StringUtils.LocalPictures); Assert.IsNotNull(pict); pict.InsertOwningORCIntoPara(tsStrBldr, 11, 0); para.Contents.UnderlyingTsString = tsStrBldr.GetString(); // Update the paragraph contents to include the (orphaned) footnote marker CreateFootnote(exodus, 1, 0, 1, 19, ScrStyleNames.CrossRefFootnoteParagraph, true); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List <string> report = (List <string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(1, report.Count); Assert.AreEqual("EXO 1:2 - Deleted corrupted footnote marker or picture anchor", report[0]); Assert.AreEqual(0, exodus.FootnotesOS.Count); }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_scrInitializer = new TestTeScrInitializer(Cache); }
public void FixOrcsWithoutProps_OrphanedFootnotesInTitleIntroAndHeading() { CheckDisposed(); IScrBook exodus = CreateExodusData(); CreateFootnote(exodus, exodus.TitleOA, 0, 0, 0, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 0, 0, 1, 9, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 1, 0, 2, 7, ScrStyleNames.NormalFootnoteParagraph, false); CreateFootnote(exodus, exodus.SectionsOS[2].HeadingOA, 0, 3, 7, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 2, 0, 4, 13, ScrStyleNames.NormalFootnoteParagraph, false); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List <string> report = (List <string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(3, report.Count); Assert.AreEqual("EXO Title - Connected footnote to marker in the vernacular text", report[0]); Assert.AreEqual("EXO Intro Section 1, Contents - Connected footnote to marker in the vernacular text", report[1]); Assert.AreEqual("EXO 1:6-7 Section Heading - Connected footnote to marker in the vernacular text", report[2]); Assert.AreEqual(5, exodus.FootnotesOS.Count); }
public override void Exit() { CheckDisposed(); m_scrInitializer = null; base.Exit(); }
public void FixOrcsWithoutProps_NoFootnotesInProject() { IScrBook exodus = CreateExodusData(); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); Assert.IsNull(ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps")); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(0, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_AllFootnotesAreOkay() { IScrBook exodus = CreateExodusData(); CreateFootnote(exodus, 0, 0, 0, 4, ScrStyleNames.NormalFootnoteParagraph, false); CreateFootnote(exodus, 2, 0, 1, 7, ScrStyleNames.NormalFootnoteParagraph, false); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); Assert.IsNull(ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps")); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(2, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_OrphanedFootnoteAndValidPicture() { IScrBook exodus = CreateExodusData(); IScrTxtPara para = AddParaToMockedSectionContent(exodus.SectionsOS[2], ScrStyleNames.NormalParagraph); AddVerse(para, 2, 3, "ORC is here, you see, my friend."); // Update section 2's paragraph contents to include the picture ITsStrBldr tsStrBldr = para.Contents.GetBldr(); ITsStrFactory factory = TsStrFactoryClass.Create(); string filename; if (MiscUtils.IsUnix) { filename = "/tmp/junk.jpg"; } else { filename = "c:\\junk.jpg"; } ICmPicture pict = Cache.ServiceLocator.GetInstance <ICmPictureFactory>().Create(filename, factory.MakeString("Test picture", Cache.DefaultVernWs), CmFolderTags.LocalPictures); Assert.IsNotNull(pict); pict.InsertORCAt(tsStrBldr, 11); para.Contents = tsStrBldr.GetString(); // We need a valid footnote after the picture ORC CreateFootnote(exodus, 2, para.IndexInOwner, 0, 15, ScrStyleNames.CrossRefFootnoteParagraph, false); // Update section 1's paragraph contents to include an orphaned footnote marker CreateFootnote(exodus, 1, 0, 0, 19, ScrStyleNames.CrossRefFootnoteParagraph, true); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List <string> report = (List <string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(1, report.Count); Assert.AreEqual("EXO 1:2 - Deleted corrupted footnote marker or picture anchor", report[0]); Assert.AreEqual(1, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_OrphanedFootnotesWithNoOrcs() { IScrBook exodus = CreateExodusData(); CreateFootnote(exodus, 0, 0, 0, 4, ScrStyleNames.NormalFootnoteParagraph, false); IScrFootnote footnote = Cache.ServiceLocator.GetInstance <IScrFootnoteFactory>().Create(); exodus.FootnotesOS.Add(footnote); //IStTxtPara para = (IStTxtPara)footnote.ParagraphsOS.Append(new StTxtPara()); //para.Contents = TsStringUtils.MakeTss("Poor orphaned footnote 1") TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List <string> report = (List <string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyResourceForFixedOrphans(); Assert.AreEqual(1, report.Count); Assert.AreEqual("EXO - Footnote 2 has no corresponding marker in the vernacular text", report[0]); Assert.AreEqual(2, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_TwoOrphanedFootnotesInParagraph() { IScrBook exodus = CreateExodusData(); IScrTxtPara para = AddParaToMockedSectionContent(exodus.SectionsOS[2], ScrStyleNames.NormalParagraph); AddVerse(para, 2, 3, "ORC is here, you see, my friend."); CreateFootnote(exodus, 1, 0, 0, 7, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 1, 0, 1, 19, ScrStyleNames.CrossRefFootnoteParagraph, true); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List <string> report = (List <string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(2, report.Count); Assert.AreEqual("EXO 1:1 - Deleted corrupted footnote marker or picture anchor", report[0]); Assert.AreEqual("EXO 1:2 - Deleted corrupted footnote marker or picture anchor", report[1]); Assert.AreEqual(0, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_OrphanedFootnotesInOrder() { IScrBook exodus = CreateExodusData(); IScrTxtPara para = AddParaToMockedSectionContent(exodus.SectionsOS[2], ScrStyleNames.NormalParagraph); AddVerse(para, 2, 3, "ORC is here, you see, my friend."); CreateFootnote(exodus, 0, 0, 0, 4, ScrStyleNames.NormalFootnoteParagraph, false); CreateFootnote(exodus, 1, 0, 1, 7, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 2, 0, 2, 7, ScrStyleNames.CrossRefFootnoteParagraph, false); CreateFootnote(exodus, 2, 1, 3, 13, ScrStyleNames.NormalFootnoteParagraph, true); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List <string> report = (List <string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(2, report.Count); Assert.AreEqual("EXO 1:1 - Connected footnote to marker in the vernacular text", report[0]); Assert.AreEqual("EXO 2:3 - Connected footnote to marker in the vernacular text", report[1]); Assert.AreEqual(4, exodus.FootnotesOS.Count); }
public override void TestTearDown() { m_scrInitializer = null; base.TestTearDown(); }
/// <summary> /// /// </summary> public override void TestSetup() { base.TestSetup(); m_scr.ResourcesOC.Clear(); // Make sure we don't think we've already done the fix m_scrInitializer = new TestTeScrInitializer(Cache); }
public void FixOrcsWithoutProps_OrphanedFootnotesWithNoOrcs() { IScrBook exodus = CreateExodusData(); CreateFootnote(exodus, 0, 0, 0, 4, ScrStyleNames.NormalFootnoteParagraph, false); IScrFootnote footnote = Cache.ServiceLocator.GetInstance<IScrFootnoteFactory>().Create(); exodus.FootnotesOS.Add(footnote); //IStTxtPara para = (IStTxtPara)footnote.ParagraphsOS.Append(new StTxtPara()); //para.Contents = TsStringUtils.MakeTss("Poor orphaned footnote 1") TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List<string> report = (List<string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyResourceForFixedOrphans(); Assert.AreEqual(1, report.Count); Assert.AreEqual("EXO - Footnote 2 has no corresponding marker in the vernacular text", report[0]); Assert.AreEqual(2, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_OrphanedFootnotesOutOfOrder() { IScrBook exodus = CreateExodusData(); CreateFootnote(exodus, 0, 0, 0, 4, ScrStyleNames.NormalFootnoteParagraph, false); CreateFootnote(exodus, 1, 0, 1, 7, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 2, 0, 1 /* this causes this footnote to get inserted before the preceding one*/, 7, ScrStyleNames.CrossRefFootnoteParagraph, false); CreateFootnote(exodus, 2, 0, 3, 14, ScrStyleNames.NormalFootnoteParagraph, true); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List<string> report = (List<string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyResourceForFixedOrphans(); Assert.AreEqual(3, report.Count); Assert.AreEqual("EXO 1:1 - Deleted corrupted footnote marker or picture anchor", report[0]); // Note that the last ORC gets hooked up to the first orpaned footnote, rather than to // its original footnote, leaving the last one as an orphan still. Assert.AreEqual("EXO 1:7 - Connected footnote to marker in the vernacular text", report[1]); Assert.AreEqual("EXO - Footnote 4 has no corresponding marker in the vernacular text", report[2]); Assert.AreEqual(4, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_OrphanedFootnotesInTitleIntroAndHeading() { IScrBook exodus = CreateExodusData(); CreateFootnote(exodus, exodus.TitleOA, 0, 0, 0, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 0, 0, 1, 9, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 1, 0, 2, 7, ScrStyleNames.NormalFootnoteParagraph, false); CreateFootnote(exodus, exodus.SectionsOS[2].HeadingOA, 0, 3, 7, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 2, 0, 4, 13, ScrStyleNames.NormalFootnoteParagraph, false); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List<string> report = (List<string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(3, report.Count); Assert.AreEqual("EXO Title - Connected footnote to marker in the vernacular text", report[0]); Assert.AreEqual("EXO Intro Section 1, Contents - Connected footnote to marker in the vernacular text", report[1]); Assert.AreEqual("EXO 1:6-7 Section Heading - Connected footnote to marker in the vernacular text", report[2]); Assert.AreEqual(5, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_OrcForMissingObject() { IScrBook exodus = CreateExodusData(); IScrTxtPara para = AddParaToMockedSectionContent(exodus.SectionsOS[2], ScrStyleNames.NormalParagraph); AddVerse(para, 2, 3, "ORC is here, you see, my friend."); // Update the paragraph contents to include the picture ITsStrBldr tsStrBldr = para.Contents.GetBldr(); ITsStrFactory factory = TsStrFactoryClass.Create(); TsStringUtils.InsertOrcIntoPara(Guid.NewGuid(), FwObjDataTypes.kodtOwnNameGuidHot, tsStrBldr, 11, 11, Cache.DefaultVernWs); para.Contents = tsStrBldr.GetString(); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List<string> report = (List<string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(1, report.Count); Assert.AreEqual("EXO 2:3 - Deleted corrupted footnote marker or picture anchor", report[0]); Assert.AreEqual(0, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_OrphanedFootnoteAndValidPicture() { IScrBook exodus = CreateExodusData(); IScrTxtPara para = AddParaToMockedSectionContent(exodus.SectionsOS[2], ScrStyleNames.NormalParagraph); AddVerse(para, 2, 3, "ORC is here, you see, my friend."); // Update section 2's paragraph contents to include the picture ITsStrBldr tsStrBldr = para.Contents.GetBldr(); ITsStrFactory factory = TsStrFactoryClass.Create(); string filename; if (MiscUtils.IsUnix) filename = "/tmp/junk.jpg"; else filename = "c:\\junk.jpg"; ICmPicture pict = Cache.ServiceLocator.GetInstance<ICmPictureFactory>().Create(filename, factory.MakeString("Test picture", Cache.DefaultVernWs), CmFolderTags.LocalPictures); Assert.IsNotNull(pict); pict.InsertORCAt(tsStrBldr, 11); para.Contents = tsStrBldr.GetString(); // We need a valid footnote after the picture ORC CreateFootnote(exodus, 2, para.IndexInOwner, 0, 15, ScrStyleNames.CrossRefFootnoteParagraph, false); // Update section 1's paragraph contents to include an orphaned footnote marker CreateFootnote(exodus, 1, 0, 0, 19, ScrStyleNames.CrossRefFootnoteParagraph, true); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List<string> report = (List<string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(1, report.Count); Assert.AreEqual("EXO 1:2 - Deleted corrupted footnote marker or picture anchor", report[0]); Assert.AreEqual(1, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_OrphanedFootnotesInOrder() { IScrBook exodus = CreateExodusData(); IScrTxtPara para = AddParaToMockedSectionContent(exodus.SectionsOS[2], ScrStyleNames.NormalParagraph); AddVerse(para, 2, 3, "ORC is here, you see, my friend."); CreateFootnote(exodus, 0, 0, 0, 4, ScrStyleNames.NormalFootnoteParagraph, false); CreateFootnote(exodus, 1, 0, 1, 7, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 2, 0, 2, 7, ScrStyleNames.CrossRefFootnoteParagraph, false); CreateFootnote(exodus, 2, 1, 3, 13, ScrStyleNames.NormalFootnoteParagraph, true); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List <string> report = (List<string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(2, report.Count); Assert.AreEqual("EXO 1:1 - Connected footnote to marker in the vernacular text", report[0]); Assert.AreEqual("EXO 2:3 - Connected footnote to marker in the vernacular text", report[1]); Assert.AreEqual(4, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_OrphanedFootnoteAndValidPicture() { CheckDisposed(); IScrBook exodus = CreateExodusData(); StTxtPara para = AddPara(exodus.SectionsOS[2]); AddVerse(para, 2, 3, "ORC is here, you see, my friend."); // Update the paragraph contents to include the picture ITsStrBldr tsStrBldr = para.Contents.UnderlyingTsString.GetBldr(); ITsStrFactory factory = TsStrFactoryClass.Create(); CmPicture pict = new CmPicture(Cache, "c:\\junk.jpg", factory.MakeString("Test picture", Cache.DefaultVernWs), StringUtils.LocalPictures); Assert.IsNotNull(pict); pict.InsertOwningORCIntoPara(tsStrBldr, 11, 0); para.Contents.UnderlyingTsString = tsStrBldr.GetString(); // Update the paragraph contents to include the (orphaned) footnote marker CreateFootnote(exodus, 1, 0, 1, 19, ScrStyleNames.CrossRefFootnoteParagraph, true); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List<string> report = (List<string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(1, report.Count); Assert.AreEqual("EXO 1:2 - Deleted corrupted footnote marker or picture anchor", report[0]); Assert.AreEqual(0, exodus.FootnotesOS.Count); }
public void FixOrcsWithoutProps_TwoOrphanedFootnotesInParagraph() { IScrBook exodus = CreateExodusData(); IScrTxtPara para = AddParaToMockedSectionContent(exodus.SectionsOS[2], ScrStyleNames.NormalParagraph); AddVerse(para, 2, 3, "ORC is here, you see, my friend."); CreateFootnote(exodus, 1, 0, 0, 7, ScrStyleNames.NormalFootnoteParagraph, true); CreateFootnote(exodus, 1, 0, 1, 19, ScrStyleNames.CrossRefFootnoteParagraph, true); TeScrInitializer scrInit = new TestTeScrInitializer(Cache); List<string> report = (List<string>)ReflectionHelper.GetResult(scrInit, "FixOrcsWithoutProps"); VerifyNoOrphanedFootnotes(); VerifyResourceForFixedOrphans(); Assert.AreEqual(2, report.Count); Assert.AreEqual("EXO 1:1 - Deleted corrupted footnote marker or picture anchor", report[0]); Assert.AreEqual("EXO 1:2 - Deleted corrupted footnote marker or picture anchor", report[1]); Assert.AreEqual(0, exodus.FootnotesOS.Count); }