예제 #1
0
		public void TestVAnchorCenter()
		{
			FlowLayoutWidget searchPanel = new FlowLayoutWidget();
			searchPanel.BackgroundColor = new RGBA_Bytes(180, 180, 180);
			searchPanel.HAnchor = HAnchor.ParentLeftRight;
			searchPanel.Padding = new BorderDouble(3, 3);
			{
				TextEditWidget searchInput = new TextEditWidget("Test");
				searchInput.Margin = new BorderDouble(6, 0);
				searchInput.HAnchor = HAnchor.ParentLeftRight;
				searchInput.VAnchor = VAnchor.ParentCenter;

				Button searchButton = new Button("Search");
				searchButton.Margin = new BorderDouble(right: 9);

				searchPanel.AddChild(searchInput);
				Assert.IsTrue(searchInput.BoundsRelativeToParent.Bottom - searchPanel.BoundsRelativeToParent.Bottom == searchPanel.BoundsRelativeToParent.Top - searchInput.BoundsRelativeToParent.Top);
				searchPanel.AddChild(searchButton);
				Assert.IsTrue(searchInput.BoundsRelativeToParent.Bottom - searchPanel.BoundsRelativeToParent.Bottom == searchPanel.BoundsRelativeToParent.Top - searchInput.BoundsRelativeToParent.Top);
			}

			searchPanel.Close();
		}