示例#1
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");
 }
示例#2
0
 public void PositionsOfIP(int ichBase, IVwGraphics _vg, Rect rcSrc, Rect rcDst, int ich, bool fAssocPrev, LgIPDrawMode dm,
                           out Rect rectPrimary, out Rect rectSecondary, out bool fPrimaryHere, out bool fSecHere)
 {
     LastPosIpCall           = new MockSegment.PositionsOfIpArgs();
     LastPosIpCall.IchBase   = ichBase;
     LastPosIpCall.Graphics  = _vg;
     LastPosIpCall.RcSrc     = rcSrc;
     LastPosIpCall.RcDst     = rcDst;
     LastPosIpCall.Ich       = ich;
     LastPosIpCall.AssocPrev = fAssocPrev;
     LastPosIpCall.DrawMode  = dm;
     if (NextPosIpResult != null)
     {
         rectPrimary   = NextPosIpResult.RectPrimary;
         rectSecondary = new Rect();       // NextPosIpResult.RectSecondary;
         fPrimaryHere  = NextPosIpResult.PrimaryHere;
         fSecHere      = false;            // NextPosIpResult.SecHere;
     }
     else
     {
         rectPrimary   = new Rect(0, 0, 0, 0);
         rectSecondary = new Rect(0, 0, 0, 0);
         fSecHere      = false;
         if (ich < ichBase || ich > ichBase + Length)
         {
             fPrimaryHere = false;
             return;
         }
         fPrimaryHere = true;                 // useful result when we don't care to prepare for this call.
         int width = 0;
         for (int i = 0; i < ich - ichBase; i++)
         {
             width += FakeRenderEngine.CharWidth(Text[i]);
         }
         rectPrimary = PaintTransform.ConvertToPaint(new Rect(width - 1, 0, width + 1, Height),
                                                     rcSrc, rcDst);
     }
 }