示例#1
0
文件: GridTestAuto.cs 项目: dfr0/moon
		public void StarRowsWithChild2_InTree ()
		{
			// Check what happens when there are two explicit rows and no explicit column
			Grid grid = new Grid ();
			var poker = new SettablePanel {
				Grid = grid,
				MeasureArg = Infinity,
			};
			grid.AddRows (new GridLength (1, GridUnitType.Star), new GridLength (1, GridUnitType.Star));
			grid.Children.Add (new MyContentControl (50, 50));

			CreateAsyncTest (poker,
				() => {
					Assert.AreEqual (new Size (50, 50), grid.DesiredSize, "#1");
					grid.CheckRowHeights ("#2", 50, 0);
					poker.MeasureArg = new Size (100, 100);
					poker.InvalidateSubtree ();
				}, () => {
					Assert.AreEqual (new Size (50, 50), grid.DesiredSize, "#3");
					grid.CheckRowHeights ("#4", 50, 0);
				}
			);
		}
示例#2
0
文件: GridTestAuto.cs 项目: dfr0/moon
		public void StarRowsWithChild2_NoSpan_ExplicitSize_InTree ()
		{
			// Check what happens when there are two explicit rows and no explicit column
			Grid grid = new Grid {
				Width = 75,
				Height = 75,
				HorizontalAlignment = HorizontalAlignment.Center,
				VerticalAlignment = VerticalAlignment.Bottom,
			};
			var poker = new SettablePanel {
				Grid = grid,
				MeasureArg = Infinity
			};
			grid.AddRows (new GridLength (1, GridUnitType.Star), new GridLength (1, GridUnitType.Star));
			grid.Children.Add (new MyContentControl (50, 50));

			CreateAsyncTest (poker,
				() => {
					Assert.AreEqual (new Size (75, 75), grid.DesiredSize, "#1");
					grid.CheckRowHeights ("#2", 37.5, 37.5);
					poker.MeasureArg = new Size (100, 100);
					poker.InvalidateSubtree ();
				}, () => {
					Assert.AreEqual (new Size (75, 75), grid.DesiredSize, "#3");
					grid.CheckRowHeights ("#4", 37.5, 37.5);
				}
			);
		}
示例#3
0
文件: GridTestAuto.cs 项目: dfr0/moon
		public void StarRowsWithChild_NoSpan_ExplicitSize_InTree ()
		{
			// Check what happens if there is no explicit ColumnDefinition added
			Grid grid = new Grid {
				Width = 75,
				Height = 75,
				HorizontalAlignment = HorizontalAlignment.Center,
				VerticalAlignment = VerticalAlignment.Bottom,
			};
			var poker = new SettablePanel {
				Grid = grid,
				MeasureArg = Infinity
			};
			grid.AddRows (new GridLength (1, GridUnitType.Star));
			grid.Children.Add (new MyContentControl (50, 50));

			CreateAsyncTest (poker,
				() => {
					Assert.AreEqual (new Size (75, 75), grid.DesiredSize, "#1");
					Assert.AreEqual (75, grid.RowDefinitions [0].ActualHeight, "#2");
					poker.MeasureArg = new Size (100, 100);
					poker.InvalidateSubtree ();
				}, () => {
					Assert.AreEqual (new Size (75, 75), grid.DesiredSize, "#3");
					Assert.AreEqual (75, grid.RowDefinitions [0].ActualHeight, "#4");
				}
			);
		}