CallOnLoad() приватный Метод

private CallOnLoad ( EventArgs eventArgs ) : void
eventArgs System.EventArgs
Результат void
Пример #1
0
        public void ClickExpansion()
        {
            int[] glosses = MakeAnnotations(m_firstPara);
            Cache.VwCacheDaAccessor.CacheVecProp(m_stText.Hvo, m_ribbon.AnnotationListId, glosses, glosses.Length);
            m_ribbon.MakeRoot();
            m_ribbon.RootBox.Reconstruct();             // forces it to really be constructed
            m_ribbon.CallOnLoad(new EventArgs());
            Assert.AreEqual(new int[] { glosses[0] }, m_ribbon.SelectedAnnotations, "should have selection even before any click");

            Rectangle rcSrc, rcDst;

            m_ribbon.CallGetCoordRects(out rcSrc, out rcDst);
            m_ribbon.RootBox.MouseDown(1, 1, rcSrc, rcDst);
            m_ribbon.RootBox.MouseUp(1, 1, rcSrc, rcDst);
            Assert.AreEqual(new int[] { glosses[0] }, m_ribbon.SelectedAnnotations);

            Rectangle location = m_ribbon.GetSelLocation();

            Assert.IsTrue(m_ribbon.RootBox.Selection.IsRange, "single click selection should expand to range");
            int width = location.Width;

            // Clicking just right of that should add the second one. We need to allow for the gap between
            // (about 10 pixels) and at the left of the view.
            m_ribbon.RootBox.MouseDown(width + 15, 5, rcSrc, rcDst);
            m_ribbon.RootBox.MouseUp(width + 15, 5, rcSrc, rcDst);
            Assert.AreEqual(new int[] { glosses[0], glosses[1] }, m_ribbon.SelectedAnnotations);

            // And a shift-click back near the start should go back to just one of them.
            m_ribbon.RootBox.MouseDownExtended(1, 1, rcSrc, rcDst);
            m_ribbon.RootBox.MouseUp(1, 1, rcSrc, rcDst);
            Assert.AreEqual(new int[] { glosses[0] }, m_ribbon.SelectedAnnotations);
        }
Пример #2
0
        public void ClickExpansion()
        {
            var glosses   = GetParaAnalyses(m_firstPara);
            var glossList = new List <AnalysisOccurrence>();

            glossList.AddRange(glosses);
            EndSetupTask();

            //SUT
            UndoableUnitOfWorkHelper.Do("CacheAnnUndo", "CacheAnnRedo", m_actionHandler, () =>
                                        m_ribbon.CacheRibbonItems(glossList));

            m_ribbon.MakeRoot();
            m_ribbon.RootBox.Reconstruct();             // forces it to really be constructed
            m_ribbon.CallOnLoad(new EventArgs());
            Assert.AreEqual(new [] { glosses[0] }, m_ribbon.SelectedOccurrences, "should have selection even before any click");

            Rectangle rcSrc, rcDst;

            m_ribbon.CallGetCoordRects(out rcSrc, out rcDst);

            // SUT #2?!
            m_ribbon.RootBox.MouseDown(1, 1, rcSrc, rcDst);
            m_ribbon.RootBox.MouseUp(1, 1, rcSrc, rcDst);
            Assert.AreEqual(new [] { glosses[0] }, m_ribbon.SelectedOccurrences);

            Rectangle location = m_ribbon.GetSelLocation();

            Assert.IsTrue(m_ribbon.RootBox.Selection.IsRange, "single click selection should expand to range");
            int width = location.Width;

            // SUT #3?!
            // Clicking just right of that should add the second one. We need to allow for the gap between
            // (about 10 pixels) and at the left of the view.
            m_ribbon.RootBox.MouseDown(width + 15, 5, rcSrc, rcDst);
            m_ribbon.RootBox.MouseUp(width + 15, 5, rcSrc, rcDst);
            Assert.AreEqual(new [] { glosses[0], glosses[1] }, m_ribbon.SelectedOccurrences);

            // SUT #4?!
            // And a shift-click back near the start should go back to just one of them.
            m_ribbon.RootBox.MouseDownExtended(1, 1, rcSrc, rcDst);
            m_ribbon.RootBox.MouseUp(1, 1, rcSrc, rcDst);
            Assert.AreEqual(new [] { glosses[0] }, m_ribbon.SelectedOccurrences);
        }