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); }
public void MakeBlockBox() { AssembledStyles styles = new AssembledStyles(); BlockBox box = new BlockBox(styles, Color.Red, 72000, 36000); LayoutInfo transform = MakeLayoutInfo(); box.Layout(transform); Assert.AreEqual(48, box.Height); Assert.AreEqual(96, box.Width); }
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); }