示例#1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds a free translation and analyses to the specified segment on the specified
        /// paragraph
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private static void AddSegmentTrans(IStTxtPara para, int iSeg, string transFT)
        {
            AddSegmentFt(para, iSeg, transFT, para.Cache.DefaultAnalWs);
            ISegment seg = para.SegmentsOS[iSeg];

            LcmTestHelper.CreateAnalyses(seg, para.Contents, seg.BeginOffset, seg.EndOffset, true);
        }
示例#2
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Verifies the free translations for the segments of the specified paragraph.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 private static void VerifyParaSegments(IStTxtPara para, params string[] segmentFTs)
 {
     Assert.AreEqual(segmentFTs.Length, para.SegmentsOS.Count);
     for (int i = 0; i < segmentFTs.Length; i++)
     {
         Assert.AreEqual(segmentFTs[i], para.SegmentsOS[i].FreeTranslation.AnalysisDefaultWritingSystem.Text,
                         "Free translation for segment " + i + " is wrong");
         LcmTestHelper.VerifyAnalysis(para.SegmentsOS[i], i, new int[0], new int[0]);
     }
 }
示例#3
0
        public void AddHyperlink()
        {
            ITsStrBldr strBldr = TsStringUtils.MakeStrBldr();

            LcmStyleSheet mockStylesheet     = MockRepository.GenerateStub <LcmStyleSheet>();
            IStStyle      mockHyperlinkStyle = MockRepository.GenerateStub <IStStyle>();

            mockHyperlinkStyle.Name = StyleServices.Hyperlink;
            mockHyperlinkStyle.Stub(x => x.InUse).Return(true);
            mockStylesheet.Stub(x => x.FindStyle(StyleServices.Hyperlink)).Return(mockHyperlinkStyle);

            Assert.IsTrue(FwEditingHelper.AddHyperlink(strBldr, Cache.DefaultAnalWs, "Click Here",
                                                       "www.google.com", mockStylesheet));
            Assert.AreEqual(1, strBldr.RunCount);
            Assert.AreEqual("Click Here", strBldr.get_RunText(0));
            ITsTextProps props = strBldr.get_Properties(0);

            LcmTestHelper.VerifyHyperlinkPropsAreCorrect(props, Cache.DefaultAnalWs, "www.google.com");
        }