Beispiel #1
0
        public void PrepareRowFixupMap()
        {
            var styles = new AssembledStyles();
            var row    = new FixedSizeRow(styles, new FixedColumnWidths(new[] { 12 }), 27, 37);
            var root   = new FixedSizeRoot(styles, 49, 59);
            var block  = new BlockBox(styles, Color.Red, 6000, 8000);

            row.AddBox(block);
            root.AddBox(row);
            row.Left   = 5;
            row.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[row];
            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);
        }
Beispiel #2
0
		public void PrepareRowFixupMap()
		{
			var styles = new AssembledStyles();
			var row = new FixedSizeRow(styles, new FixedColumnWidths(new[]{12}), 27, 37);
			var root = new FixedSizeRoot(styles, 49, 59);
			var block = new BlockBox(styles, Color.Red, 6000, 8000);
			row.AddBox(block);
			root.AddBox(row);
			row.Left = 5;
			row.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[row];
			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);
		}