public void ClippingCanvasTest() { var mine = new UserControlPoker() { Width = 30, Height = 30 }; var content = new Canvas() { Width = 50, Height = 50 }; mine.SetContent(content); CreateAsyncTest(mine, () => { Assert.AreEqual(new Size(30, 30), mine.MeasureArg, "MeasureArg"); Assert.AreEqual(new Size(30, 30), mine.MeasureResult, "MeasureResult"); Assert.AreEqual(new Size(30, 30), mine.DesiredSize, "poker Desired"); Assert.AreEqual(new Size(30, 30), content.DesiredSize, "canvas desired"); Assert.AreEqual(new Size(30, 30), mine.ArrangeArg, "ArrangeArg"); Assert.AreEqual(new Size(30, 30), mine.ArrangeResult, "ArrangeArg"); Assert.AreEqual(new Size(50, 50), new Size(content.ActualWidth, content.ActualHeight), "content actual"); Assert.AreEqual(new Size(30, 30), mine.RenderSize, "uc rendersize"); Assert.AreEqual(new Size(50, 50), content.RenderSize, "content rendersize"); Assert.AreEqual(new Rect(0, 0, 30, 30), LayoutInformation.GetLayoutSlot(content), "content slot"); Assert.IsNull(LayoutInformation.GetLayoutClip(content), "clip"); } ); }
public void ClippingCanvasTest_notree() { var mine = new UserControlPoker() { Width = 30, Height = 30 }; var content = new Canvas() { Width = 50, Height = 50 }; mine.SetContent(content); mine.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); Assert.AreEqual(new Size(30, 30), mine.MeasureArg, "MeasureArg"); Assert.AreEqual(new Size(30, 30), mine.MeasureResult, "MeasureResult"); Assert.AreEqual(new Size(30, 30), mine.DesiredSize, "poker Desired"); Assert.AreEqual(new Size(30, 30), content.DesiredSize, "canvas desired"); mine.Arrange(new Rect(0, 0, mine.DesiredSize.Width, mine.DesiredSize.Height)); Assert.AreEqual(new Size(30, 30), mine.ArrangeArg, "ArrangeArg"); Assert.AreEqual(new Size(30, 30), mine.ArrangeResult, "ArrangeResult"); Assert.AreEqual(new Size(50, 50), new Size(content.ActualWidth, content.ActualHeight), "content actual"); Assert.AreEqual(new Size(50, 50), content.RenderSize, "content rendersize"); Assert.AreEqual(new Rect(0, 0, 30, 30), LayoutInformation.GetLayoutSlot(content), "content slot"); Assert.IsNull(LayoutInformation.GetLayoutClip(content), "clip"); }
public void UserControlContentParent() { UserControlPoker uc = new UserControlPoker(); ConcreteFrameworkElement cf = new ConcreteFrameworkElement(); uc.SetContent(cf); Assert.AreEqual(uc, cf.Parent, "1"); }
public void ChildMeasureTest2() { UserControlPoker p = new UserControlPoker(); Rectangle r = new Rectangle(); p.SetContent(r); r.Width = 50; r.Height = 50; p.Measure(new Size(100, 100)); Assert.AreEqual(new Size(50, 50), p.DesiredSize); }
public void ChildThicknessMeasureTest1() { UserControlPoker p = new UserControlPoker(); Rectangle r = new Rectangle(); p.Margin = new Thickness(5); p.SetContent(r); r.Width = 50; r.Height = 50; p.Measure(new Size(10, 10)); Assert.AreEqual(new Size(10, 10), p.DesiredSize); }
public void ChildNameScope() { UserControlPoker b = new UserControlPoker(); Canvas c = (Canvas)XamlReader.Load(@" <Canvas xmlns=""http://schemas.microsoft.com/client/2007"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""> <Border> <Path x:Name=""foo"" Data=""F1 M 10,10 20,20 10,20"" Stroke=""Red""/> </Border> </Canvas>"); Assert.IsNotNull(c.FindName("foo"), "c before"); b.SetContent(c); Assert.IsNull(b.FindName("foo"), "b after"); Assert.IsNotNull(c.FindName("foo"), "c after"); }
public void ClippingPanelTest() { var mine = new UserControlPoker() { Width = 30, Height = 30 }; var content = new PanelPoker() { Width = 50, Height = 50 }; mine.SetContent(content); content.Measured += (Size result) => { content.MeasureResult = new Size(0, 0); }; content.Arranged += (Size result) => { content.ArrangeResult = content.ArrangeArg; }; CreateAsyncTest(mine, () => { Assert.AreEqual(new Size(30, 30), mine.MeasureArg, "MeasureArg"); Assert.AreEqual(new Size(30, 30), mine.MeasureResult, "MeasureResult"); Assert.AreEqual(new Size(30, 30), mine.DesiredSize, "parent Desired"); Assert.AreEqual(new Size(30, 30), content.DesiredSize, "content desired"); Assert.AreEqual(new Size(30, 30), mine.ArrangeArg, "ArrangeArg"); Assert.AreEqual(new Size(30, 30), mine.ArrangeResult, "ArrangeArg"); Assert.AreEqual(new Size(50, 50), new Size(content.ActualWidth, content.ActualHeight), "content actual"); Assert.AreEqual(new Size(30, 30), mine.RenderSize, "parent rendersize"); Assert.AreEqual(new Size(50, 50), content.RenderSize, "content rendersize"); Assert.AreEqual(new Rect(0, 0, 30, 30), LayoutInformation.GetLayoutSlot(content), "content slot"); Assert.IsNotNull(LayoutInformation.GetLayoutClip(content), "clip"); RectangleGeometry rect = LayoutInformation.GetLayoutClip(content) as RectangleGeometry; Assert.IsNotNull(rect); Assert.AreEqual(LayoutInformation.GetLayoutSlot(content), rect.Rect, "clip == slot"); } ); }
public void UserControlContentParent () { UserControlPoker uc = new UserControlPoker (); ConcreteFrameworkElement cf = new ConcreteFrameworkElement (); uc.SetContent (cf); Assert.AreEqual (uc, cf.Parent, "1"); }
public void ChildThicknessMeasureTest2 () { UserControlPoker p = new UserControlPoker (); Rectangle r = new Rectangle (); p.Margin = new Thickness (5); p.SetContent (r); r.Width = 50; r.Height = 50; p.Measure (new Size (100, 100)); Assert.AreEqual (new Size (60, 60), p.DesiredSize); }
public void ChildMeasureTest1 () { UserControlPoker p = new UserControlPoker (); Rectangle r = new Rectangle (); p.SetContent (r); r.Width = 50; r.Height = 50; p.Measure (new Size (10, 10)); Assert.AreEqual (new Size (10, 10), p.DesiredSize); }
public void ChildNameScope () { UserControlPoker b = new UserControlPoker (); Canvas c = (Canvas) XamlReader.Load (@" <Canvas xmlns=""http://schemas.microsoft.com/client/2007"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""> <Border> <Path x:Name=""foo"" Data=""F1 M 10,10 20,20 10,20"" Stroke=""Red""/> </Border> </Canvas>"); Assert.IsNotNull (c.FindName ("foo"), "c before"); b.SetContent (c); Assert.IsNull (b.FindName ("foo"), "b after"); Assert.IsNotNull (c.FindName ("foo"), "c after"); }
public void ClippingPanelTest () { var mine = new UserControlPoker () { Width = 30, Height = 30 }; var content = new PanelPoker () { Width = 50, Height = 50 }; mine.SetContent (content); content.Measured += (Size result) => { content.MeasureResult = new Size (0,0); }; content.Arranged += (Size result) => { content.ArrangeResult = content.ArrangeArg; }; CreateAsyncTest (mine, () => { Assert.AreEqual (new Size (30, 30), mine.MeasureArg, "MeasureArg"); Assert.AreEqual (new Size (30, 30), mine.MeasureResult, "MeasureResult"); Assert.AreEqual (new Size (30, 30), mine.DesiredSize, "parent Desired"); Assert.AreEqual (new Size (30, 30), content.DesiredSize, "content desired"); Assert.AreEqual (new Size (30, 30), mine.ArrangeArg, "ArrangeArg"); Assert.AreEqual (new Size (30, 30), mine.ArrangeResult, "ArrangeArg"); Assert.AreEqual (new Size (50, 50), new Size (content.ActualWidth, content.ActualHeight), "content actual"); Assert.AreEqual (new Size (30, 30), mine.RenderSize, "parent rendersize"); Assert.AreEqual (new Size (50, 50), content.RenderSize, "content rendersize"); Assert.AreEqual (new Rect (0,0,30,30), LayoutInformation.GetLayoutSlot (content), "content slot"); Assert.IsNotNull (LayoutInformation.GetLayoutClip (content), "clip"); RectangleGeometry rect = LayoutInformation.GetLayoutClip (content) as RectangleGeometry; Assert.IsNotNull (rect); Assert.AreEqual (LayoutInformation.GetLayoutSlot (content), rect.Rect, "clip == slot"); } ); }
public void ClippingCanvasTest () { var mine = new UserControlPoker () { Width = 30, Height = 30 }; var content = new Canvas () { Width = 50, Height = 50 }; mine.SetContent (content); CreateAsyncTest (mine, () => { Assert.AreEqual (new Size (30, 30), mine.MeasureArg, "MeasureArg"); Assert.AreEqual (new Size (30, 30), mine.MeasureResult, "MeasureResult"); Assert.AreEqual (new Size (30, 30), mine.DesiredSize, "poker Desired"); Assert.AreEqual (new Size (30, 30), content.DesiredSize, "canvas desired"); Assert.AreEqual (new Size (30, 30), mine.ArrangeArg, "ArrangeArg"); Assert.AreEqual (new Size (30, 30), mine.ArrangeResult, "ArrangeArg"); Assert.AreEqual (new Size (50, 50), new Size (content.ActualWidth, content.ActualHeight), "content actual"); Assert.AreEqual (new Size (30, 30), mine.RenderSize, "uc rendersize"); Assert.AreEqual (new Size (50, 50), content.RenderSize, "content rendersize"); Assert.AreEqual (new Rect (0,0,30,30), LayoutInformation.GetLayoutSlot (content), "content slot"); Assert.IsNull (LayoutInformation.GetLayoutClip (content), "clip"); } ); }
public void ClippingCanvasTest_notree () { var mine = new UserControlPoker () { Width = 30, Height = 30 }; var content = new Canvas () { Width = 50, Height = 50 }; mine.SetContent (content); mine.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity)); Assert.AreEqual (new Size (30, 30), mine.MeasureArg, "MeasureArg"); Assert.AreEqual (new Size (30, 30), mine.MeasureResult, "MeasureResult"); Assert.AreEqual (new Size (30, 30), mine.DesiredSize, "poker Desired"); Assert.AreEqual (new Size (30, 30), content.DesiredSize, "canvas desired"); mine.Arrange (new Rect (0,0, mine.DesiredSize.Width, mine.DesiredSize.Height)); Assert.AreEqual (new Size (30, 30), mine.ArrangeArg, "ArrangeArg"); Assert.AreEqual (new Size (30, 30), mine.ArrangeResult, "ArrangeResult"); Assert.AreEqual (new Size (50, 50), new Size (content.ActualWidth, content.ActualHeight), "content actual"); Assert.AreEqual (new Size (50, 50), content.RenderSize, "content rendersize"); Assert.AreEqual (new Rect (0,0,30,30), LayoutInformation.GetLayoutSlot (content), "content slot"); Assert.IsNull (LayoutInformation.GetLayoutClip (content), "clip"); }