public void Relayout() { var styles = new AssembledStyles(); var box = new MockBox(styles); var fixMap = new Dictionary <Box, Rectangle>(); var layoutInfo = ParaBuilderTests.MakeLayoutInfo(100, m_gm.VwGraphics); var site = new MockSite(); var root = new RootBox(styles); root.Site = site; using (var lcb = new LayoutCallbacks(root)) { Assert.IsFalse(box.Relayout(layoutInfo, fixMap, lcb), "Relayout of box never laid out should return false (can't have old loc)"); } Assert.AreEqual(layoutInfo, box.LastLayoutTransform, "Relayout of box never laid out should call Layout() with same transform"); Assert.AreEqual(0, site.RectsInvalidated.Count, "Relayout of box never laid out should not invalidate anything"); box.LastLayoutTransform = null; using (var lcb = new LayoutCallbacks(root)) Assert.IsFalse(box.Relayout(layoutInfo, fixMap, lcb), "Relayout of box not in map should return false"); Assert.IsNull(box.LastLayoutTransform, "Relayout of box not in map should not call Layout()"); Assert.AreEqual(0, site.RectsInvalidated.Count, "Relayout of box not in map should not invalidate anything"); fixMap[box] = new Rectangle(2, 3, 4, 7); using (var lcb = new LayoutCallbacks(root)) Assert.IsTrue(box.Relayout(layoutInfo, fixMap, lcb), "Relayout of box in map should return true"); Assert.AreEqual(layoutInfo, box.LastLayoutTransform, "Relayout of box in map should call Layout() with same transform"); Assert.AreEqual(1, site.RectsInvalidatedInRoot.Count, "Relayout of box in map should invalidate rect from map"); Assert.AreEqual(new Rectangle(2, 3, 4, 7), site.RectsInvalidatedInRoot[0], "Relayout of box in map should invalidate proper rect"); }
public void Relayout() { var styles = new AssembledStyles(); var box = new MockBox(styles); var fixMap = new Dictionary<Box, Rectangle>(); var layoutInfo = ParaBuilderTests.MakeLayoutInfo(100, m_gm.VwGraphics); var site = new MockSite(); var root = new RootBox(styles); root.Site = site; using (var lcb = new LayoutCallbacks(root)) { Assert.IsFalse(box.Relayout(layoutInfo, fixMap, lcb), "Relayout of box never laid out should return false (can't have old loc)"); } Assert.AreEqual(layoutInfo, box.LastLayoutTransform, "Relayout of box never laid out should call Layout() with same transform"); Assert.AreEqual(0, site.RectsInvalidated.Count, "Relayout of box never laid out should not invalidate anything"); box.LastLayoutTransform = null; using (var lcb = new LayoutCallbacks(root)) Assert.IsFalse(box.Relayout(layoutInfo, fixMap, lcb), "Relayout of box not in map should return false"); Assert.IsNull(box.LastLayoutTransform, "Relayout of box not in map should not call Layout()"); Assert.AreEqual(0, site.RectsInvalidated.Count, "Relayout of box not in map should not invalidate anything"); fixMap[box] = new Rectangle(2,3,4,7); using (var lcb = new LayoutCallbacks(root)) Assert.IsTrue(box.Relayout(layoutInfo, fixMap, lcb), "Relayout of box in map should return true"); Assert.AreEqual(layoutInfo, box.LastLayoutTransform, "Relayout of box in map should call Layout() with same transform"); Assert.AreEqual(1, site.RectsInvalidatedInRoot.Count, "Relayout of box in map should invalidate rect from map"); Assert.AreEqual(new Rectangle(2, 3, 4, 7), site.RectsInvalidatedInRoot[0], "Relayout of box in map should invalidate proper rect"); }