public void SizeDistributionOrder () { MyGrid grid = new MyGrid (); grid.AddRows (Auto, Star, Auto); grid.AddColumns (Star, Auto, Star); // Auto/Auto grid.AddChild (ContentControlWithChild (), 0, 1, 1, 1); // Star/Auto grid.AddChild (ContentControlWithChild (), 1, 1, 1, 1); // If there is no spanning involved, the heights do not get distributed grid.Measure (new Size (200, 200)); grid.CheckMeasureOrder ("#1", 0, 1); grid.CheckMeasureArgs ("#2", Infinity, new Size (inf, 150)); // Span the Star/Auto down into the Auto/Auto segment too. grid.ChangeRowSpan (1, 2); grid.ResetAndInvalidate (); grid.Measure (new Size (200, 200)); grid.CheckMeasureOrder ("#3", 0, 1); grid.CheckMeasureArgs ("#4", Infinity, new Size (inf, 150)); // Add in an Auto/Star to see what happens grid.AddChild (ContentControlWithChild (), 2, 0, 1, 1); grid.ResetAndInvalidate (); grid.Measure (new Size (200, 200)); grid.CheckMeasureOrder ("#5", 0, 1, 2, 1); grid.CheckMeasureArgs ("#6", Infinity, new Size (inf, inf), new Size (75, inf), new Size (inf, 150)); }
public void SizeDistributionOrder() { MyGrid grid = new MyGrid(); grid.AddRows(Auto, Star, Auto); grid.AddColumns(Star, Auto, Star); // Auto/Auto grid.AddChild(ContentControlWithChild(), 0, 1, 1, 1); // Star/Auto grid.AddChild(ContentControlWithChild(), 1, 1, 1, 1); // If there is no spanning involved, the heights do not get distributed grid.Measure(new Size(200, 200)); grid.CheckMeasureOrder("#1", 0, 1); grid.CheckMeasureArgs("#2", Infinity, new Size(inf, 150)); // Span the Star/Auto down into the Auto/Auto segment too. grid.ChangeRowSpan(1, 2); grid.ResetAndInvalidate(); grid.Measure(new Size(200, 200)); grid.CheckMeasureOrder("#3", 0, 1); grid.CheckMeasureArgs("#4", Infinity, new Size(inf, 150)); // Add in an Auto/Star to see what happens grid.AddChild(ContentControlWithChild(), 2, 0, 1, 1); grid.ResetAndInvalidate(); grid.Measure(new Size(200, 200)); grid.CheckMeasureOrder("#5", 0, 1, 2, 1); grid.CheckMeasureArgs("#6", Infinity, new Size(inf, inf), new Size(75, inf), new Size(inf, 150)); }
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)); }
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)); }