/// ----------------------------------------------------------------------------------- /// <summary> /// Creates a dummy draft view in the main window. /// </summary> /// ----------------------------------------------------------------------------------- public void CreateDraftView() { CheckDisposed(); // Check for verse bridge if (m_dummyDraftView != null) m_dummyDraftView.Dispose(); m_dummyDraftView = new DummyDraftView(Cache, false, Handle.ToInt32()); m_dummyDraftView.Name = "dummyDraftView"; m_dummyDraftView.Visible = true; m_dummyDraftView.StyleSheet = StyleSheet; m_dummyDraftView.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; m_dummyDraftView.Dock = DockStyle.Fill; Controls.Add(m_dummyDraftView); ClientWindows.Add(m_dummyDraftView.GetType().Name, m_dummyDraftView); m_dummyDraftView.MakeRoot(); // JT needed to add this to get tests to pass. m_dummyDraftView.ActivateView(); // m_dummyDraftView.TeEditingHelper.InTestMode = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates the dummy draft view. /// </summary> /// <param name="fForBT"><c>true</c> if the draft view is supposed to represent a BT /// </param> /// <param name="fMakeRoot"><c>true</c> if the root should be constructed; <c>false</c> /// if the caller will be responsible for making the rootbox later.</param> /// <returns></returns> /// ------------------------------------------------------------------------------------ private DummyDraftView CreateDummyDraftView(bool fForBT, bool fMakeRoot) { DummyDraftView draftView = new DummyDraftView(Cache, fForBT, Handle.ToInt32()); draftView.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; draftView.Dock = DockStyle.Fill; draftView.Name = "draftView"; draftView.StyleSheet = StyleSheet; if (m_rootb != null) draftView.RootBox = m_rootb; if (fMakeRoot) { draftView.MakeRoot(); draftView.Visible = true; draftView.ActivateView(); } return draftView; }
public override void TestSetup() { base.TestSetup(); m_styleSheet = new DynamicMock(typeof(IVwStylesheet)); m_styleSheet.Strict = true; InitializeVwSelection(m_selHelper); m_btView = new DummyDraftView(Cache, true, 0); m_btView.RootBox = SetupRootBox(); m_btView.Graphics = SetupGraphics(); m_btView.MakeRoot(); m_btView.StyleSheet = (IVwStylesheet)m_styleSheet.MockInstance; m_btView.ActivateView(); m_rootBox.Strict = true; }
public override void TestSetup() { base.TestSetup(); m_styleSheet = new DynamicMock(typeof(IVwStylesheet)); m_styleSheet.Strict = true; // Set up a default selection helper. Tests may choose to create a different one. m_selHelper = new DynamicMock(typeof(SelectionHelper)); m_selHelper.Strict = true; m_selHelper.SetupResult("NumberOfLevels", 4); m_selHelper.SetupResult("RestoreSelectionAndScrollPos", true); BTInsertVerseAndFootnoteTests.InitializeVwSelection(m_selHelper); SelectionHelper.s_mockedSelectionHelper = (SelectionHelper)m_selHelper.MockInstance; m_draftView = new DummyDraftView(Cache, false, 0); m_draftView.BookFilter.Add(m_book); m_draftView.RootBox = SetupRootBox(); m_draftView.Graphics = SetupGraphics(); m_draftView.MakeRoot(); m_draftView.StyleSheet = (IVwStylesheet)m_styleSheet.MockInstance; m_draftView.ActivateView(); m_rootBox.Strict = true; SelLevInfo[] selLevInfo = new SelLevInfo[4]; selLevInfo[3].tag = m_draftView.BookFilter.Tag; selLevInfo[2].tag = ScrBookTags.kflidSections; selLevInfo[2].ihvo = 0; selLevInfo[0].ihvo = 0; selLevInfo[0].tag = StTextTags.kflidParagraphs; m_selHelper.SetupResult("LevelInfo", selLevInfo); m_selHelper.SetupResult("GetLevelInfo", selLevInfo, new Type[] { typeof(SelectionHelper.SelLimitType) }); m_selHelper.Expect("SetIPAfterUOW"); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Creates 2 sync'd draftviews in a form. Loads scripture from the DB. /// </summary> /// <param name="cache">The cache, believe it or not</param> /// ----------------------------------------------------------------------------------- public RootSiteGroup CreateSyncDraftView(FdoCache cache) { CheckDisposed(); Cache = cache; RootSiteGroup group = new RootSiteGroup(cache, (int)TeViewGroup.Scripture); DummyDraftView draft1 = CreateDummyDraftView(false, false); m_draftView = CreateDummyDraftView(false, false); group.AddToSyncGroup(draft1); group.AddToSyncGroup(m_draftView); group.ScrollingController = m_draftView; draft1.MakeRoot(); draft1.Visible = true; m_draftView.MakeRoot(); m_draftView.Visible = true; Controls.Add(group); group.Show(); return group; }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_styleSheet = new DynamicMock(typeof(FwStyleSheet)); m_styleSheet.Strict = true; BTInsertVerseAndFootnoteTests.InitializeVwSelection(m_selHelper); Debug.Assert(m_draftView == null, "m_draftView is not null."); //if (m_draftView != null) // m_draftView.Dispose(); m_draftView = new DummyDraftView(Cache, false, 0); m_draftView.RootBox = SetupRootBox(); m_draftView.Graphics = SetupGraphics(); m_draftView.MakeRoot(); m_draftView.StyleSheet = (FwStyleSheet)m_styleSheet.MockInstance; m_draftView.ActivateView(); m_draftView.TeEditingHelper.InTestMode = true; m_rootBox.Strict = true; SelLevInfo[] selLevInfo = new SelLevInfo[4]; selLevInfo[3].tag = m_draftView.BookFilter.Tag; selLevInfo[2].tag = (int)ScrBook.ScrBookTags.kflidSections; selLevInfo[2].ihvo = 0; selLevInfo[0].ihvo = 0; selLevInfo[0].tag = (int)StText.StTextTags.kflidParagraphs; m_selHelper.SetupResult("GetLevelInfo", selLevInfo, new Type[] { typeof(SelectionHelper.SelLimitType)}); m_selHelper.SetupResult("LevelInfo", selLevInfo); m_selHelper.Expect("SetSelection", false); m_selHelper.Expect("SetSelection", true); m_selHelper.ExpectAndReturn("ReduceSelectionToIp", m_selHelper.MockInstance, SelectionHelper.SelLimitType.Top, false, true); }
public void Init() { CheckDisposed(); Debug.Assert(m_inMemoryCache == null, "m_inMemoryCache is not null."); //if (m_inMemoryCache != null) // m_inMemoryCache.Dispose(); m_inMemoryCache = ScrInMemoryFdoCache.Create(); m_inMemoryCache.InitializeLangProject(); m_inMemoryCache.InitializeScripture(); m_scripture = m_inMemoryCache.Cache.LangProject.TranslatedScriptureOA; m_inMemoryCache.InitializeActionHandler(); m_styleSheet = new DynamicMock(typeof(FwStyleSheet)); m_styleSheet.Strict = true; BTInsertVerseAndFootnoteTests.InitializeVwSelection(m_selHelper); Debug.Assert(m_btView == null, "m_btView is not null."); //if (m_btView != null) // m_btView.Dispose(); m_btView = new DummyDraftView(m_inMemoryCache.Cache, true, 0); m_btView.RootBox = SetupRootBox(); m_btView.Graphics = SetupGraphics(); m_btView.MakeRoot(); m_btView.StyleSheet = (FwStyleSheet)m_styleSheet.MockInstance; m_btView.ActivateView(); m_btView.TeEditingHelper.InTestMode = true; m_rootBox.Strict = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates the dummy draft view. /// </summary> /// <param name="fForBT"><c>true</c> if the draft view is supposed to represent a BT /// </param> /// <param name="fMakeRoot"><c>true</c> if the root should be constructed; <c>false</c> /// if the caller will be responsible for making the rootbox later.</param> /// <returns></returns> /// ------------------------------------------------------------------------------------ private DummyDraftView CreateDummyDraftView(bool fForBT, bool fMakeRoot) { DummyDraftView draftView = new DummyDraftView(Cache, fForBT, Handle.ToInt32()); draftView.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; int c = draftView.BookFilter.BookCount; // make sure the book filter gets created now. draftView.Dock = DockStyle.Fill; draftView.Name = "draftView"; draftView.StyleSheet = StyleSheet; if (m_rootb != null) draftView.RootBox = m_rootb; if (fMakeRoot) { draftView.MakeRoot(); draftView.Visible = true; draftView.ActivateView(); } draftView.TeEditingHelper.InTestMode = true; // turn off some processing for tests return draftView; }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_styleSheet = new DynamicMock(typeof(FwStyleSheet)); m_styleSheet.Strict = true; m_draftView = new DummyDraftView(Cache, false, 0); m_draftView.RootBox = SetupRootBox(); m_draftView.Graphics = SetupGraphics(); m_draftView.MakeRoot(); m_draftView.StyleSheet = (FwStyleSheet)m_styleSheet.MockInstance; m_draftView.ActivateView(); m_draftView.TeEditingHelper.InTestMode = true; m_rootBox.Strict = true; // Set up a default selection helper. Tests may choose to create a different one. m_selHelper = new DynamicMock(typeof(SelectionHelper)); m_selHelper.Strict = true; m_selHelper.SetupResult("NumberOfLevels", 4); SelectionHelper.s_mockedSelectionHelper = (SelectionHelper)m_selHelper.MockInstance; SelLevInfo[] selLevInfo = new SelLevInfo[4]; selLevInfo[3].tag = m_draftView.BookFilter.Tag; selLevInfo[2].tag = (int)ScrBook.ScrBookTags.kflidSections; selLevInfo[2].ihvo = 0; selLevInfo[0].ihvo = 0; selLevInfo[0].tag = (int)StText.StTextTags.kflidParagraphs; m_selHelper.SetupResult("LevelInfo", selLevInfo); m_selHelper.SetupResult("GetLevelInfo", selLevInfo, new Type[] { typeof(SelectionHelper.SelLimitType) }); }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_styleSheet = new DynamicMock(typeof(FwStyleSheet)); m_styleSheet.Strict = true; InitializeVwSelection(m_selHelper); m_btView = new DummyDraftView(Cache, true, 0); m_btView.RootBox = SetupRootBox(); m_btView.Graphics = SetupGraphics(); m_btView.MakeRoot(); m_btView.StyleSheet = (FwStyleSheet)m_styleSheet.MockInstance; m_btView.ActivateView(); m_btView.TeEditingHelper.InTestMode = true; m_rootBox.Strict = true; }