Example #1
0
        public void LoadParatextMappings_MarkMappingsInUse()
        {
            var stylesheet = new FwStyleSheet();

            stylesheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles);
            IScrImportSet importSettings = Cache.ServiceLocator.GetInstance <IScrImportSetFactory>().Create();

            importSettings.ParatextScrProj = "TEV";
            ScrMappingList mappingList = importSettings.GetMappingListForDomain(ImportDomain.Main);

            mappingList.Add(new ImportMappingInfo(@"\hahaha", @"\*hahaha", false,
                                                  MappingTargetType.TEStyle, MarkerDomain.Default, "laughing",
                                                  null, null, true, ImportDomain.Main));
            mappingList.Add(new ImportMappingInfo(@"\bthahaha", @"\*bthahaha", false,
                                                  MappingTargetType.TEStyle, MarkerDomain.Default, "laughing",
                                                  "en", null, true, ImportDomain.Main));

            Unpacker.UnPackParatextTestProjects();

            ParatextHelper.LoadProjectMappings(importSettings);

            Assert.IsTrue(mappingList[@"\c"].IsInUse);
            Assert.IsTrue(mappingList[@"\p"].IsInUse);
            Assert.IsFalse(mappingList[@"\ipi"].IsInUse);
            Assert.IsFalse(mappingList[@"\hahaha"].IsInUse,
                           "In-use flag should have been cleared before re-scanning when the P6 project changed.");
            Assert.IsTrue(mappingList[@"\bthahaha"].IsInUse,
                          "In-use flag should not have been cleared before re-scanning when the P6 project changed because it was in use by the BT.");
        }
Example #2
0
        public void LoadParatextMappings_NullProjectName()
        {
            IScrImportSet importSettings = Cache.ServiceLocator.GetInstance <IScrImportSetFactory>().Create();

            ParatextHelper.LoadProjectMappings(importSettings);
            Assert.That(importSettings.ParatextScrProj, Is.Null);
        }
Example #3
0
        public void LoadParatextMappings_MarkMappingsInUse()
        {
            if (ScriptureProvider.VersionInUse >= new Version(8, 0))
            {
                Assert.Ignore("This test uses data that is only valid for Paratext7. The test fails with Paratext8 installed.");
            }
            var stylesheet = new LcmStyleSheet();

            stylesheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles);
            IScrImportSet importSettings = Cache.ServiceLocator.GetInstance <IScrImportSetFactory>().Create();

            Cache.LangProject.TranslatedScriptureOA.ImportSettingsOC.Add(importSettings);
            importSettings.ParatextScrProj = "TEV";
            ScrMappingList mappingList = importSettings.GetMappingListForDomain(ImportDomain.Main);

            Assert.NotNull(mappingList, "Setup Failure, no mapping list returned for the domain.");
            mappingList.Add(new ImportMappingInfo(@"\hahaha", @"\*hahaha", false,
                                                  MappingTargetType.TEStyle, MarkerDomain.Default, "laughing",
                                                  null, null, true, ImportDomain.Main));
            mappingList.Add(new ImportMappingInfo(@"\bthahaha", @"\*bthahaha", false,
                                                  MappingTargetType.TEStyle, MarkerDomain.Default, "laughing",
                                                  "en", null, true, ImportDomain.Main));

            Unpacker.UnPackParatextTestProjects();

            ParatextHelper.LoadProjectMappings(importSettings);

            Assert.IsTrue(mappingList[@"\c"].IsInUse);
            Assert.IsTrue(mappingList[@"\p"].IsInUse);
            Assert.IsFalse(mappingList[@"\ipi"].IsInUse);
            Assert.IsFalse(mappingList[@"\hahaha"].IsInUse,
                           "In-use flag should have been cleared before re-scanning when the P6 project changed.");
            Assert.IsTrue(mappingList[@"\bthahaha"].IsInUse,
                          "In-use flag should not have been cleared before re-scanning when the P6 project changed because it was in use by the BT.");
        }
Example #4
0
        public void LoadParatextMappings_Normal()
        {
            if (ScriptureProvider.VersionInUse >= new Version(8, 0))
            {
                Assert.Ignore("This test uses data that is only valid for Paratext7. The test fails with Paratext8 installed.");
            }
            Unpacker.UnPackParatextTestProjects();

            var stylesheet = new LcmStyleSheet();

            stylesheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles);
            IScrImportSet importSettings = Cache.ServiceLocator.GetInstance <IScrImportSetFactory>().Create();

            Cache.LangProject.TranslatedScriptureOA.ImportSettingsOC.Add(importSettings);
            importSettings.ParatextScrProj = "KAM";
            ParatextHelper.LoadProjectMappings(importSettings);

            ScrMappingList mappingList = importSettings.GetMappingListForDomain(ImportDomain.Main);

            // Test to see that the projects are set correctly
            Assert.AreEqual(44, mappingList.Count);

            Assert.AreEqual(MarkerDomain.Default, mappingList[@"\c"].Domain);
            Assert.AreEqual(MarkerDomain.Default, mappingList[@"\v"].Domain);
            Assert.AreEqual(@"\f*", mappingList[@"\f"].EndMarker);
            Assert.IsTrue(mappingList[@"\p"].IsInUse);
            Assert.IsFalse(mappingList[@"\tb2"].IsInUse);
        }
Example #5
0
        public void LoadParatextMappings_MissingStyleFile()
        {
            FwStyleSheet stylesheet = new FwStyleSheet();

            stylesheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles);
            IScrImportSet importSettings = Cache.ServiceLocator.GetInstance <IScrImportSetFactory>().Create();

            importSettings.ParatextScrProj = "NSF";

            Unpacker.UnPackMissingFileParatextTestProjects();
            ParatextHelper.LoadProjectMappings(importSettings);
            Assert.That(importSettings.ParatextScrProj, Is.Null);
        }
Example #6
0
        public void LoadParatextMappings_MissingEncodingFile()
        {
            var stylesheet = new LcmStyleSheet();

            stylesheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles);
            IScrImportSet importSettings = Cache.ServiceLocator.GetInstance <IScrImportSetFactory>().Create();

            Cache.LangProject.TranslatedScriptureOA.ImportSettingsOC.Add(importSettings);
            importSettings.ParatextScrProj = "NEC";

            Unpacker.UnPackMissingFileParatextTestProjects();

            ParatextHelper.LoadProjectMappings(importSettings);
            Assert.That(importSettings.ParatextScrProj, Is.Null);
        }
Example #7
0
        public void LoadParatextMappings_Normal()
        {
            Unpacker.UnPackParatextTestProjects();

            var stylesheet = new FwStyleSheet();

            stylesheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles);
            IScrImportSet importSettings = Cache.ServiceLocator.GetInstance <IScrImportSetFactory>().Create();

            importSettings.ParatextScrProj = "KAM";
            ParatextHelper.LoadProjectMappings(importSettings);

            ScrMappingList mappingList = importSettings.GetMappingListForDomain(ImportDomain.Main);

            // Test to see that the projects are set correctly
            Assert.AreEqual(44, mappingList.Count);

            Assert.AreEqual(MarkerDomain.Default, mappingList[@"\c"].Domain);
            Assert.AreEqual(MarkerDomain.Default, mappingList[@"\v"].Domain);
            Assert.AreEqual(@"\f*", mappingList[@"\f"].EndMarker);
            Assert.IsTrue(mappingList[@"\p"].IsInUse);
            Assert.IsFalse(mappingList[@"\tb2"].IsInUse);
        }