private void VerifyRangeDrawingArgs(MockSegment.DrawRangeArgs args, StringBox stringBox, int ichMin, int ichLim, int top, int ydTop, int bottom) { Assert.AreEqual(stringBox.IchMin, args.IchBase); Assert.AreEqual(m_gm.VwGraphics, args.Graphics); Assert.That(args.IchMin, Is.EqualTo(ichMin)); Assert.That(args.IchLim, Is.EqualTo(ichLim)); ParaTests.VerifySimpleRect(args.RcSrc, -2, top, 96, 96); ParaTests.VerifySimpleRect(args.RcDst, 0, -10, 96, 96); Assert.AreEqual(ydTop, args.YdTop); Assert.AreEqual(bottom, args.YdBottom); Assert.AreEqual(args.On, true, "Should currently always pass true to segment drawRange On argument"); // The old Views code appears to always pass true for this argument, so we should too, until I figure out what it's // really supposed to be, if anything. Assert.AreEqual(true, args.IsLastLineOfSelection); }
public Rect DrawRange(int ichBase, IVwGraphics _vg, Rect rcSrc, Rect rcDst, int ichMin, int ichLim, int ydTop, int ydBottom, bool bOn, bool fIsLastLineOfSelection) { LastDrawRangeCall = new MockSegment.DrawRangeArgs { IchBase = ichBase, Graphics = _vg, RcSrc = rcSrc, RcDst = rcDst, IchMin = ichMin, IchLim = ichLim, YdTop = ydTop, YdBottom = ydBottom, On = bOn, IsLastLineOfSelection = fIsLastLineOfSelection }; // Enhance JohnT: figure sensible value for left and right if testing requires it. return(new Rect(0, ydTop, 0, ydBottom)); }
public bool PositionOfRange(int ichBase, IVwGraphics _vg, Rect rcSrc, Rect rcDst, int ichMin, int ichLim, int ydTop, int ydBottom, bool fIsLastLineOfSelection, out Rect rsBounds) { LastPositionOfRangeArgs = new MockSegment.DrawRangeArgs { IchBase = ichBase, Graphics = _vg, RcSrc = rcSrc, RcDst = rcDst, IchMin = ichMin, IchLim = ichLim, YdTop = ydTop, YdBottom = ydBottom, On = true, // meaningless here, but it is always passed true to Draw, so some verification stuff checks that. IsLastLineOfSelection = fIsLastLineOfSelection }; rsBounds = new Rect(0, 0, 0, 0); // default if (ichLim <= ichBase || ichMin >= ichBase + Length) { return(false); } rsBounds = new Rect(LeftPositionOfRangeResult, ydTop, RightPositionOfRangeResult, ydBottom); return(true); }