예제 #1
0
        public void VerifyDropDownContentWithValidDefault()
        {
            IScrSection section = m_inMemoryCache.AddSectionToMockedBook(m_James.Hvo);

            section.VerseRefMin = 59001001;
            section.VerseRefMax = 59002010;
            section             = m_inMemoryCache.AddSectionToMockedBook(m_James.Hvo);
            section.VerseRefMin = 59003001;
            section.VerseRefMax = 59003015;
            section             = m_inMemoryCache.AddSectionToMockedBook(m_James.Hvo);
            section.VerseRefMin = 59004001;
            section.VerseRefMax = 59005018;
            m_ctrlOwner.Show();

            // Send James 3:5 to the control
            m_dbScp.ScReference = new ScrReference(59, 3, 5, m_scr.Versification);
            m_dbScp.SimulateDropDownButtonClick();

            WaitForDropDownWindow();

            Assert.AreEqual("JAS 3:5", m_dbScp.DropDownWindow.CurrentScRef.AsString.ToUpper());

            // Verify James is the current and default book.
            Assert.AreEqual(59, m_dbScp.DropDownWindow.CurrentButtonValue,
                            "Incorrect Current Book Button");
            Assert.AreEqual(59, m_dbScp.DropDownWindow.CurrentBook, "Incorrect Current Book");
            Assert.AreEqual(ScrPassageDropDown.ListTypes.Books,
                            m_dbScp.DropDownWindow.CurrentListType, "Incorrect List is showing");

            // Move to the chapter list and verify chapter 3 current and default chapter.
            m_dbScp.DropDownWindow.PerformKeyDown(new KeyEventArgs(Keys.Enter));
            Assert.AreEqual(3, m_dbScp.DropDownWindow.CurrentButtonValue,
                            "Incorrect Current Chapter Button");
            Assert.AreEqual(3, m_dbScp.DropDownWindow.CurrentChapter,
                            "Incorrect Current Chapter");
            Assert.AreEqual(ScrPassageDropDown.ListTypes.Chapters,
                            m_dbScp.DropDownWindow.CurrentListType, "Incorrect List is showing");

            // Should be 5 chapters showing
            Assert.AreEqual(5, m_dbScp.DropDownWindow.ButtonsShowing,
                            "Incorrect number of chapters showing");

            // Move to the verse list and verify verse 5 is current and default verse.
            m_dbScp.DropDownWindow.PerformKeyDown(new KeyEventArgs(Keys.Enter));
            Assert.AreEqual(5, m_dbScp.DropDownWindow.CurrentButtonValue,
                            "Incorrect Current Verse Button");
            Assert.AreEqual(5, m_dbScp.DropDownWindow.CurrentVerse, "Incorrect Current Verse");
            Assert.AreEqual(ScrPassageDropDown.ListTypes.Verses,
                            m_dbScp.DropDownWindow.CurrentListType, "Incorrect List is showing");

            // Should be 18 verses showing
            Assert.AreEqual(18, m_dbScp.DropDownWindow.ButtonsShowing,
                            "Incorrect number of verses showing");
        }
예제 #2
0
        public void UserPromptForSectionHeadWithEmptyPara()
        {
            CheckDisposed();

            // Set up section head with an empty paragraph
            IScrSection section = m_inMemoryCache.AddSectionToMockedBook(m_book.Hvo);
            StTxtPara   para    = m_inMemoryCache.AddSectionHeadParaToSection(section.Hvo, "",
                                                                              ScrStyleNames.SectionHead);

            section.AdjustReferences();
            Options.ShowEmptyParagraphPromptsSetting = true;

            DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultVernWs);

            CreateExpectedUserPrompt(stVc, para.Hvo,
                                     (int)ScrSection.ScrSectionTags.kflidHeading, (int)StTxtPara.StTxtParaTags.kflidContents);

            IVwEnv vwEnv      = (IVwEnv)m_vwenvMock.MockInstance;
            bool   fTextAdded = stVc.CallInsertUserPrompt(vwEnv, para.Hvo);

            Assert.IsTrue(fTextAdded, "User prompt not added");
            ITsString text = stVc.DisplayVariant(vwEnv, SimpleRootSite.kTagUserPrompt, null,
                                                 (int)ScrSection.ScrSectionTags.kflidHeading);

            string difference;
            bool   fEqual = TsStringHelper.TsStringsAreEqual(
                ExpectedUserPrompt("Type section head here", m_inMemoryCache.Cache.DefaultVernWs),
                text, out difference);

            Assert.IsTrue(fEqual, difference);
            m_vwenvMock.Verify();
        }