示例#1
0
        public void DeletingHyperlink_LinkButNotPrecedingText()
        {
            var selection = MakeMockSelection();
            var selHelper = SelectionHelper.s_mockedSelectionHelper =
                MockRepository.GenerateStub <SelectionHelper>();

            selHelper.Stub(selH => selH.Selection).Return(selection);

            SimulatePlainTextFollowedByHyperlink(selHelper, IchPosition.StartOfHyperlink,
                                                 IchPosition.EndOfHyperlink);

            using (FwEditingHelper editingHelper = new FwEditingHelper(Cache, m_callbacks))
            {
                editingHelper.HandleKeyPress((char)(int)VwSpecialChars.kscDelForward, Keys.None);

                IList <object[]> argsSentToSetTypingProps =
                    selection.GetArgumentsForCallsMadeOn(sel => sel.SetTypingProps(null));
                Assert.AreEqual(1, argsSentToSetTypingProps.Count);
                ITsTextProps ttpSentToSetTypingProps = (ITsTextProps)argsSentToSetTypingProps[0][0];
                Assert.AreEqual(0, ttpSentToSetTypingProps.StrPropCount);
                Assert.AreEqual(1, ttpSentToSetTypingProps.IntPropCount);
                int nVar;
                Assert.AreEqual(911, ttpSentToSetTypingProps.GetIntPropValues((int)FwTextPropType.ktptWs, out nVar));
            }
        }
示例#2
0
        public void DeletingMiddleOfHyperlink()
        {
            var selection = MakeMockSelection();
            var selHelper = SelectionHelper.s_mockedSelectionHelper =
                MockRepository.GenerateStub <SelectionHelper>();

            selHelper.Stub(selH => selH.Selection).Return(selection);

            SimulateHyperlinkOnly(selHelper, IchPosition.EarlyInHyperlink,
                                  IchPosition.LateInHyperlink);

            using (FwEditingHelper editingHelper = new FwEditingHelper(Cache, m_callbacks))
            {
                editingHelper.HandleKeyPress((char)(int)VwSpecialChars.kscDelForward, Keys.None);

                //			selection.AssertWasNotCalled(sel => sel.SetTypingProps(null));
                IList <object[]> argsSentToSetTypingProps =
                    selection.GetArgumentsForCallsMadeOn(sel => sel.SetTypingProps(null));
                Assert.AreEqual(0, argsSentToSetTypingProps.Count);
            }
        }
		public void DeletingMiddleOfHyperlink()
		{
			var selection = MakeMockSelection();
			var selHelper = SelectionHelper.s_mockedSelectionHelper =
				MockRepository.GenerateStub<SelectionHelper>();
			selHelper.Stub(selH => selH.Selection).Return(selection);

			SimulateHyperlinkOnly(selHelper, IchPosition.EarlyInHyperlink,
				IchPosition.LateInHyperlink);

			using (FwEditingHelper editingHelper = new FwEditingHelper(Cache, m_callbacks))
			{
				editingHelper.HandleKeyPress((char)(int)VwSpecialChars.kscDelForward, Keys.None);

	//			selection.AssertWasNotCalled(sel => sel.SetTypingProps(null));
				IList<object[]> argsSentToSetTypingProps =
					selection.GetArgumentsForCallsMadeOn(sel => sel.SetTypingProps(null));
				Assert.AreEqual(0, argsSentToSetTypingProps.Count);
			}
		}
		public void DeletingHyperlink_LinkButNotPrecedingText()
		{
			var selection = MakeMockSelection();
			var selHelper = SelectionHelper.s_mockedSelectionHelper =
				MockRepository.GenerateStub<SelectionHelper>();
			selHelper.Stub(selH => selH.Selection).Return(selection);

			SimulatePlainTextFollowedByHyperlink(selHelper, IchPosition.StartOfHyperlink,
				IchPosition.EndOfHyperlink);

			using (FwEditingHelper editingHelper = new FwEditingHelper(Cache, m_callbacks))
			{
				editingHelper.HandleKeyPress((char)(int)VwSpecialChars.kscDelForward, Keys.None);

				IList<object[]> argsSentToSetTypingProps =
					selection.GetArgumentsForCallsMadeOn(sel => sel.SetTypingProps(null));
				Assert.AreEqual(1, argsSentToSetTypingProps.Count);
				ITsTextProps ttpSentToSetTypingProps = (ITsTextProps)argsSentToSetTypingProps[0][0];
				Assert.AreEqual(0, ttpSentToSetTypingProps.StrPropCount);
				Assert.AreEqual(1, ttpSentToSetTypingProps.IntPropCount);
				int nVar;
				Assert.AreEqual(911, ttpSentToSetTypingProps.GetIntPropValues((int)FwTextPropType.ktptWs, out nVar));
			}
		}