public void SFImportJonahTOB() { using (UndoableUnitOfWorkHelper undoHelper = new UndoableUnitOfWorkHelper( m_actionHandler, "import settings")) { m_settings.ImportBookIntros = true; m_settings.ImportAnnotations = false; m_settings.ImportTranslation = true; m_settings.ImportBackTranslation = false; MakeSFImportTestSettings((m_settings as IScrImportSet)); (m_settings as IScrImportSet).StartRef = (m_settings as IScrImportSet).EndRef = m_bcvRefJonah; undoHelper.RollBack = false; // keep the changes } // do the import DummyTeImportManager mgr = new DummyTeImportManager(Cache, m_styleSheet); mgr.SimulateAcceptAllBooks = true; mgr.CallImportWithUndoTask(m_settings); //TeSfmImporter.Import(m_settings, Cache, m_styleSheet, // new DummyUndoImportManager(this), new TeImportNoUi()); //verify the results IScrBook jonah = Cache.LangProject.TranslatedScriptureOA.FindBook("JON"); Assert.IsNotNull(jonah, "Jonah wasn't created."); Assert.AreEqual(8, jonah.SectionsOS.Count, "Incorrect number of sections"); IFdoOwningSequence<IStPara> titleParas = jonah.TitleOA.ParagraphsOS; Assert.AreEqual(1, titleParas.Count, "The title should consist of 1 para"); string title = ((IStTxtPara)titleParas[0]).Contents.Text; Assert.AreEqual("JONAS", title.Trim(), "Incorrect book title"); Assert.AreEqual("JONAS", jonah.Name.VernacularDefaultWritingSystem, "Incorrect book name"); Assert.AreEqual(@"TOB32.SBF, CB 28.09.94", jonah.IdText); Assert.AreEqual(32001000, jonah.SectionsOS[0].VerseRefStart, "Introductory Section start reference"); Assert.AreEqual(32001000, jonah.SectionsOS[0].VerseRefEnd, "Introductory Section end reference"); Assert.AreEqual(32001000, jonah.SectionsOS[3].VerseRefStart, "Introductory Section start reference"); Assert.AreEqual(32001000, jonah.SectionsOS[3].VerseRefEnd, "Introductory Section end reference"); Assert.AreEqual(32001001, jonah.SectionsOS[4].VerseRefStart, "Section 4 start reference"); Assert.AreEqual(32001016, jonah.SectionsOS[4].VerseRefEnd, "Section 4 end reference"); Assert.AreEqual(32004001, jonah.SectionsOS[7].VerseRefStart, "Section 7 start reference"); Assert.AreEqual(32004011, jonah.SectionsOS[7].VerseRefEnd, "Section 7 end reference"); Assert.AreEqual(1, jonah.SectionsOS[0].HeadingOA.ParagraphsOS.Count, "Incorrect number of paras in first section heading."); IStTxtPara firstIntroHeadingPara = (IStTxtPara)jonah.SectionsOS[0].HeadingOA.ParagraphsOS[0]; string sBrkChar = new string((char)0x2028, 1); Assert.AreEqual("Composition", firstIntroHeadingPara.Contents.Text, "First para of first intro section incorrect"); // Verify the text in section[6], para[0], irun 0-2 (Jonah 3:1) Assert.AreEqual(1, jonah.SectionsOS[6].ContentOA.ParagraphsOS.Count); IStTxtPara para = (IStTxtPara)jonah.SectionsOS[6].ContentOA.ParagraphsOS[0]; //first para Assert.AreEqual(21, para.Contents.RunCount); AssertEx.RunIsCorrect(para.Contents, 0, "3", "Chapter Number", m_wsVern); AssertEx.RunIsCorrect(para.Contents, 1, "1", "Verse Number", m_wsVern); AssertEx.RunIsCorrect(para.Contents, 2, "La parole du SEIGNEUR s'adressa une seconde fois à Jonas: ", null, m_wsVern); // Check some text toward the end (in verse 4:11) para = (IStTxtPara)jonah.SectionsOS[7].ContentOA.ParagraphsOS[0]; Assert.AreEqual("11Et moi", para.Contents.Text.Substring(1543, 8)); }
public void ParatextImportTitusTEV() { using (UndoableUnitOfWorkHelper undoHelper = new UndoableUnitOfWorkHelper( m_actionHandler, "import settings")) { m_settings.ImportBookIntros = true; m_settings.ImportAnnotations = false; m_settings.ImportTranslation = true; m_settings.ImportBackTranslation = false; MakeParatextImportTestSettings((m_settings as IScrImportSet)); (m_settings as IScrImportSet).StartRef = (m_settings as IScrImportSet).EndRef = m_bcvRefTitus; undoHelper.RollBack = false; // keep the changes } // do the import DummyTeImportManager mgr = new DummyTeImportManager(Cache, m_styleSheet); mgr.SimulateAcceptAllBooks = true; mgr.CallImportWithUndoTask(m_settings); //TeSfmImporter.Import(m_settings, Cache, m_styleSheet, // new DummyUndoImportManager(this), new TeImportNoUi()); // verify the results IScrBook titus = Cache.LangProject.TranslatedScriptureOA.FindBook("TIT"); Assert.IsNotNull(titus, "Titus wasn't created."); Assert.AreEqual(7, titus.SectionsOS.Count, "Incorrect number of sections"); IFdoOwningSequence<IStPara> titleParas = titus.TitleOA.ParagraphsOS; Assert.AreEqual(1, titleParas.Count, "Incorrect number of title Paragraphs"); string title = ((IStTxtPara)titleParas[0]).Contents.Text; string sBrkChar = new string((char)0x2028, 1); Assert.AreEqual("Paul's Letter to" + sBrkChar + "TITUS", title.Trim(), "Incorrect book title"); Assert.AreEqual("TITUS", titus.Name.VernacularDefaultWritingSystem.Text.ToUpper(), "Incorrect book name"); Assert.AreEqual(@"57TIT.TEV updated to USFM JULY 30, 2002 epeters " + @"FOR PREDISTRIBUTION USE ONLY", titus.IdText); Assert.AreEqual(56001000, ((IScrSection)titus.SectionsOS[0]).VerseRefStart, "Introductory Section start reference"); Assert.AreEqual(56001000, ((IScrSection)titus.SectionsOS[0]).VerseRefEnd, "Introductory Section end reference"); Assert.AreEqual(56001000, ((IScrSection)titus.SectionsOS[1]).VerseRefStart, "Introductory Outline Section start reference"); Assert.AreEqual(56001000, ((IScrSection)titus.SectionsOS[1]).VerseRefEnd, "Introductory Outline Section end reference"); Assert.AreEqual(56001001, ((IScrSection)titus.SectionsOS[2]).VerseRefStart, "Section 2 start reference"); Assert.AreEqual(56001004, ((IScrSection)titus.SectionsOS[2]).VerseRefEnd, "Section 2 end reference"); Assert.AreEqual(56003012, ((IScrSection)titus.SectionsOS[6]).VerseRefStart, "Section 6 start reference"); Assert.AreEqual(56003015, ((IScrSection)titus.SectionsOS[6]).VerseRefEnd, "Section 6 end reference"); Assert.AreEqual(1, ((IScrSection)titus.SectionsOS[0]).HeadingOA.ParagraphsOS.Count, "First section should have a single para: 'Introduction'"); IStTxtPara firstIntroHeadingPara = (IStTxtPara)titus.SectionsOS[0].HeadingOA.ParagraphsOS[0]; Assert.AreEqual("Introduction", firstIntroHeadingPara.Contents.Text, "First intro section should be called 'Introduction'"); // Verify the text in section[5], para[0], irun 0 (Tit 3:1) Assert.AreEqual(2, titus.SectionsOS[5].ContentOA.ParagraphsOS.Count); IStTxtPara para = (IStTxtPara)titus.SectionsOS[5].ContentOA.ParagraphsOS[0]; //first para Assert.AreEqual(17, para.Contents.RunCount); AssertEx.RunIsCorrect(para.Contents, 0, "3", "Chapter Number", m_wsVern); AssertEx.RunIsCorrect(para.Contents, 1, "1", "Verse Number", m_wsVern); // Verify the text in section[6], para[2], irun 0 (Tit 3:15) Assert.AreEqual(3, titus.SectionsOS[6].ContentOA.ParagraphsOS.Count); para = (IStTxtPara)titus.SectionsOS[6].ContentOA.ParagraphsOS[1]; //second para Assert.AreEqual(2, para.Contents.RunCount); AssertEx.RunIsCorrect(para.Contents, 0, "15", "Verse Number", m_wsVern); AssertEx.RunIsCorrect(para.Contents, 1, "All who are with me send you greetings. Give our greetings " + "to our friends in the faith.", null, m_wsVern); // Verify the text in section[6], para[3], irun 0 (Tit 3:15) para = (IStTxtPara)titus.SectionsOS[6].ContentOA.ParagraphsOS[2]; //third para Assert.AreEqual(1, para.Contents.RunCount); AssertEx.RunIsCorrect(para.Contents, 0, "God's grace be with you all.", null, m_wsVern); Assert.AreEqual(StyleUtils.ParaStyleTextProps("Paragraph"), para.StyleRules); // Check for verse bridge para = (IStTxtPara)titus.SectionsOS[3].ContentOA.ParagraphsOS[1]; Assert.AreEqual("12-13", para.Contents.Text.Substring(274, 5)); }