示例#1
0
        public void DrawIPMultiRunPara()
        {
            var     styles = new AssembledStyles();
            RootBox root   = new RootBoxFdo(styles);

            root.Builder.Show(Paragraph.Containing(
                                  Display.Of("first"), Display.Of("second"), Display.Of("third")));
            SetupFakeRootSite(root);
            var layoutInfo = HookupTests.MakeLayoutInfo(int.MaxValue / 2, m_gm.VwGraphics, 55);

            root.Layout(layoutInfo);
            InsertionPoint ip = root.SelectAtEnd();

            ip.Install();
            var para = (ParaBox)root.FirstBox;

            Assert.AreEqual(ip, root.Selection);
            Assert.AreEqual(para, ip.Para, "IP should know about the paragraph it is in");
            Assert.AreEqual("third".Length, ip.StringPosition, "IP position is relative to run");
            Assert.AreEqual(true, ip.AssociatePrevious, "selection at end should always associate previous in non-empty para");


            StringBox sbox = para.FirstBox as StringBox;

            Assert.That(sbox, Is.EqualTo(para.LastBox), "uniform text in infinite width should make one string box");
            var seg = sbox.Segment as FakeSegment;

            Assert.IsNotNull(seg);
            PaintTransform ptrans = new PaintTransform(2, 4, 96, 100, 0, -10, 120, 128);

            ip.Draw(m_gm.VwGraphics, ptrans);
            VerifySegmentDrawing(para, sbox, seg.LastDrawIpCall, -4);

            seg.NextPosIpResult             = new MockSegment.PositionsOfIpResults();
            seg.NextPosIpResult.RectPrimary = new Rect(5, 6, 7, 9);
            seg.NextPosIpResult.PrimaryHere = true;
            Rectangle selRect = ip.GetSelectionLocation(m_gm.VwGraphics, ptrans);

            VerifySelLocation(para, sbox, seg.LastPosIpCall, -4);
            Assert.AreEqual(new Rectangle(5, 6, 2, 3), selRect);
        }
示例#2
0
		public void DrawIPMultiRunPara()
		{
			var styles = new AssembledStyles();
			RootBox root = new RootBoxFdo(styles);
			root.Builder.Show(Paragraph.Containing(
				Display.Of("first"), Display.Of("second"), Display.Of("third")));
			SetupFakeRootSite(root);
			var layoutInfo = HookupTests.MakeLayoutInfo(int.MaxValue / 2, m_gm.VwGraphics, 55);
			root.Layout(layoutInfo);
			InsertionPoint ip = root.SelectAtEnd();
			ip.Install();
			var para = (ParaBox) root.FirstBox;
			Assert.AreEqual(ip, root.Selection);
			Assert.AreEqual(para, ip.Para, "IP should know about the paragraph it is in");
			Assert.AreEqual("third".Length, ip.StringPosition, "IP position is relative to run");
			Assert.AreEqual(true, ip.AssociatePrevious, "selection at end should always associate previous in non-empty para");


			StringBox sbox = para.FirstBox as StringBox;
			Assert.That(sbox, Is.EqualTo(para.LastBox), "uniform text in infinite width should make one string box");
			var seg = sbox.Segment as FakeSegment;
			Assert.IsNotNull(seg);
			PaintTransform ptrans = new PaintTransform(2, 4, 96, 100, 0, -10, 120, 128);
			ip.Draw(m_gm.VwGraphics, ptrans);
			VerifySegmentDrawing(para, sbox, seg.LastDrawIpCall, -4);

			seg.NextPosIpResult = new MockSegment.PositionsOfIpResults();
			seg.NextPosIpResult.RectPrimary = new Rect(5, 6, 7, 9);
			seg.NextPosIpResult.PrimaryHere = true;
			Rectangle selRect = ip.GetSelectionLocation(m_gm.VwGraphics, ptrans);
			VerifySelLocation(para, sbox, seg.LastPosIpCall, -4);
			Assert.AreEqual(new Rectangle(5, 6, 2, 3), selRect);
		}