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

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

            SimulateHyperlinkFollowedByPlainText(selHelper, IchPosition.StartOfString,
                                                 IchPosition.EndOfString);

            using (FwEditingHelper editingHelper = new FwEditingHelper(Cache, m_callbacks))
            {
                editingHelper.OnKeyPress(new KeyPressEventArgs('b'), 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 TypingBeforeHyperlink_WithPrecedingItalicsText()
        {
            var selection = MakeMockSelection(false);
            var selHelper = SelectionHelper.s_mockedSelectionHelper =
                MockRepository.GenerateStub <SelectionHelper>();

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

            ITsPropsBldr bldr = m_ttpNormal.GetBldr();

            bldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Italics");
            SimulateTextFollowedByHyperlink(selHelper, bldr.GetTextProps(),
                                            IchPosition.StartOfHyperlink, IchPosition.StartOfHyperlink);

            using (FwEditingHelper editingHelper = new FwEditingHelper(Cache, m_callbacks))
            {
                editingHelper.OnKeyPress(new KeyPressEventArgs('b'), Keys.None);

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

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

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

            using (FwEditingHelper editingHelper = new FwEditingHelper(Cache, m_callbacks))
            {
                editingHelper.OnKeyPress(new KeyPressEventArgs('b'), Keys.None);

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

			SimulateHyperlinkFollowedByPlainText(selHelper, IchPosition.StartOfString,
				IchPosition.EndOfString);

			using (FwEditingHelper editingHelper = new FwEditingHelper(Cache, m_callbacks))
			{
				editingHelper.OnKeyPress(new KeyPressEventArgs('b'), 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));
			}
		}
		public void TypingBeforeHyperlink_WithPrecedingItalicsText()
		{
			var selection = MakeMockSelection(false);
			var selHelper = SelectionHelper.s_mockedSelectionHelper =
				MockRepository.GenerateStub<SelectionHelper>();
			selHelper.Stub(selH => selH.Selection).Return(selection);

			ITsPropsBldr bldr = m_ttpNormal.GetBldr();
			bldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Italics");
			SimulateTextFollowedByHyperlink(selHelper, bldr.GetTextProps(),
				IchPosition.StartOfHyperlink, IchPosition.StartOfHyperlink);

			using (FwEditingHelper editingHelper = new FwEditingHelper(Cache, m_callbacks))
			{
				editingHelper.OnKeyPress(new KeyPressEventArgs('b'), Keys.None);

				IList<object[]> argsSentToSetTypingProps =
					selection.GetArgumentsForCallsMadeOn(sel => sel.SetTypingProps(null));
				Assert.AreEqual(1, argsSentToSetTypingProps.Count);
				ITsTextProps ttpSentToSetTypingProps = (ITsTextProps)argsSentToSetTypingProps[0][0];
				Assert.AreEqual(1, ttpSentToSetTypingProps.StrPropCount);
				Assert.AreEqual(1, ttpSentToSetTypingProps.IntPropCount);
				int nVar;
				Assert.AreEqual("Italics", ttpSentToSetTypingProps.GetStrPropValue((int)FwTextPropType.ktptNamedStyle));
				Assert.AreEqual(911, ttpSentToSetTypingProps.GetIntPropValues((int)FwTextPropType.ktptWs, out nVar));
			}
		}
		public void OverTypingHyperlink_LinkButNotFollowingText()
		{
			var selection = MakeMockSelection();
			var selHelper = SelectionHelper.s_mockedSelectionHelper =
				MockRepository.GenerateStub<SelectionHelper>();
			selHelper.Stub(selH => selH.Selection).Return(selection);

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

			using (FwEditingHelper editingHelper = new FwEditingHelper(Cache, m_callbacks))
			{
				editingHelper.OnKeyPress(new KeyPressEventArgs('b'), Keys.None);

	//			selection.AssertWasNotCalled(sel => sel.SetTypingProps(null));
				IList<object[]> argsSentToSetTypingProps =
					selection.GetArgumentsForCallsMadeOn(sel => sel.SetTypingProps(null));
				Assert.AreEqual(0, argsSentToSetTypingProps.Count);
			}
		}