TestTryTransformGroupRectangles2() { // Graph does not have group drawing information. IGraph oGraph = new Graph(); GroupMetadataManager.TransformGroupRectangles(oGraph, new LayoutContext(Rectangle.FromLTRB(0, 0, 10, 20)), new LayoutContext(Rectangle.FromLTRB(0, 0, 20, 10)) ); GroupLayoutDrawingInfo oGroupLayoutDrawingInfo; Assert.IsFalse(GroupMetadataManager.TryGetGroupLayoutDrawingInfo( oGraph, out oGroupLayoutDrawingInfo)); }
TestTryTransformGroupRectangles() { // Graph has group drawing information. const Double GroupRectanglePenWidth = 4.567; IGraph oGraph = new Graph(); GroupInfo oGroupInfo1 = new GroupInfo(); oGroupInfo1.Rectangle = Rectangle.FromLTRB(0, 0, 1, 2); GroupInfo oGroupInfo2 = new GroupInfo(); oGroupInfo2.Rectangle = Rectangle.FromLTRB(0, 0, 3, 4); oGraph.SetValue(ReservedMetadataKeys.GroupLayoutDrawingInfo, new GroupLayoutDrawingInfo( new GroupInfo[] { oGroupInfo1, oGroupInfo2 }, GroupRectanglePenWidth, null )); GroupMetadataManager.TransformGroupRectangles(oGraph, new LayoutContext(Rectangle.FromLTRB(0, 0, 10, 20)), new LayoutContext(Rectangle.FromLTRB(0, 0, 20, 60)) ); GroupLayoutDrawingInfo oGroupLayoutDrawingInfo; Assert.IsTrue(GroupMetadataManager.TryGetGroupLayoutDrawingInfo( oGraph, out oGroupLayoutDrawingInfo)); Assert.AreEqual(2, oGroupLayoutDrawingInfo.GroupsToDraw.Count); Assert.AreEqual(Rectangle.FromLTRB(0, 0, 2, 6), oGroupLayoutDrawingInfo.GroupsToDraw[0].Rectangle); Assert.AreEqual(Rectangle.FromLTRB(0, 0, 6, 12), oGroupLayoutDrawingInfo.GroupsToDraw[1].Rectangle); }