Ejemplo n.º 1
0
 public void DefaultSize()
 {
     using (var win = new Window()) {
         win.Padding = 0;
         var test = new VariableSizeBox(200);
         win.Content = test;
         ShowWindow(win);
         Assert.AreEqual(200, win.Size.Width);
         Assert.AreEqual(100, win.Size.Height);
         Assert.AreEqual(200, test.ScreenBounds.Width);
         Assert.AreEqual(100, test.ScreenBounds.Height);
     }
 }
Ejemplo n.º 2
0
		public void DefaultSize ()
		{
			using (var win = new Window ()) {
				win.Padding = 0;
				var test = new VariableSizeBox (200);
				win.Content = test;
				ShowWindow (win);
				Assert.AreEqual (200, win.Size.Width);
				Assert.AreEqual (100, win.Size.Height);
				Assert.AreEqual (200, test.ScreenBounds.Width);
				Assert.AreEqual (100, test.ScreenBounds.Height);
			}
		}
Ejemplo n.º 3
0
 public void FixedWidth()
 {
     using (var win = new Window()) {
         win.Padding = 0;
         var test = new VariableSizeBox(200);
         win.Content = test;
         win.Width   = 300;
         ShowWindow(win);
         WaitForEvents();
         Assert.AreEqual(300, win.Size.Width);
         Assert.AreEqual(150, win.Size.Height);
         Assert.AreEqual(300, test.ScreenBounds.Width);
         Assert.AreEqual(150, test.ScreenBounds.Height);
     }
 }
Ejemplo n.º 4
0
 public void FixedContentGrowMakesWindowGrow()
 {
     using (var win = new Window()) {
         win.Padding = 0;
         var test = new VariableSizeBox(200);
         test.ForceSize = true;
         win.Content    = test;
         ShowWindow(win);
         Assert.AreEqual(200, win.Size.Width);
         Assert.AreEqual(100, win.Size.Height);
         test.Size = 300;
         // The preferred size grows, and it is bigger that the constraint provided
         // by the window (the initial size of the window), so the window grows to adapt
         WaitForEvents();
         Assert.AreEqual(300, win.Size.Width);
         Assert.AreEqual(150, win.Size.Height);
         Assert.AreEqual(300, test.ScreenBounds.Width);
         Assert.AreEqual(150, test.ScreenBounds.Height);
     }
 }
Ejemplo n.º 5
0
 public void FlexibleContentGrowMakesWindowNotGrow()
 {
     using (var win = new Window()) {
         win.Padding = 0;
         var test = new VariableSizeBox(200);
         win.Content = test;
         ShowWindow(win);
         Assert.AreEqual(200, win.Size.Width);
         Assert.AreEqual(100, win.Size.Height);
         test.Size = 300;
         // The preferred size grows, but the widget honors the constraint given
         // by the window (the initial size of the window), so it doesn't make
         // the window grow
         WaitForEvents();
         Assert.AreEqual(200, win.Size.Width);
         Assert.AreEqual(100, win.Size.Height);
         Assert.AreEqual(200, test.ScreenBounds.Width);
         Assert.AreEqual(100, test.ScreenBounds.Height);
     }
 }
Ejemplo n.º 6
0
		public void FixedContentGrowMakesWindowGrow ()
		{
			using (var win = new Window ()) {
				win.Padding = 0;
				var test = new VariableSizeBox (200);
				test.ForceSize = true;
				win.Content = test;
				ShowWindow (win);
				Assert.AreEqual (200, win.Size.Width);
				Assert.AreEqual (100, win.Size.Height);
				test.Size = 300;
				// The preferred size grows, and it is bigger that the constraint provided
				// by the window (the initial size of the window), so the window grows to adapt
				WaitForEvents ();
				Assert.AreEqual (300, win.Size.Width);
				Assert.AreEqual (150, win.Size.Height);
				Assert.AreEqual (300, test.ScreenBounds.Width);
				Assert.AreEqual (150, test.ScreenBounds.Height);
			}
		}
Ejemplo n.º 7
0
		public void FlexibleContentGrowMakesWindowNotGrow ()
		{
			using (var win = new Window ()) {
				win.Padding = 0;
				var test = new VariableSizeBox (200);
				win.Content = test;
				ShowWindow (win);
				Assert.AreEqual (200, win.Size.Width);
				Assert.AreEqual (100, win.Size.Height);
				test.Size = 300;
				// The preferred size grows, but the widget honors the constraint given
				// by the window (the initial size of the window), so it doesn't make
				// the window grow
				WaitForEvents ();
				Assert.AreEqual (200, win.Size.Width);
				Assert.AreEqual (100, win.Size.Height);
				Assert.AreEqual (200, test.ScreenBounds.Width);
				Assert.AreEqual (100, test.ScreenBounds.Height);
			}
		}
Ejemplo n.º 8
0
		public void ContentWidthGrows ()
		{
			using (var win = new Window ()) {
				win.Padding = 0;
				var test = new VariableSizeBox (200);
				win.Content = test;
				ShowWindow (win);
				Assert.AreEqual (200, win.Size.Width);
				Assert.AreEqual (100, win.Size.Height);
				win.Width = 300;
				WaitForEvents ();
				Assert.AreEqual (300, win.Size.Width);
				Assert.AreEqual (150, win.Size.Height);
				Assert.AreEqual (300, test.ScreenBounds.Width);
				Assert.AreEqual (150, test.ScreenBounds.Height);
			}
		}