Exemplo n.º 1
0
        public void CreateFromStringRep_BT_withBrackets()
        {
            CheckDisposed();
            SetupBackTrans();

            // Setup expected results for the footnote
            ITsPropsBldr propsBldr = TsPropsBldrClass.Create();

            propsBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                       (int)FwTextPropVar.ktpvDefault, m_vernWs);
            propsBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null);
            ITsStrBldr bldr = TsStrBldrClass.Create();

            bldr.Replace(0, 0, "Text in <brackets>", propsBldr.GetTextProps());
            propsBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                      null);
            m_footnotePara.Contents.UnderlyingTsString = bldr.GetString();

            // ... and now set up the expected results for the back translations of the footnote.
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, "Spanish BT in <brackets>", null);
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, "German BT in <brackets>", null);

            // Define text representation and create a footnote from it.
            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 @"<RUN WS='fr'>Text in &lt;brackets&gt;</RUN>" +
                                 @"<TRANS WS='es'><RUN WS='es'>Spanish BT in &lt;brackets&gt;</RUN></TRANS>" +
                                 @"<TRANS WS='de'><RUN WS='de'>German BT in &lt;brackets&gt;</RUN></TRANS></P></FN>";
            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");

            CompareFootnote(footnote);
        }
Exemplo n.º 2
0
        public void CreateFromStringRep_twoCharStylePara()
        {
            CheckDisposed();

            ITsPropsBldr propsBldr = TsPropsBldrClass.Create();

            propsBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                       (int)FwTextPropVar.ktpvDefault,
                                       m_vernWs);
            propsBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                      "Emphasis");
            ITsStrBldr bldr = TsStrBldrClass.Create();

            bldr.Replace(0, 0, "Test Text", propsBldr.GetTextProps());
            propsBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                      null);
            bldr.Replace(bldr.Length, bldr.Length, "No char style",
                         propsBldr.GetTextProps());
            propsBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle,
                                      "Quoted Text");
            bldr.Replace(bldr.Length, bldr.Length, "Ahh!!!!!!",
                         propsBldr.GetTextProps());
            m_footnotePara.Contents.UnderlyingTsString = bldr.GetString();

            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 @"<RUN WS='fr' CS='Emphasis'>Test Text</RUN><RUN WS='fr'>No char style</RUN>" +
                                 "<RUN WS='fr' CS='Quoted Text'>Ahh!!!!!!</RUN></P></FN>";
            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");

            CompareFootnote(footnote);
        }
Exemplo n.º 3
0
        public void CreateFromStringRep_twoParas()
        {
            CheckDisposed();

            ITsStrBldr bldr = m_footnotePara.Contents.UnderlyingTsString.GetBldr();

            bldr.Replace(0, 0, "Paragraph One", null);
            m_footnotePara.Contents.UnderlyingTsString = bldr.GetString();

            // create second para
            StTxtPara para = new StTxtPara();

            m_footnote.ParagraphsOS.Append(para);
            para.StyleRules = StyleUtils.ParaStyleTextProps("Note Exegesis Paragraph");
            bldr            = TsStrBldrClass.Create();
            bldr.Replace(0, 0, "Paragraph Two", StyleUtils.CharStyleTextProps("Foreign", m_wsUr));
            para.Contents.UnderlyingTsString = bldr.GetString();

            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 @"<RUN WS='fr'>Paragraph One</RUN></P><P><PS>Note Exegesis Paragraph</PS>" +
                                 @"<RUN WS='ur' CS='Foreign'>Paragraph Two</RUN></P></FN>";
            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");

            CompareFootnote(footnote);
        }
Exemplo n.º 4
0
        public void CreateFromStringRep_ExcptnUnknownElement()
        {
            // Define text representation and create a footnote from it.
            string footnoteRep = @"<FN><BLAH>o</BLAH>";

            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");
        }
Exemplo n.º 5
0
        public void CreateFromStringRep_ExcptnWSWithoutValue()
        {
            // Define text representation and create a footnote from it.
            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 @"<RUN WS=>Run has a writing system attribute but no value.</RUN></P></FN>";

            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");
        }
Exemplo n.º 6
0
        public void CreateFromStringRep_ExcptnWSMissingFromRunElement()
        {
            // Define text representation and create a footnote from it.
            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 @"<RUN>Run without a writing system.</RUN></P></FN>";

            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");
        }
Exemplo n.º 7
0
        public void CreateFromStringRep_ExcptnInvalidICU()
        {
            // Define text representation and create a footnote from it.
            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 @"<RUN WS='AINT_IT' CS='Emphasis'>Test Text</RUN></P></FN>";

            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");
        }
Exemplo n.º 8
0
        public void CreateFromStringRep_ExcptnUnknownTRANS_Element()
        {
            // Define text representation and create a footnote from it.
            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 @"<RUN WS='fr'>Fine so far...</RUN>" +
                                 "<TRANS WS='en'><BLAH>...but here's the problem</BLAH></TRANS></P></FN>";

            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");
        }
Exemplo n.º 9
0
        public void CreateFromStringRep_easy1Para()
        {
            CheckDisposed();

            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 @"<RUN WS='fr'></RUN></P></FN>";

            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");

            CompareFootnote(footnote);
        }
Exemplo n.º 10
0
        public void CreateFromStringRep_nullFootnoteMarker()
        {
            CheckDisposed();

            // test null footnote marker
            m_footnote.FootnoteMarker.Text = null;

            string footnoteRep = @"<FN><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 "<RUN WS='fr'></RUN></P></FN>";
            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");

            CompareFootnote(footnote);
        }
Exemplo n.º 11
0
        public void CreateFromStringRep_withBrackets()
        {
            CheckDisposed();

            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 "<RUN WS='fr'>Text in &lt;brackets&gt;</RUN></P></FN>";

            ITsStrBldr bldr = m_footnotePara.Contents.UnderlyingTsString.GetBldr();

            bldr.Replace(0, 0, "Text in <brackets>", null);
            m_footnotePara.Contents.UnderlyingTsString = bldr.GetString();

            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");

            CompareFootnote(footnote);
        }
Exemplo n.º 12
0
        public void CreateFromStringRep_charStylePara()
        {
            CheckDisposed();

            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 @"<RUN WS='fr' CS='Emphasis'>Test Text</RUN></P></FN>";

            ITsStrBldr bldr = m_footnotePara.Contents.UnderlyingTsString.GetBldr();

            bldr.SetStrPropValue(0, 0, (int)FwTextPropType.ktptNamedStyle, "Emphasis");
            bldr.Replace(0, 0, "Test Text", null);
            m_footnotePara.Contents.UnderlyingTsString = bldr.GetString();

            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");

            CompareFootnote(footnote);
        }
Exemplo n.º 13
0
        public void CreateFromStringRep_BT_MultiCharStylePara()
        {
            CheckDisposed();
            SetupBackTrans();

            ITsIncStrBldr strBldr = TsIncStrBldrClass.Create();

            strBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
                                     (int)FwTextPropVar.ktpvDefault, m_vernWs);

            // Setup expected results for the footnote
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Emphasis");       // run 1
            strBldr.Append("Test Text");
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null);             // run 2
            strBldr.Append("No char style");
            strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Quoted Text");    // run 3
            strBldr.Append("Ahh!!!!!!");
            m_footnotePara.Contents.UnderlyingTsString = strBldr.GetString();

            // ... and now set up the expected results for the back translations of the footnote.
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, "Spanish", null);
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, m_vernWs, " back ", ScrStyleNames.UntranslatedWord);
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, " translation!", "Emphasis");

            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, "German!", "Emphasis");
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, m_vernWs, " back ", ScrStyleNames.UntranslatedWord);
            m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, " translation", null);

            // Define text representation and create a footnote from it.
            string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
                                 @"<RUN WS='fr' CS='Emphasis'>Test Text</RUN><RUN WS='fr'>No char style</RUN>" +
                                 "<RUN WS='fr' CS='Quoted Text'>Ahh!!!!!!</RUN>" +
                                 "<TRANS WS='es'><RUN WS='es'>Spanish</RUN><RUN WS='fr' CS='Untranslated Word'> back </RUN>" +
                                 "<RUN WS='es' CS='Emphasis'> translation!</RUN></TRANS>" +
                                 "<TRANS WS='de'><RUN WS='de' CS='Emphasis'>German!</RUN>" +
                                 "<RUN WS='fr' CS='Untranslated Word'> back </RUN><RUN WS='de'> translation</RUN></TRANS></P></FN>";

            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");

            CompareFootnote(footnote);
        }
Exemplo n.º 14
0
        public void CreateFromStringRep_showReference()
        {
            CheckDisposed();

            string footnoteRep = @"<FN><M>o</M><ShowMarker/><ShowReference/><P>" +
                                 @"<PS>Note General Paragraph</PS><RUN WS='fr'></RUN></P></FN>";

            m_footnote.DisplayFootnoteReference = true;
            StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
                                                                 (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");

            CompareFootnote(footnote);

            footnoteRep = @"<FN><M>o</M><ShowReference/><P><PS>Note General Paragraph</PS>" +
                          "<RUN WS='fr'></RUN></P></FN>";
            m_footnote.DisplayFootnoteMarker = false;
            footnote = StFootnote.CreateFromStringRep(m_book,
                                                      (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");
            CompareFootnote(footnote);
        }