Example #1
0
        public void PrepareDivFixupMap()
        {
            var styles = new AssembledStyles();
            var div    = new FixedSizeDiv(styles, 27, 37);
            var root   = new FixedSizeRoot(styles, 49, 59);
            var block  = new BlockBox(styles, Color.Red, 6000, 8000);

            div.AddBox(block);
            root.AddBox(div);
            div.Left   = 5;
            div.Top    = 7;
            block.Left = 10;
            block.Top  = 20;
            var transform = new LayoutInfo(0, 0, 72, 72, 1000, m_gm.VwGraphics, new MockRendererFactory());

            block.Layout(transform);
            //Assert.AreEqual(6, block.Width); // sanity check: we made it 4000 mp wide at 72 dpi, that's 4 points at one point per dot
            var map         = block.PrepareFixupMap();
            var invalidRect = map[block];

            Assert.AreEqual(new Rectangle(5 + 10 - 2, 7 + 20 - 2, 6 + 4, 8 + 4), invalidRect);
            invalidRect = map[div];
            Assert.AreEqual(new Rectangle(5 - 2, 7 - 2, 27 + 4, 37 + 4), invalidRect);
            invalidRect = map[root];
            Assert.AreEqual(new Rectangle(-2, -2, 49 + 4, 59 + 4), invalidRect);
        }
Example #2
0
		public void PrepareDivFixupMap()
		{
			var styles = new AssembledStyles();
			var div = new FixedSizeDiv(styles, 27, 37);
			var root = new FixedSizeRoot(styles, 49, 59);
			var block = new BlockBox(styles, Color.Red, 6000, 8000);
			div.AddBox(block);
			root.AddBox(div);
			div.Left = 5;
			div.Top = 7;
			block.Left = 10;
			block.Top = 20;
			var transform = new LayoutInfo(0, 0, 72, 72, 1000, m_gm.VwGraphics, new MockRendererFactory());
			block.Layout(transform);
			//Assert.AreEqual(6, block.Width); // sanity check: we made it 4000 mp wide at 72 dpi, that's 4 points at one point per dot
			var map = block.PrepareFixupMap();
			var invalidRect = map[block];
			Assert.AreEqual(new Rectangle(5 + 10 - 2, 7 + 20 - 2, 6 + 4, 8 + 4), invalidRect);
			invalidRect = map[div];
			Assert.AreEqual(new Rectangle(5 - 2, 7 - 2, 27 + 4, 37 + 4), invalidRect);
			invalidRect = map[root];
			Assert.AreEqual(new Rectangle(- 2, - 2, 49 + 4, 59 + 4), invalidRect);
		}