示例#1
0
        public void VerifyParagraphStyleApplied()
        {
            CheckDisposed();
            // ENHANCE (EberhardB): This test could be in unit tests. But right now we don't
            // have a view that has styles associated with it.
            DummyDraftView draftView = m_draftForm.DraftView;
            IVwRootBox     rootBox   = draftView.RootBox;

            // 1. Test: IP at end of text
            rootBox.MakeSimpleSel(false, true, false, true);             // set IP at end of text
            IVwSelection sel;

            ITsTextProps[]     vttp;
            IVwPropertyStore[] vvps;
            int hvoText, tagText, ihvoFirst, ihvoLast;

            draftView.GetParagraphProps(out sel, out hvoText, out tagText, out vvps,
                                        out ihvoFirst, out ihvoLast, out vttp);
            Assert.AreEqual(1, vttp.Length);
            if (vttp[0] != null)             // null is a valid value, so don't check that
            {
                string oldStyle = vttp[0].GetStrPropValue((int)VwStyleProperty.kspNamedStyle);
                Assert.IsFalse(oldStyle == "Quote", "Database not in expected state.");
            }

            draftView.EditingHelper.ApplyParagraphStyle("Quote");

            draftView.GetParagraphProps(out sel, out hvoText, out tagText, out vvps,
                                        out ihvoFirst, out ihvoLast, out vttp);
            Assert.AreEqual(1, vttp.Length);
            string newStyle = vttp[0].GetStrPropValue((int)VwStyleProperty.kspNamedStyle);

            Assert.AreEqual("Quote", newStyle, "The style was not applied correctly.");

//			This doesn't work at the moment, so no test for that right now.
//
//			// 2. Test: selection across multiple sections
//			SelectionHelper selAnchor = draftView.SelectRangeOfChars(2, 3, 4, 0, 0);
//			SelectionHelper selEnd = draftView.SelectRangeOfChars(2, 5, 0, 114, 114);
//			IVwSelection vwSel = draftView.RootBox.MakeRangeSelection(selAnchor.Selection,
//				selEnd.Selection, true);
        }
示例#2
0
        public void BackspaceInNewParagraphBug()
        {
            CheckDisposed();
            // Set IP at the beginning of a paragraph (the one containing Philemon 1:17).
            // Then press backspace. This should merge the last paragraph with the one before,
            // so the IP should no longer be at the beginning of the paragraph.
            DummyDraftView draftView = m_draftForm.DraftView;

            draftView.GotoVerse(new ScrReference(57, 1, 17, Paratext.ScrVers.English));
            SelectionHelper selHelper =
                SelectionHelper.GetSelectionInfo(null, draftView);

            selHelper.IchAnchor = selHelper.IchEnd = 0;
            IVwSelection vwsel = selHelper.SetSelection(draftView);

            draftView.HandleKeyPress('\b', false);
            selHelper = SelectionHelper.GetSelectionInfo(null, draftView);
            Assert.IsFalse(selHelper.IchAnchor == 0);
            Assert.IsFalse(selHelper.IchEnd == 0);
        }
示例#3
0
        public void ScrollPage()
        {
            CheckDisposed();
            m_draftForm.Focus();

            // Make sure we're somewhere in the view where paging down will actually move the
            // IP somewhere other than where it is before paging down. In other words, the
            // first test below will fail if the view is opened and the IP restored to at or
            // near the bottom of the view, in which case paging down will do nothing. Hence
            // this call to move the IP to the top... ramble, ramble, ramble.
            m_draftForm.ScrollToTop();
            int ydCurr = m_draftForm.YPosition;

            // scroll one page down
            DummyDraftView draftView = m_draftForm.DraftView;

            draftView.CallRootSiteOnKeyDown(new KeyEventArgs(Keys.PageDown));

            int ydCurr2 = m_draftForm.YPosition;

            Assert.IsFalse(ydCurr2 == ydCurr,
                           "Position after Page down should be different from before");

            Assert.IsTrue(m_draftForm.IsSelectionVisible(), "IP should be visible");

            m_draftForm.ScrollToEnd();
            ydCurr = m_draftForm.YPosition;

            // scroll one page up
            draftView.CallRootSiteOnKeyDown(new KeyEventArgs(Keys.PageUp));

            ydCurr2 = m_draftForm.YPosition;
            Assert.IsFalse(ydCurr2 == ydCurr,
                           "Position after Page up should be different from before");
            Assert.IsTrue(m_draftForm.IsSelectionVisible(), "IP should be visible");
        }
		public override void Exit()
		{
			CheckDisposed();

			m_draftView = null;
			m_draftForm.Close();
			m_draftForm = null;

			base.Exit();
		}
		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			m_draftForm = new DummyDraftViewForm();
			m_draftForm.DeleteRegistryKey();
			m_draftForm.CreateDraftView(Cache);
			m_draftView = m_draftForm.DraftView;
			m_draftView.Width = 300;
			m_draftView.Height = 290;
			m_draftView.CallOnLayout();
		}
		public override void Exit()
		{
			CheckDisposed();

			m_draftView.Dispose();
			m_draftView = null;
			m_rootBox = null;
			m_styleSheet = null;
			m_vwGraphics = null;

			base.Exit();
		}
		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			// Save value of user prompt setting - restored in Cleanup.
			m_saveShowPrompts = Options.ShowEmptyParagraphPromptsSetting;
			Options.ShowEmptyParagraphPromptsSetting = false;

			m_draftForm = new DummyDraftViewForm();
			m_draftForm.DeleteRegistryKey();
			m_draftForm.CreateDraftView(Cache);
			m_IgnorePropChanged = new IgnorePropChanged(Cache,
				PropChangedHandling.SuppressChangeWatcher);

			//Application.DoEvents();
			//m_draftForm.Show();
			m_draftView = m_draftForm.DraftView;
			m_draftView.TeEditingHelper.InTestMode = true;
			m_scr.RestartFootnoteSequence = true;
			m_draftView.RootBox.MakeSimpleSel(true, true, false, true);

			Application.DoEvents();
		}
		public override void TestTearDown()
		{
			base.TestTearDown();

			m_styleSheet = null;
			m_rootBox = null;
			var disposable = m_btView.Graphics as IDisposable;
			if (disposable != null)
				disposable.Dispose();
			m_btView.Dispose();
			m_btView = null;
			m_vwGraphics = null;
			m_sel = null;
		}
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected override void Dispose(bool disposing)
		{
			Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
				if (m_btView != null)
					m_btView.Dispose();
				if (m_inMemoryCache != null)
					m_inMemoryCache.Dispose();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_btView = null; // mimick back translation view using DummyDraftView
			m_scripture = null; //m_scripture = null; // Why not set it to null?
			m_inMemoryCache = null;
			m_styleSheet = null; // m_styleSheet = null; // Why not set it to null?
			m_rootBox = null;
			m_vwGraphics = null;
			m_selHelper = null;
			m_sel = null;
			m_PropInfoArgs = null;
			m_PropInfoTypes = null;
			m_TextSelInfoArgs = null;
			m_TextSelInfoTypes = null;
			m_LocationArgs = null;
			m_LocationTypes = null;
			m_AllSelEndInfoArgs = null;
			m_AllSelEndInfoTypes = null;

			base.Dispose(disposing);
		}
示例#10
0
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
				if (m_draftForm != null)
					m_draftForm.Dispose();
				if (m_IgnorePropChanged != null)
					m_IgnorePropChanged.Dispose();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_draftForm = null;
			m_draftView = null; // Comes from m_draftForm, which is to dispose it.
			m_group = null;
			m_IgnorePropChanged = null;

			base.Dispose(disposing);
		}
示例#11
0
		public override void Exit()
		{
			CheckDisposed();

			m_draftView = null;
			m_draftForm.Close();
			m_draftForm = null;
			m_group = null;
			m_IgnorePropChanged.Dispose();
			m_IgnorePropChanged = null;

			// Restore prompt setting
			m_IgnorePropChanged.Dispose();
			base.Exit();
		}
示例#12
0
		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			m_draftForm = new DummyDraftViewForm();
			m_draftForm.DeleteRegistryKey();
			m_group = m_draftForm.CreateSyncDraftView(Cache);
			m_IgnorePropChanged = new IgnorePropChanged(Cache,
				PropChangedHandling.SuppressChangeWatcher);

			m_draftView = m_draftForm.DraftView;
			m_draftView.RootBox.MakeSimpleSel(true, true, false, true);

			Application.DoEvents();
		}
		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 Exit()
		{
			CheckDisposed();

			m_draftView = null;
			m_draftForm.Close(); // Should dispose it.
			m_draftForm = null;

			// Restore prompt setting
			Options.ShowEmptyParagraphPromptsSetting = m_saveShowPrompts;
			m_IgnorePropChanged.Dispose();
			m_IgnorePropChanged = null;
			m_book = null;

			base.Exit();
		}
		/// -------------------------------------------------------------------------------------
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		/// -------------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)

			{
				// Dispose managed resources here.
				if (m_draftForm != null)
					m_draftForm.Dispose();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_draftView = null;
			m_draftForm = null;
			m_exodus = null;

			base.Dispose(disposing);
		}
		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");
		}
		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;
		}
示例#18
0
        public void HardLineBreak()
        {
            CheckDisposed();
            // Set IP in the middle of the second Scripture section head in James.
            // Then press Shift-Enter. This should put a hard line break in the middle of this
            // section head and the IP should be at the beginning of the second line.
            DummyDraftView draftView = m_draftForm.DraftView;

            draftView.RootBox.Activate(VwSelectionState.vssEnabled);
            draftView.SetInsertionPoint((int)ScrSection.ScrSectionTags.kflidHeading, 1, 4);
            KeyEventArgs e = new KeyEventArgs(Keys.Right);

            draftView.CallRootSiteOnKeyDown(e);
            draftView.CallRootSiteOnKeyDown(e);
            draftView.CallRootSiteOnKeyDown(e);
            draftView.CallRootSiteOnKeyDown(e);
            draftView.CallRootSiteOnKeyDown(e);
            draftView.CallRootSiteOnKeyDown(e);
            draftView.CallRootSiteOnKeyDown(e);
            // We should be between the 'a' and 'n' of the word "and" in the section head
            // containing "Faith and Wisdom".
            SelectionHelper selHelper = SelectionHelper.Create(draftView);

            Assert.AreEqual(4, selHelper.NumberOfLevels);
            Assert.AreEqual((int)ScrSection.ScrSectionTags.kflidHeading,
                            selHelper.LevelInfo[1].tag);
            int ihvoPara = selHelper.LevelInfo[0].ihvo;

            Assert.AreEqual(7, selHelper.IchAnchor);
            Assert.AreEqual(selHelper.IchAnchor, selHelper.IchEnd);

            // Now send the Shift-Enter
            draftView.CallRootSiteOnKeyDown(new KeyEventArgs(Keys.Shift | Keys.Enter));

            // We should have split the line between the 'a' and 'n' of the word "and".
            selHelper = SelectionHelper.Create(draftView);
            Assert.AreEqual(4, selHelper.NumberOfLevels);
            Assert.AreEqual((int)ScrSection.ScrSectionTags.kflidHeading,
                            selHelper.LevelInfo[1].tag);
            // Make sure we're still in the same para
            Assert.AreEqual(ihvoPara, selHelper.LevelInfo[0].ihvo);
            Assert.AreEqual(8, selHelper.IchAnchor);
            Assert.AreEqual(selHelper.IchAnchor, selHelper.IchEnd);

            // To make sure we're on the next line down, send an up-arrow
            draftView.CallRootSiteOnKeyDown(new KeyEventArgs(Keys.Up));

            // We should be at the beginning of the section head.
            selHelper = SelectionHelper.Create(draftView);
            Assert.AreEqual(4, selHelper.NumberOfLevels);
            Assert.AreEqual((int)ScrSection.ScrSectionTags.kflidHeading,
                            selHelper.LevelInfo[1].tag);
            // Make sure we're still in the same para
            Assert.AreEqual(ihvoPara, selHelper.LevelInfo[0].ihvo);
            Assert.AreEqual(0, selHelper.IchAnchor);
            Assert.AreEqual(selHelper.IchAnchor, selHelper.IchEnd);

            // Finally, make sure the hard line break character is in the right place in the
            // string in the data cache.
            Scripture  scr   = new Scripture(m_draftForm.Cache, draftView.HvoScripture);
            ScrBook    james = (ScrBook)scr.ScriptureBooksOS[1];
            ScrSection modifiedScrSection =
                (ScrSection)james.SectionsOS[selHelper.LevelInfo[2].ihvo];

            Assert.AreEqual(1, modifiedScrSection.HeadingOA.ParagraphsOS.Count);
            Assert.AreEqual(0x2028,
                            ((StTxtPara)modifiedScrSection.HeadingOA.ParagraphsOS[0]).Contents.Text[7]);

            // Second test:
            // Set IP at the beginning of the second Scripture section head in James.
            // Then press Shift-Enter. This should put an empty line at the beginning of this
            // section head and the IP should be at the beginning of the second line.
            draftView.SetInsertionPoint((int)ScrSection.ScrSectionTags.kflidHeading, 1, 4);
            selHelper = SelectionHelper.Create(draftView);
            Assert.AreEqual(4, selHelper.NumberOfLevels);
            Assert.AreEqual((int)ScrSection.ScrSectionTags.kflidHeading,
                            selHelper.LevelInfo[1].tag);
            ihvoPara = selHelper.LevelInfo[0].ihvo;
            Assert.AreEqual(0, selHelper.IchAnchor);
            Assert.AreEqual(selHelper.IchAnchor, selHelper.IchEnd);

            // Now send the Shift-Enter
            draftView.CallRootSiteOnKeyDown(new KeyEventArgs(Keys.Shift | Keys.Enter));
            draftView.CallRootSiteOnKeyDown(new KeyEventArgs(Keys.Shift | Keys.Enter));

            // We should have an blank line before Faith and Wisdom.
            selHelper = SelectionHelper.Create(draftView);
            Assert.AreEqual(4, selHelper.NumberOfLevels);
            Assert.AreEqual((int)ScrSection.ScrSectionTags.kflidHeading,
                            selHelper.LevelInfo[1].tag);
            // Make sure we're still in the same para
            Assert.AreEqual(ihvoPara, selHelper.LevelInfo[0].ihvo);
            Assert.AreEqual(2, selHelper.IchAnchor);
            Assert.AreEqual(selHelper.IchAnchor, selHelper.IchEnd);

            // To make sure we're on the next line down, send an up-arrow
            draftView.CallRootSiteOnKeyDown(new KeyEventArgs(Keys.Up));
            draftView.CallRootSiteOnKeyDown(new KeyEventArgs(Keys.Up));

            // We should be at the beginning of the section head containing "Faith and Wisdom".
            selHelper = SelectionHelper.Create(draftView);
            Assert.AreEqual(4, selHelper.NumberOfLevels);
            Assert.AreEqual((int)ScrSection.ScrSectionTags.kflidHeading,
                            selHelper.LevelInfo[1].tag);
            // Make sure we're still in the same para
            Assert.AreEqual(ihvoPara, selHelper.LevelInfo[0].ihvo);
            Assert.AreEqual(0, selHelper.IchAnchor);
            Assert.AreEqual(selHelper.IchAnchor, selHelper.IchEnd);

            // Finally, make sure the hard line break character is in the right place in the
            // string in the data cache.
            scr   = new Scripture(m_draftForm.Cache, draftView.HvoScripture);
            james = (ScrBook)scr.ScriptureBooksOS[1];
            modifiedScrSection =
                (ScrSection)james.SectionsOS[selHelper.LevelInfo[2].ihvo];
            Assert.AreEqual(1, modifiedScrSection.HeadingOA.ParagraphsOS.Count);
            Assert.AreEqual(0x2028,
                            ((StTxtPara)modifiedScrSection.HeadingOA.ParagraphsOS[0]).Contents.Text[0]);
        }
		public void CleanUp()
		{
			CheckDisposed();

			m_btView.Dispose();
			m_btView = null;
			m_inMemoryCache.Dispose();
			m_inMemoryCache = null;
			m_scripture = null;
			m_styleSheet = null;
			m_rootBox = null;
			m_vwGraphics = null;
		}
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
				if (m_draftView != null)
					m_draftView.Dispose();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_draftView = null;
			m_styleSheet = null;
			m_rootBox = null;
			m_vwGraphics = null;
			m_selHelper = null;
			m_PropInfoArgs = null;
			m_PropInfoTypes = null;
			m_TextSelInfoArgsAnchor = null;
			m_TextSelInfoTypes = null;
			m_LocationArgs = null;
			m_LocationTypes = null;
			m_AllSelEndInfoArgs = null;
			m_AllSelEndInfoTypes = null;

			base.Dispose(disposing);
		}
		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 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 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;
		}