Inheritance: SIL.FieldWorks.Test.TestUtils.BaseTest
Beispiel #1
0
        private void VerifyRangeSegmentDrawing(ParaBox para, StringBox stringBox, RangeSelection range, int top, int ydTop, int bottom)
        {
            var seg = stringBox.Segment as FakeSegment;

            Assert.AreEqual(stringBox.IchMin, seg.LastDrawRangeCall.IchBase);
            Assert.AreEqual(m_gm.VwGraphics, seg.LastDrawRangeCall.Graphics);
            int startPosition = range.Start.StringPosition;

            if (range.Start.Para != stringBox.Container) // If we're painting this string box but it isn't in the start paragraph,
            {
                startPosition = 0;                       // the we paint from the start of it.
            }
            Assert.AreEqual(startPosition, seg.LastDrawRangeCall.IchMin);
            var endPosition = range.End.StringPosition;

            if (range.End.Para != stringBox.Container)                                 // If we're painting this string box but it isn't in the end paragraph,
            {
                endPosition = ((ParaBox)stringBox.Container).Source.RenderText.Length; // then we paint to the end of the paragraph.
            }
            Assert.AreEqual(endPosition, seg.LastDrawRangeCall.IchLim);
            ParaTests.VerifySimpleRect(seg.LastDrawRangeCall.RcSrc, -2, top, 96, 96);
            ParaTests.VerifySimpleRect(seg.LastDrawRangeCall.RcDst, 0, 0, 96, 96);
            Assert.AreEqual(ydTop, seg.LastDrawRangeCall.YdTop);
            Assert.AreEqual(bottom, seg.LastDrawRangeCall.YdBottom);
            Assert.AreEqual(seg.LastDrawRangeCall.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, seg.LastDrawRangeCall.IsLastLineOfSelection);
        }
Beispiel #2
0
 private void VerifySelLocation(ParaBox para, StringBox third, MockSegment.PositionsOfIpArgs positionsOfIpArgs, int top)
 {
     Assert.AreEqual(third.IchMin, positionsOfIpArgs.IchBase);
     Assert.AreEqual(m_gm.VwGraphics, positionsOfIpArgs.Graphics);
     Assert.AreEqual(true, positionsOfIpArgs.AssocPrev, "assoc prev should match IP");
     ParaTests.VerifySimpleRect(positionsOfIpArgs.RcSrc, -2, top, 96, 100);
     ParaTests.VerifySimpleRect(positionsOfIpArgs.RcDst, 0, 10, 120, 128);
     Assert.AreEqual(positionsOfIpArgs.Ich, para.Source.Length);
     Assert.AreEqual(positionsOfIpArgs.DrawMode, LgIPDrawMode.kdmNormal, "all drawing modes normal till we test BIDI with Graphite");
 }
Beispiel #3
0
 private void VerifySegmentDrawing(ParaBox para, StringBox third, MockSegment.DrawInsertionPointArgs drawInsertionPointArgs, int top)
 {
     Assert.AreEqual(third.IchMin, drawInsertionPointArgs.IchBase);
     Assert.AreEqual(m_gm.VwGraphics, drawInsertionPointArgs.Graphics);
     Assert.AreEqual(true, drawInsertionPointArgs.AssocPrev, "assoc prev should match IP");
     ParaTests.VerifySimpleRect(drawInsertionPointArgs.RcSrc, -2, top, 96, 100);
     ParaTests.VerifySimpleRect(drawInsertionPointArgs.RcDst, 0, 10, 120, 128);
     Assert.AreEqual(drawInsertionPointArgs.Ich, para.Source.Length);
     Assert.AreEqual(drawInsertionPointArgs.On, true, "Should currently always pass true to segment drawIP routine");
     Assert.AreEqual(drawInsertionPointArgs.DrawMode, LgIPDrawMode.kdmNormal, "all drawing modes normal till we test BIDI with Graphite");
 }
Beispiel #4
0
 private void VerifyRangeSegmentDrawing(ParaBox para, StringBox stringBox, MockSegment seg, RangeSelection range, int top, int ydTop, int bottom)
 {
     Assert.AreEqual(stringBox.IchMin, seg.LastDrawRangeCall.IchBase);
     Assert.AreEqual(m_gm.VwGraphics, seg.LastDrawRangeCall.Graphics);
     Assert.AreEqual(range.Start.StringPosition, seg.LastDrawRangeCall.IchMin);
     Assert.AreEqual(range.End.StringPosition, seg.LastDrawRangeCall.IchLim);
     ParaTests.VerifySimpleRect(seg.LastDrawRangeCall.RcSrc, -2, top, 96, 100);
     ParaTests.VerifySimpleRect(seg.LastDrawRangeCall.RcDst, 0, -10, 120, 128);
     Assert.AreEqual(ydTop, seg.LastDrawRangeCall.YdTop);
     Assert.AreEqual(bottom, seg.LastDrawRangeCall.YdBottom);
     Assert.AreEqual(seg.LastDrawRangeCall.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, seg.LastDrawRangeCall.IsLastLineOfSelection);
 }
Beispiel #5
0
 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);
 }