Exemplo n.º 1
0
        public void GetRenderings_SurrogateIsForSingleBiblicalTermWithTwoRenderings_ReturnsBothRenderings()
        {
            string[] renderings = new[] { "abc", "xyz" };
            m_renderings["GreekWord"] = renderings;
            var kt = new KeyTerm(new KeyTermMatchSurrogate("diversion", "GreekWord"));

            Assert.IsTrue(kt.Renderings.SequenceEqual(renderings));
            Assert.AreEqual("abc", kt.BestRendering);
        }
Exemplo n.º 2
0
        public void CanRenderingBeDeleted_ExplicitDefaultRendering_ReturnsFalse()
        {
            string[] renderings = new[] { "abc", "xyz" };
            m_renderings["GreekWord"] = renderings;
            var kt = new KeyTerm(new KeyTermMatchSurrogate("diversion", "GreekWord"));

            kt.AddRendering("bestest");
            kt.BestRendering = "bestest";
            Assert.IsFalse(kt.CanRenderingBeDeleted("bestest"));
        }
Exemplo n.º 3
0
        public void GetRenderings_SurrogateIsForThreeBiblicalTermsOneOfWhichHasNoRenderings_ReturnsCombinedRenderings()
        {
            string[] renderings1 = new[] { "abc", "xyz" };
            string[] renderings2 = new[] { "xyz", "def", "qrs" };
            m_renderings["GreekWord1"] = renderings1;
            m_renderings["HebrewWord"] = renderings2;
            var kt = new KeyTerm(new KeyTermMatchSurrogate("diversion", "GreekWord1", "GreekWord2", "HebrewWord"));

            Assert.IsTrue(kt.Renderings.SequenceEqual(new [] { "abc", "xyz", "def", "qrs" }));
            Assert.AreEqual("xyz", kt.BestRendering);
        }
Exemplo n.º 4
0
        public void AddRendering_NoOtherRenderings_AddedRenderingIsDefault()
        {
            m_renderings["GreekWord"] = new string[0];
            var kt = new KeyTerm(new KeyTermMatchSurrogate("diversion", "GreekWord"));

            kt.AddRendering("wunkyboo");
            Assert.AreEqual(1, kt.Renderings.Count());
            Assert.AreEqual("wunkyboo", kt.BestRendering);
            Assert.AreEqual("wunkyboo", kt.Translation);
            kt.LoadRenderings();
            Assert.AreEqual("wunkyboo", kt.BestRendering);
            Assert.AreEqual("wunkyboo", kt.Translation);
            kt.DeleteRendering("wunkyboo");
            Assert.AreEqual(string.Empty, kt.BestRendering);
            Assert.AreEqual(string.Empty, kt.Translation);
        }
Exemplo n.º 5
0
        public void AddAndRemoveRenderings()
        {
            string[] renderings = new[] { "abc", "xyz" };
            m_renderings["GreekWord"] = renderings;
            var kt = new KeyTerm(new KeyTermMatchSurrogate("diversion", "GreekWord"));

            Assert.IsFalse(m_testFileAccessor.Exists(DataFileAccessor.DataFileId.KeyTermRenderingInfo));
            kt.AddRendering("wunkyboo");
            Assert.IsTrue(m_testFileAccessor.Exists(DataFileAccessor.DataFileId.KeyTermRenderingInfo));
            Assert.AreEqual(3, kt.Renderings.Count());
            Assert.IsTrue(kt.Renderings.Contains("wunkyboo"));
            Assert.IsTrue(kt.CanRenderingBeDeleted("wunkyboo"));
            Assert.IsFalse(kt.CanRenderingBeDeleted("abc"));
            kt.DeleteRendering("wunkyboo");
            Assert.IsFalse(kt.Renderings.Contains("wunkyboo"));
        }
Exemplo n.º 6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:TermRenderingCtrl"/> class.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public TermRenderingCtrl(KeyTerm term, int endOffsetOfPrev,
                                 Action <bool> selectKeyboard, Action <IEnumerable <string> > lookupTerm)
        {
            InitializeComponent();

            DoubleBuffered           = true;
            m_term                   = term;
            m_selectKeyboard         = selectKeyboard;
            m_lookupTerm             = lookupTerm;
            m_lblKeyTermColHead.Text = term.ToString();
            EndOffsetOfRenderingOfPreviousOccurrenceOfThisTerm = endOffsetOfPrev;
            PopulateRenderings();
            term.BestRenderingChanged += term_BestRenderingChanged;

            HandleStringsLocalized();
            LocalizeItemDlg <XLiffDocument> .StringsLocalized += HandleStringsLocalized;
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:TermRenderingCtrl"/> class.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public TermRenderingCtrl(KeyTerm term, int endOffsetOfPrev,
                                 Action <bool> selectKeyboard, Action <IEnumerable <string> > lookupTerm)
        {
            InitializeComponent();

            DoubleBuffered           = true;
            m_term                   = term;
            m_selectKeyboard         = selectKeyboard;
            m_lookupTerm             = lookupTerm;
            m_lblKeyTermColHead.Text = term.ToString();
            EndOffsetOfRenderingOfPreviousOccurrenceOfThisTerm = endOffsetOfPrev;
            PopulateRenderings();
            term.BestRenderingChanged += term_BestRenderingChanged;

            mnuLookUpTermC.Text        = string.Format(mnuLookUpTermC.Text, s_AppName);
            mnuLookUpTermH.Text        = string.Format(mnuLookUpTermH.Text, s_AppName);
            mnuRefreshRenderingsH.Text = string.Format(mnuRefreshRenderingsH.Text, s_AppName);
        }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Handles a change (probably from another TermRenderingCtrl) to our term's best
 /// rendering.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 void term_BestRenderingChanged(KeyTerm sender)
 {
     m_lbRenderings.Invalidate();
 }