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

            stylesheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles);
            ScrMappingList mappingList = new ScrMappingList(MappingSet.Main, stylesheet);

            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();
            IParatextAdapter sut = new ParatextProxy();

            Assert.IsTrue(sut.LoadProjectMappings("TEV", mappingList, ImportDomain.Main));

            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_MissingStyleFile()
        {
            FwStyleSheet stylesheet = new FwStyleSheet();

            stylesheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles);
            ScrMappingList mappingList = new ScrMappingList(MappingSet.Main, stylesheet);

            Unpacker.UnPackMissingFileParatextTestProjects();
            IParatextAdapter sut = new ParatextProxy();

            Assert.IsFalse(sut.LoadProjectMappings("NSF", mappingList, ImportDomain.Main));
        }
Example #3
0
        public void LoadParatextMappings_Normal()
        {
            Unpacker.UnPackParatextTestProjects();
            IParatextAdapter sut = new ParatextProxy();

            FwStyleSheet stylesheet = new FwStyleSheet();

            stylesheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles);
            ScrMappingList mappingList = new ScrMappingList(MappingSet.Main, stylesheet);

            Assert.IsTrue(sut.LoadProjectMappings("KAM", mappingList, 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 #4
0
        public void LoadParatextMappings_NullProjectName()
        {
            IParatextAdapter sut = new ParatextProxy();

            Assert.IsFalse(sut.LoadProjectMappings(null, null, ImportDomain.Main));
        }