예제 #1
0
파일: BoxTests.cs 프로젝트: m13253/xwt
		public void SinglePackExpand ()
		{
			using (Window win = new Window ()) {
				var box = PrepareBox (win);
				SquareBox c = new SquareBox ();
				box.PackStart (c, true);
				ShowWindow (win);

				Assert.AreEqual (ToScreenBounds (win, new Rectangle (0, 0, 100, 100)), c.ScreenBounds);
			}
		}
예제 #2
0
        public void SinglePackExpand()
        {
            using (Window win = new Window()) {
                var       box = PrepareBox(win);
                SquareBox c   = new SquareBox();
                box.PackStart(c, true);
                ShowWindow(win);

                Assert.AreEqual(ToScreenBounds(win, new Rectangle(0, 0, 100, 100)), c.ScreenBounds);
            }
        }
예제 #3
0
 public void ChildAlignment()
 {
     using (var win = new Window()) {
         var c = CreateWidget();
         win.Content = c;
         win.Size    = new Size(100, 100);
         var box = new SquareBox(10);
         AddChild(c, box);
         ShowWindow(win);
         VerifyAlignment(box);
     }
 }
예제 #4
0
		public void ChildAlignment ()
		{
			using (var win = new Window ()) {
				var c = CreateWidget ();
				win.Content = c;
				win.Size = new Size (100, 100);
				var box = new SquareBox (10);
				AddChild (c, box);
				ShowWindow (win);
				VerifyAlignment (box);
			}
		}
예제 #5
0
 public void DefaultSizeWithMinContentSize()
 {
     using (var win = new Window()) {
         win.Padding = 0;
         SquareBox test = new SquareBox();
         test.MinWidth  = 200;
         test.MinHeight = 200;
         win.Content    = test;
         ShowWindow(win);
         Assert.AreEqual(200, win.Size.Width);
         Assert.AreEqual(200, win.Size.Height);
         Assert.AreEqual(200, test.ScreenBounds.Width);
         Assert.AreEqual(200, test.ScreenBounds.Height);
     }
 }
예제 #6
0
파일: WindowTests.cs 프로젝트: shines77/xwt
 public void ContentMargin()
 {
     using (var win = new Window ()) {
         win.Padding = 0;
         SquareBox test = new SquareBox ();
         test.MinWidth = 200;
         test.MinHeight = 200;
         test.Margin = 5;
         win.Content = test;
         ShowWindow (win);
         Assert.AreEqual (210, win.Size.Width);
         Assert.AreEqual (210, win.Size.Height);
         Assert.AreEqual (200, test.ScreenBounds.Width);
         Assert.AreEqual (200, test.ScreenBounds.Height);
     }
 }
예제 #7
0
        public void VerifyMargin(SquareBox box)
        {
            var r1 = box.ScreenBounds;

            box.Margin = new WidgetSpacing(5, 10, 15, 20);
            WaitForEvents();
            var r2 = box.ScreenBounds;

            Assert.AreEqual(r1.Left + 5, r2.Left);
            Assert.AreEqual(r1.Top + 10, r2.Top);
            Assert.AreEqual(r1.Width - 20, r2.Width);
            Assert.AreEqual(r1.Height - 30, r2.Height);

            box.Margin = 0;
            WaitForEvents();
            r2 = box.ScreenBounds;
            Assert.AreEqual(r1, r2);
        }
예제 #8
0
 public void ContentMarginChange()
 {
     // The size of the window grows if a specific size has not been set
     using (var win = new Window()) {
         win.Padding = 0;
         SquareBox test = new SquareBox();
         test.MinWidth  = 200;
         test.MinHeight = 200;
         test.Margin    = 5;
         win.Content    = test;
         ShowWindow(win);
         Assert.AreEqual(210, win.Size.Width);
         Assert.AreEqual(210, win.Size.Height);
         Assert.AreEqual(200, test.ScreenBounds.Width);
         Assert.AreEqual(200, test.ScreenBounds.Height);
         test.Margin = 10;
         WaitForEvents();
         Assert.AreEqual(220, win.Size.Width);
         Assert.AreEqual(220, win.Size.Height);
         Assert.AreEqual(200, test.ScreenBounds.Width);
         Assert.AreEqual(200, test.ScreenBounds.Height);
     }
 }
예제 #9
0
        public void VerifyAlignment(SquareBox box)
        {
            var r1 = box.ScreenBounds;

            // Horizontal Fill

            box.HorizontalPlacement = WidgetPlacement.Fill;
            box.VerticalPlacement   = WidgetPlacement.Fill;
            WaitForEvents();
            Assert.AreEqual(r1, box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Start;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(r1.Left, r1.Top, r1.Width, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Center;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(r1.Left, Math.Truncate(r1.Center.Y - 5), r1.Width, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.End;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(r1.Left, r1.Bottom - 10, r1.Width, 10), box.ScreenBounds);

            // Horizontal Start

            box.HorizontalPlacement = WidgetPlacement.Start;
            box.VerticalPlacement   = WidgetPlacement.Fill;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(r1.Left, r1.Top, 10, r1.Height), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Start;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(r1.Left, r1.Top, 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Center;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(r1.Left, Math.Truncate(r1.Center.Y - 5), 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.End;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(r1.Left, r1.Bottom - 10, 10, 10), box.ScreenBounds);

            // Horizontal Center

            box.HorizontalPlacement = WidgetPlacement.Center;
            box.VerticalPlacement   = WidgetPlacement.Fill;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(Math.Truncate(r1.Center.X - 5), r1.Top, 10, r1.Height), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Start;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(Math.Truncate(r1.Center.X - 5), r1.Top, 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Center;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(Math.Truncate(r1.Center.X - 5), Math.Truncate(r1.Center.Y - 5), 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.End;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(Math.Truncate(r1.Center.X - 5), r1.Bottom - 10, 10, 10), box.ScreenBounds);

            // Horizontal End

            box.HorizontalPlacement = WidgetPlacement.End;
            box.VerticalPlacement   = WidgetPlacement.Fill;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(r1.Right - 10, r1.Top, 10, r1.Height), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Start;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(r1.Right - 10, r1.Top, 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Center;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(r1.Right - 10, Math.Truncate(r1.Center.Y) - 5, 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.End;
            WaitForEvents();
            Assert.AreEqual(new Rectangle(r1.Right - 10, r1.Bottom - 10, 10, 10), box.ScreenBounds);
        }
예제 #10
0
파일: WidgetTests.cs 프로젝트: nite2006/xwt
        public void VerifyMargin(SquareBox box)
        {
            var r1 = box.ScreenBounds;

            box.Margin = new WidgetSpacing (5, 10, 15, 20);
            WaitForEvents ();
            var r2 = box.ScreenBounds;

            Assert.AreEqual (r1.Left + 5, r2.Left);
            Assert.AreEqual (r1.Top + 10, r2.Top);
            Assert.AreEqual (r1.Width - 20, r2.Width);
            Assert.AreEqual (r1.Height - 30, r2.Height);

            box.Margin = 0;
            WaitForEvents ();
            r2 = box.ScreenBounds;
            Assert.AreEqual (r1, r2);
        }
예제 #11
0
파일: WidgetTests.cs 프로젝트: nite2006/xwt
        public void VerifyAlignment(SquareBox box)
        {
            var r1 = box.ScreenBounds;

            // Horizontal Fill

            box.HorizontalPlacement = WidgetPlacement.Fill;
            box.VerticalPlacement = WidgetPlacement.Fill;
            WaitForEvents ();
            Assert.AreEqual (r1, box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Start;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (r1.Left, r1.Top, r1.Width, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Center;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (r1.Left, Math.Truncate (r1.Center.Y - 5), r1.Width, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.End;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (r1.Left, r1.Bottom - 10, r1.Width, 10), box.ScreenBounds);

            // Horizontal Start

            box.HorizontalPlacement = WidgetPlacement.Start;
            box.VerticalPlacement = WidgetPlacement.Fill;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (r1.Left, r1.Top, 10, r1.Height), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Start;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (r1.Left, r1.Top, 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Center;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (r1.Left, Math.Truncate (r1.Center.Y - 5), 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.End;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (r1.Left, r1.Bottom - 10, 10, 10), box.ScreenBounds);

            // Horizontal Center

            box.HorizontalPlacement = WidgetPlacement.Center;
            box.VerticalPlacement = WidgetPlacement.Fill;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (Math.Truncate (r1.Center.X - 5), r1.Top, 10, r1.Height), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Start;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (Math.Truncate (r1.Center.X - 5), r1.Top, 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Center;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (Math.Truncate (r1.Center.X - 5), Math.Truncate (r1.Center.Y - 5), 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.End;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (Math.Truncate (r1.Center.X - 5), r1.Bottom - 10, 10, 10), box.ScreenBounds);

            // Horizontal End

            box.HorizontalPlacement = WidgetPlacement.End;
            box.VerticalPlacement = WidgetPlacement.Fill;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (r1.Right - 10, r1.Top, 10, r1.Height), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Start;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (r1.Right - 10, r1.Top, 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.Center;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (r1.Right - 10, Math.Truncate (r1.Center.Y) - 5, 10, 10), box.ScreenBounds);

            box.VerticalPlacement = WidgetPlacement.End;
            WaitForEvents ();
            Assert.AreEqual (new Rectangle (r1.Right - 10, r1.Bottom - 10, 10, 10), box.ScreenBounds);
        }
예제 #12
0
		public void ContentMarginChange ()
		{
			// The size of the window grows if a specific size has not been set
			using (var win = new Window ()) {
				win.Padding = 0;
				SquareBox test = new SquareBox ();
				test.MinWidth = 200;
				test.MinHeight = 200;
				test.Margin = 5;
				win.Content = test;
				ShowWindow (win);
				Assert.AreEqual (210, win.Size.Width);
				Assert.AreEqual (210, win.Size.Height);
				Assert.AreEqual (200, test.ScreenBounds.Width);
				Assert.AreEqual (200, test.ScreenBounds.Height);
				test.Margin = 10;
				WaitForEvents ();
				Assert.AreEqual (220, win.Size.Width);
				Assert.AreEqual (220, win.Size.Height);
				Assert.AreEqual (200, test.ScreenBounds.Width);
				Assert.AreEqual (200, test.ScreenBounds.Height);
			}
		}