public void GetMagicStringAlt_TestVernInPara() { // set up project writing systems Cache.LangProject.CurrentVernacularWritingSystems.Clear(); Cache.LangProject.CurrentAnalysisWritingSystems.Clear(); CoreWritingSystemDefinition mluWs, senWs, engWs; WritingSystemServices.FindOrCreateWritingSystem(Cache, null, "mlu", false, true, out mluWs); WritingSystemServices.FindOrCreateWritingSystem(Cache, null, "sen", false, true, out senWs); WritingSystemServices.FindOrCreateWritingSystem(Cache, null, "en", true, false, out engWs); Cache.LangProject.AddToCurrentVernacularWritingSystems(mluWs); Cache.LangProject.AddToCurrentVernacularWritingSystems(senWs); Cache.LangProject.AddToCurrentAnalysisWritingSystems(engWs); var mluId = mluWs.Handle; var senId = senWs.Handle; var engId = engWs.Handle; // set up a paragraph that starts with Anal and ends with Vern var tssf = new TsStrFactory(); var tssb = tssf.GetBldr(); tssb.Append(tssf.MakeString("Analysis ", engId)); tssb.Append(tssf.MakeString("Vernacular ", senId)); tssb.Append(tssf.MakeString("Other Vernacular ", mluId)); var paraBldr = Cache.ServiceLocator.GetInstance <StTxtParaBldr>(); var stText = Cache.ServiceLocator.GetInstance <IStTextFactory>().Create(); Cache.ServiceLocator.GetInstance <ITextFactory>().Create().ContentsOA = stText; // needed to put a Cache in stText var para = paraBldr.CreateParagraph(stText); para.Contents = tssb.GetString(); // SUT int wsId; WritingSystemServices.GetMagicStringAlt(Cache, Cache.MainCacheAccessor, WritingSystemServices.kwsVernInParagraph, para.Hvo, 0, false, out wsId); Assert.AreEqual(senId, wsId, "The first vernacular WS in the para is 'sen'"); }
public override void FixtureSetup() { CheckDisposed(); base.FixtureSetup(); Debug.Assert(m_fdoCache == null, "m_fdoCache is not null"); //if (m_fdoCache != null) // m_fdoCache.DisposeWithWSFactoryShutdown(); m_fdoCache = InDatabaseFdoTestBase.SetupCache(); ScrReferenceTests.InitializeScrReferenceForTests(); m_wsf = m_fdoCache.LanguageWritingSystemFactoryAccessor; m_wsf.BypassInstall = true; m_wsEn = m_wsf.GetWsFromStr("en"); m_factory = TsStrFactoryClass.Create(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Connect to TestLangProj and start an undo task; /// init the base class we are testing /// </summary> /// ------------------------------------------------------------------------------------ public override void FixtureSetup() { base.FixtureSetup(); ScrReferenceTests.InitializeScrReferenceForTests(); m_wsf = Cache.LanguageWritingSystemFactoryAccessor; m_factory = TsStrFactoryClass.Create(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Get the string that should be displayed in place of an object character associated /// with the specified GUID. This dummy version just returns something similar to what /// TE would normally put in for an alpha footnote. /// </summary> /// <param name="bstrGuid"></param> /// <returns>non-breaking space</returns> /// ------------------------------------------------------------------------------------ public override ITsString GetStrForGuid(string bstrGuid) { TsStrFactory strFactory = TsStrFactoryClass.Create(); return(strFactory.MakeString("\uFEFFa", m_wsDefault)); }