public void LocationTest() { Panel rootPanel = (Panel)_helper.CreateControl(typeof(TestPanel), null); Button childButton = (Button)_helper.CreateControl(typeof(TestButton), rootPanel); rootPanel.AutoScroll = true; _helper.SetValue(rootPanel, "Location", new Point(50, 50)); _helper.SetValue(rootPanel, "Size", new Size(200, 200)); _helper.SetValue(childButton, "Location", new Point(100, 100)); Assert.AreEqual(new Point(100, 100), (Point)_helper.GetValue(childButton, "Location"), "#1"); }
public void LocationTest() { Panel panel = (Panel)((IContainer)_helper.IDesignerHost).Components[0]; // the root control _helper.SetValue(panel, "Location", new Point(100, 100)); Assert.AreEqual(new Point(100, 100), (Point)_helper.GetValue(panel, "Location"), "#1"); Assert.AreEqual(new Point(15, 15), panel.Location, "#2"); }
public void GridPropertiesTest() { Panel rootPanel = (Panel)_helper.CreateControl(typeof(TestPCDPanel), null); _helper.SetValue(rootPanel, "SnapToGrid", true); _helper.SetValue(rootPanel, "DrawGrid", true); _helper.SetValue(rootPanel, "GridSize", new Size(10, 10)); Panel childPanel = (Panel)_helper.CreateControl(typeof(TestPanel), rootPanel); Assert.AreEqual(new Point(0, 0), (Point)_helper.GetValue(childPanel, "Location"), "#1"); Assert.AreEqual(new Size(8, 8), (Size)_helper.GetValue(childPanel, "GridSize"), "#2"); Assert.IsTrue((bool)_helper.GetValue(childPanel, "SnapToGrid"), "#3"); Assert.IsTrue((bool)_helper.GetValue(childPanel, "DrawGrid"), "#4"); // Test properties' values population among the children // _helper.SetValue(rootPanel, "SnapToGrid", false); _helper.SetValue(rootPanel, "GridSize", new Size(5, 5)); _helper.SetValue(rootPanel, "DrawGrid", false); Assert.AreEqual(new Size(5, 5), (Size)_helper.GetValue(childPanel, "GridSize"), "#5"); Assert.IsFalse((bool)_helper.GetValue(childPanel, "SnapToGrid"), "#6"); Assert.IsFalse((bool)_helper.GetValue(childPanel, "DrawGrid"), "#7"); Panel childPanelTwo = (Panel)_helper.CreateControl(typeof(TestPanel), rootPanel); Assert.AreEqual(new Point(3, 3), (Point)_helper.GetValue(childPanelTwo, "Location"), "#8"); Assert.AreEqual(new Size(5, 5), (Size)_helper.GetValue(childPanelTwo, "GridSize"), "#9"); Assert.IsFalse((bool)_helper.GetValue(childPanelTwo, "SnapToGrid"), "#10"); Assert.IsFalse((bool)_helper.GetValue(childPanelTwo, "DrawGrid"), "#11"); }