Exemplo n.º 1
0
        public void SizeInScrollViewer()
        {
            Window       window        = new Window();
            ScrollViewer scroll_viewer = new ScrollViewer();

            window.Content = scroll_viewer;
            SizeInScrollViewerStackPanel stack_panel = new SizeInScrollViewerStackPanel();

            scroll_viewer.Content = stack_panel;
            global::System.Windows.Controls.Button button = new global::System.Windows.Controls.Button();
            stack_panel.Children.Add(button);
            window.Show();
            Assert.AreEqual(stack_panel.ActualWidth, scroll_viewer.ViewportWidth, "1");
            Assert.AreEqual(stack_panel.ActualHeight, scroll_viewer.ViewportHeight, "2");
            Assert.AreEqual(stack_panel.DesiredSize.Width, Utility.GetEmptyButtonSize(), "3");
            Assert.AreEqual(stack_panel.DesiredSize.Height, Utility.GetEmptyButtonSize(), "4");
            Assert.AreEqual(stack_panel.MeasureResult.Width, Utility.GetEmptyButtonSize(), "5");
            Assert.AreEqual(stack_panel.MeasureResult.Height, Utility.GetEmptyButtonSize(), "6");
        }
Exemplo n.º 2
0
		public void SizeInScrollViewer ()
		{
			Window window = new Window ();
			ScrollViewer scroll_viewer = new ScrollViewer ();
			window.Content = scroll_viewer;
			SizeInScrollViewerStackPanel stack_panel = new SizeInScrollViewerStackPanel ();
			scroll_viewer.Content = stack_panel;
			global::System.Windows.Controls.Button button = new global::System.Windows.Controls.Button ();
			stack_panel.Children.Add (button);
			window.Show ();
			Assert.AreEqual (stack_panel.ActualWidth, scroll_viewer.ViewportWidth, "1");
			Assert.AreEqual (stack_panel.ActualHeight, scroll_viewer.ViewportHeight, "2");
			Assert.AreEqual (stack_panel.DesiredSize.Width, Utility.GetEmptyButtonSize (), "3");
			Assert.AreEqual (stack_panel.DesiredSize.Height, Utility.GetEmptyButtonSize (), "4");
			Assert.AreEqual (stack_panel.MeasureResult.Width, Utility.GetEmptyButtonSize (), "5");
			Assert.AreEqual (stack_panel.MeasureResult.Height, Utility.GetEmptyButtonSize (), "6");
		}