コード例 #1
0
        public void MeasureOrder4()
        {
            TestPanel.Width  = 500;
            TestPanel.Height = 500;

            MyGrid grid = new MyGrid();

            grid.AddRows(new GridLength(1, GridUnitType.Star), new GridLength(1, GridUnitType.Auto), new GridLength(50));
            grid.AddColumns(new GridLength(1, GridUnitType.Star), new GridLength(1, GridUnitType.Auto), new GridLength(50));
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    grid.AddChild(ContentControlWithChild(), i, j, 1, 1);
                }
            }

            CreateAsyncTest(grid, () => {
                grid.CheckMeasureOrder("#1", 4, 5, 7, 8, 1, 3, 6, 1, 0, 2);
                grid.CheckMeasureArgs("#2", new Size(inf, inf), new Size(50, inf), new Size(inf, 50),
                                      new Size(50, 50), new Size(inf, inf), new Size(400, inf),
                                      new Size(400, 50), new Size(inf, 400), new Size(400, 400), new Size(50, 400));
                grid.ReverseChildren();
                grid.Reset();
            }, () => {
                grid.CheckMeasureOrder("#3", 0, 1, 3, 4, 7, 2, 5, 7, 6, 8);
                grid.CheckMeasureArgs("#4", new Size(50, 50), new Size(inf, 50), new Size(50, inf),
                                      new Size(inf, inf), new Size(inf, inf), new Size(400, 50),
                                      new Size(400, inf), new Size(inf, 400), new Size(50, 400), new Size(400, 400));
            });
        }
コード例 #2
0
        public void MeasureOrder6()
        {
            TestPanel.Width  = 500;
            TestPanel.Height = 500;

            MyGrid grid = new MyGrid();

            grid.AddRows(new GridLength(1, GridUnitType.Star), new GridLength(1, GridUnitType.Auto), new GridLength(50), new GridLength(1, GridUnitType.Star), GridLength.Auto);
            grid.AddColumns(new GridLength(1, GridUnitType.Star), new GridLength(1, GridUnitType.Auto), new GridLength(1, GridUnitType.Star), new GridLength(50), GridLength.Auto);
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    grid.AddChild(ContentControlWithChild(), i, j, 1, 1);
                }
            }

            CreateAsyncTest(grid, () => {
                grid.CheckMeasureOrder("#1", 6, 8, 9, 11, 13, 14, 21, 23, 24, 1, 4, 16, 19, 5, 7, 10, 12, 20, 22, 1, 4, 16, 19, 0, 2, 3, 15, 17, 18);
                grid.CheckMeasureArgs("#2",
                                      new Size(inf, inf), new Size(50, inf), new Size(inf, inf), new Size(inf, 50), new Size(50, 50),
                                      new Size(inf, 50), new Size(inf, inf), new Size(50, inf), new Size(inf, inf), new Size(inf, inf),
                                      new Size(inf, inf), new Size(inf, inf), new Size(inf, inf), new Size(175, inf), new Size(175, inf),
                                      new Size(175, 50), new Size(175, 50), new Size(175, inf), new Size(175, inf), new Size(inf, 175),
                                      new Size(inf, 175), new Size(inf, 175), new Size(inf, 175), new Size(175, 175), new Size(175, 175),
                                      new Size(50, 175), new Size(175, 175), new Size(175, 175), new Size(50, 175));
                grid.ReverseChildren();
                grid.Reset();
            }, () => {
                grid.CheckMeasureOrder("#3", 0, 1, 3, 10, 11, 13, 15, 16, 18, 5,
                                       8, 20, 23, 2, 4, 12, 14, 17, 19, 5,
                                       8, 20, 23, 6, 7, 9, 21, 22, 24);
                grid.CheckMeasureArgs("#4",
                                      new Size(inf, inf), new Size(50, inf), new Size(inf, inf), new Size(inf, 50), new Size(50, 50),
                                      new Size(inf, 50), new Size(inf, inf), new Size(50, inf), new Size(inf, inf), new Size(inf, inf),
                                      new Size(inf, inf), new Size(inf, inf), new Size(inf, inf), new Size(175, inf), new Size(175, inf),
                                      new Size(175, 50), new Size(175, 50), new Size(175, inf), new Size(175, inf), new Size(inf, 175),
                                      new Size(inf, 175), new Size(inf, 175), new Size(inf, 175), new Size(50, 175), new Size(175, 175),
                                      new Size(175, 175), new Size(50, 175), new Size(175, 175), new Size(175, 175));
            });
        }
コード例 #3
0
ファイル: GridTestOrdering.cs プロジェクト: dfr0/moon
		public void AutoStarPriority ()
		{
			// Test a bunch of combinations of auto/star with/without span to see
			// which order things are measured in.
			MyGrid grid = new MyGrid { Width = 200, Height = 200 };
			grid.AddRows (Auto, Auto, Star, Auto, Star);
			grid.AddColumns (Auto, Star, Auto, Star, Auto);

			// Two auto-autos and one star-star
			grid.AddChild (ContentControlWithChild (), 0, 0, 1, 1);
			grid.AddChild (ContentControlWithChild (), 0, 0, 1, 1);
			grid.AddChild (ContentControlWithChild (), 4, 3, 1, 1);

			// Measured in-order. star-star is last.
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#1", 0, 1, 2);
			grid.CheckMeasureArgs ("#1b", Infinity, Infinity, new Size (75, 75));

			grid.ReverseChildren ();
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#2", 1, 2, 0);
			grid.CheckMeasureArgs ("#2b", Infinity, Infinity, new Size (75, 75));

			// Span > 1 does not affect measure order. star-star is last.
			grid.ReverseChildren ();
			grid.ChangeRowSpan (0, 2);
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#3", 0, 1, 2);
			grid.CheckMeasureArgs ("#3b", Infinity, Infinity, new Size (75, 75));

			grid.ReverseChildren ();
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#4", 1, 2, 0);
			grid.CheckMeasureArgs ("#4b", Infinity, Infinity, new Size (75, 75));

			// Elements which do not span a star row are measured first. star-star is last.
			grid.ReverseChildren ();
			grid.ChangeRowSpan (0, 3);
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#5", 1, 0, 2);
			grid.CheckMeasureArgs ("#5b", Infinity, new Size (inf, 125), new Size (75, 75));

			grid.ReverseChildren ();
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#6", 1, 2, 0);
			grid.CheckMeasureArgs ("#6b", Infinity, new Size (inf, 125), new Size (75, 75));

			// Elements which do not span a star col are measured first. star-star is last.
			grid.ReverseChildren ();
			grid.ChangeRowSpan (0, 1);
			grid.ChangeColSpan (0, 2);
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#7", 1, 0, 2);
			grid.CheckMeasureArgs ("#7b", Infinity, new Size (125, inf), new Size (75, 75));

			grid.ReverseChildren ();
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#8", 1, 2, 0);
			grid.CheckMeasureArgs ("#8b", Infinity, new Size (125, inf), new Size (75, 75));

			// Elements which span a Star row are measured before ones spanning a Star col. star-star is last.
			grid.ReverseChildren ();
			grid.ChangeRowSpan (1, 3);
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#9", 1, 0, 1, 2);
			grid.CheckMeasureArgs ("#9b", Infinity, new Size (125, inf), new Size (inf, 125), new Size (75, 75));

			grid.ReverseChildren ();
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#10", 1, 2, 1, 0);
			grid.CheckMeasureArgs ("#10b", Infinity, new Size (125, inf), new Size (inf, 125), new Size (75, 75));

			// Auto/Auto is measured before all. star-star is last.
			grid.ReverseChildren ();
			grid.AddChild (ContentControlWithChild (), 0, 0, 1, 1);
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#11", 3, 1, 0, 1, 2);
			grid.CheckMeasureArgs ("#11b", Infinity, Infinity, new Size (125, inf), new Size (inf, 125), new Size (75, 75));

			grid.ReverseChildren ();
			grid.ResetAndInvalidate ();
			grid.Measure (new Size (200, 200));
			grid.CheckMeasureOrder ("#12", 0, 2, 3, 2, 1);
			grid.CheckMeasureArgs ("#12b", Infinity, Infinity, new Size (125, inf), new Size (inf, 125), new Size (75, 75));
		}
コード例 #4
0
ファイル: GridTestOrdering.cs プロジェクト: dfr0/moon
		public void MeasureOrder6 ()
		{
			TestPanel.Width = 500;
			TestPanel.Height = 500;

			MyGrid grid = new MyGrid ();
			grid.AddRows (new GridLength (1, GridUnitType.Star), new GridLength (1, GridUnitType.Auto), new GridLength (50), new GridLength (1, GridUnitType.Star), GridLength.Auto);
			grid.AddColumns (new GridLength (1, GridUnitType.Star), new GridLength (1, GridUnitType.Auto), new GridLength (1, GridUnitType.Star), new GridLength (50), GridLength.Auto);
			for (int i = 0; i < 5; i++)
				for (int j = 0; j < 5; j++)
					grid.AddChild (ContentControlWithChild (), i, j, 1, 1);

			CreateAsyncTest (grid, () => {
				grid.CheckMeasureOrder ("#1", 6, 8, 9, 11, 13, 14, 21, 23, 24, 1, 4, 16, 19, 5, 7, 10, 12, 20, 22, 1, 4, 16, 19, 0, 2, 3, 15, 17, 18);
				grid.CheckMeasureArgs ("#2",
					new Size (inf, inf), new Size (50, inf), new Size (inf, inf), new Size (inf, 50), new Size (50, 50),
					new Size (inf, 50), new Size (inf, inf), new Size (50, inf), new Size (inf, inf), new Size (inf, inf),
					new Size (inf, inf), new Size (inf, inf), new Size (inf, inf), new Size (175, inf), new Size (175, inf),
					new Size (175, 50), new Size (175, 50), new Size (175, inf), new Size (175, inf), new Size (inf, 175),
					new Size (inf, 175), new Size (inf, 175), new Size (inf, 175), new Size (175, 175), new Size (175, 175),
					new Size (50, 175), new Size (175, 175), new Size (175, 175), new Size (50, 175));
				grid.ReverseChildren ();
				grid.Reset ();
			}, () => {
				grid.CheckMeasureOrder ("#3", 0, 1, 3, 10, 11, 13, 15, 16, 18, 5,
											  8, 20, 23, 2, 4, 12, 14, 17, 19, 5,
											  8, 20, 23, 6, 7, 9, 21, 22, 24);
				grid.CheckMeasureArgs ("#4",
					new Size (inf, inf), new Size (50, inf), new Size (inf, inf), new Size (inf, 50), new Size (50, 50),
					new Size (inf, 50), new Size (inf, inf), new Size (50, inf), new Size (inf, inf), new Size (inf, inf),
					new Size (inf, inf), new Size (inf, inf), new Size (inf, inf), new Size (175, inf), new Size (175, inf),
					new Size (175, 50), new Size (175, 50), new Size (175, inf), new Size (175, inf), new Size (inf, 175),
					new Size (inf, 175), new Size (inf, 175), new Size (inf, 175), new Size (50, 175), new Size (175, 175),
					new Size (175, 175), new Size (50, 175), new Size (175, 175), new Size (175, 175));
			});
		}
コード例 #5
0
ファイル: GridTestOrdering.cs プロジェクト: dfr0/moon
		public void MeasureOrder4 ()
		{
			TestPanel.Width = 500;
			TestPanel.Height = 500;

			MyGrid grid = new MyGrid ();
			grid.AddRows (new GridLength (1, GridUnitType.Star), new GridLength (1, GridUnitType.Auto), new GridLength (50));
			grid.AddColumns (new GridLength (1, GridUnitType.Star), new GridLength (1, GridUnitType.Auto), new GridLength (50));
			for (int i = 0; i < 3; i++)
				for (int j = 0; j < 3; j++)
					grid.AddChild (ContentControlWithChild (), i, j, 1, 1);

			CreateAsyncTest (grid, () => {
				grid.CheckMeasureOrder ("#1", 4, 5, 7, 8, 1, 3, 6, 1, 0, 2);
				grid.CheckMeasureArgs ("#2", new Size (inf, inf), new Size (50, inf), new Size (inf, 50),
											  new Size (50, 50), new Size (inf, inf), new Size (400, inf),
											  new Size (400, 50), new Size (inf, 400), new Size (400, 400), new Size (50, 400));
				grid.ReverseChildren ();
				grid.Reset ();
			}, () => {
				grid.CheckMeasureOrder ("#3", 0, 1, 3, 4, 7, 2, 5, 7, 6, 8);
				grid.CheckMeasureArgs ("#4", new Size (50, 50), new Size (inf, 50), new Size (50, inf),
											  new Size (inf, inf), new Size (inf, inf), new Size (400, 50),
											  new Size (400, inf), new Size (inf, 400), new Size (50, 400), new Size (400, 400));
			});
		}
コード例 #6
0
        public void AutoStarPriority()
        {
            // Test a bunch of combinations of auto/star with/without span to see
            // which order things are measured in.
            MyGrid grid = new MyGrid {
                Width = 200, Height = 200
            };

            grid.AddRows(Auto, Auto, Star, Auto, Star);
            grid.AddColumns(Auto, Star, Auto, Star, Auto);

            // Two auto-autos and one star-star
            grid.AddChild(ContentControlWithChild(), 0, 0, 1, 1);
            grid.AddChild(ContentControlWithChild(), 0, 0, 1, 1);
            grid.AddChild(ContentControlWithChild(), 4, 3, 1, 1);

            // Measured in-order. star-star is last.
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#1", 0, 1, 2);
            grid.CheckMeasureArgs("#1b", Infinity, Infinity, new Size(75, 75));

            grid.ReverseChildren();
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#2", 1, 2, 0);
            grid.CheckMeasureArgs("#2b", Infinity, Infinity, new Size(75, 75));

            // Span > 1 does not affect measure order. star-star is last.
            grid.ReverseChildren();
            grid.ChangeRowSpan(0, 2);
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#3", 0, 1, 2);
            grid.CheckMeasureArgs("#3b", Infinity, Infinity, new Size(75, 75));

            grid.ReverseChildren();
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#4", 1, 2, 0);
            grid.CheckMeasureArgs("#4b", Infinity, Infinity, new Size(75, 75));

            // Elements which do not span a star row are measured first. star-star is last.
            grid.ReverseChildren();
            grid.ChangeRowSpan(0, 3);
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#5", 1, 0, 2);
            grid.CheckMeasureArgs("#5b", Infinity, new Size(inf, 125), new Size(75, 75));

            grid.ReverseChildren();
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#6", 1, 2, 0);
            grid.CheckMeasureArgs("#6b", Infinity, new Size(inf, 125), new Size(75, 75));

            // Elements which do not span a star col are measured first. star-star is last.
            grid.ReverseChildren();
            grid.ChangeRowSpan(0, 1);
            grid.ChangeColSpan(0, 2);
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#7", 1, 0, 2);
            grid.CheckMeasureArgs("#7b", Infinity, new Size(125, inf), new Size(75, 75));

            grid.ReverseChildren();
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#8", 1, 2, 0);
            grid.CheckMeasureArgs("#8b", Infinity, new Size(125, inf), new Size(75, 75));

            // Elements which span a Star row are measured before ones spanning a Star col. star-star is last.
            grid.ReverseChildren();
            grid.ChangeRowSpan(1, 3);
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#9", 1, 0, 1, 2);
            grid.CheckMeasureArgs("#9b", Infinity, new Size(125, inf), new Size(inf, 125), new Size(75, 75));

            grid.ReverseChildren();
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#10", 1, 2, 1, 0);
            grid.CheckMeasureArgs("#10b", Infinity, new Size(125, inf), new Size(inf, 125), new Size(75, 75));

            // Auto/Auto is measured before all. star-star is last.
            grid.ReverseChildren();
            grid.AddChild(ContentControlWithChild(), 0, 0, 1, 1);
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#11", 3, 1, 0, 1, 2);
            grid.CheckMeasureArgs("#11b", Infinity, Infinity, new Size(125, inf), new Size(inf, 125), new Size(75, 75));

            grid.ReverseChildren();
            grid.ResetAndInvalidate();
            grid.Measure(new Size(200, 200));
            grid.CheckMeasureOrder("#12", 0, 2, 3, 2, 1);
            grid.CheckMeasureArgs("#12b", Infinity, Infinity, new Size(125, inf), new Size(inf, 125), new Size(75, 75));
        }