Пример #1
0
        public void StringServices_HeadwordForWsAndWritingSystem_NoAffixMarkerOnAudioWs()
        {
            var wsEnAudio = Cache.WritingSystemFactory.get_Engine("en-Zxxx-x-audio");

            Cache.LangProject.AddToCurrentVernacularWritingSystems((CoreWritingSystemDefinition)wsEnAudio);
            var entry1 = MakeAffixEntry("a", "suffix");

            entry1.SetLexemeFormAlt(wsEnAudio.Handle, TsStringUtils.MakeString("en.wav", wsEnAudio.Handle));
            var hc = Cache.ServiceLocator.GetInstance <HomographConfiguration>();

            hc.WritingSystem         = "en";
            hc.HomographNumberBefore = true;
            var headwordForWs = StringServices.HeadWordForWsAndHn(entry1, wsEnAudio.Handle, 1, "???");

            VerifyString(headwordForWs, new[] { "en.wav" }, new[] { wsEnAudio.Handle });
            // verify the homograph number and affix marker are still on the non-audio headword
            headwordForWs = StringServices.HeadWordForWsAndHn(entry1, Cache.DefaultVernWs, 1, "???");
            VerifyString(headwordForWs, new[] { "1", "-a" }, new[] { Cache.DefaultAnalWs, Cache.DefaultVernWs });
        }
Пример #2
0
        public void FixHyperlinkFolder_changeOfPlatform()
        {
            // When running on Windows, call "foreign"="Linux" and "current"="Windows".
            // When running on Linux, call "foreign"="Windows" and "current"="Linux".

            string origPathSetInDatabase          = MiscUtils.IsUnix ? @"c:\origdir\file.txt" : "/origdir/file.txt";
            string newPlatformStyleLookupPath     = MiscUtils.IsUnix ? "/origdir" : @"C:\origdir";
            string newPlatformStyleResultToVerify = MiscUtils.IsUnix ? "file.txt" : "file.txt";
            string pathToRebaseFrom    = MiscUtils.IsUnix ? "/origdir" : @"C:\origdir";
            string pathToRebaseTo      = MiscUtils.IsUnix ? "/newdir" : @"C:\newdir";
            string rebasedPathToVerify = MiscUtils.IsUnix ? "/newdir/file.txt": @"C:\newdir\file.txt";

            // Add an external link into database and look it up
            var output = GetHyperlinksInFolder_changeOfPlatform_helper(origPathSetInDatabase,
                                                                       newPlatformStyleLookupPath, newPlatformStyleResultToVerify);
            var hyperlinkInfo = output.Item1;
            var entry         = output.Item2;

            // Update link paths using currentOS-style paths, even though they are presently stored
            // as foreign-style paths.
            StringServices.FixHyperlinkFolder(hyperlinkInfo, pathToRebaseFrom, pathToRebaseTo);
            VerifyHyperlinkInfo(hyperlinkInfo, entry, LexEntryTags.kflidLiteralMeaning, Cache.DefaultAnalWs, 5, 9, newPlatformStyleResultToVerify);
            VerifyObjData(entry.LiteralMeaning.AnalysisDefaultWritingSystem, 5, 9, rebasedPathToVerify);
        }