public void MeasureRectangleTest1 () { Path p = new Path (); RectangleGeometry r = new RectangleGeometry (); r.Rect = new Rect (10, 10, 20, 20); p.Data = r; p.Measure (new Size (50, 50)); Assert.AreEqual (new Size (0, 0), p.DesiredSize); }
public void ComputeActualWidth () { var c = new Path (); Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired0"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual0"); c.MaxWidth = 25; c.Width = 50; c.MinHeight = 33; Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired1"); Assert.AreEqual (new Size (25,33), new Size (c.ActualWidth,c.ActualHeight), "c actual1"); Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot1"); c.Measure (new Size (100, 100)); Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired2"); Assert.AreEqual (new Size (25,33), new Size (c.ActualWidth,c.ActualHeight), "c actual2"); Assert.AreEqual (new Size (0,0), c.RenderSize, "c render2"); c.Arrange (new Rect (0,0,c.DesiredSize.Width,c.DesiredSize.Height)); Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired3"); Assert.AreEqual (new Size (25,33), new Size (c.ActualWidth,c.ActualHeight), "c actual3"); Assert.AreEqual (new Size (0,0), c.RenderSize, "c render3"); }
public void ComputeSizeInfinite_StretchUniform_InstrinsicBorder () { Border b = new Border (); var c = new Path (); b.Child = c; Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired0"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual0"); var data = new RectangleGeometry (); data.Rect = new Rect (0,10,25,23); c.Data = data; c.Stretch = Stretch.Uniform; Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired1"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1"); Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot"); c.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity)); Assert.AreEqual (new Size (25,23), c.DesiredSize, "c desired2"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual2"); Assert.AreEqual (new Size (0,0), c.RenderSize, "c render2"); Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot2"); c.Arrange (new Rect (10,10,c.DesiredSize.Width,c.DesiredSize.Height)); Assert.AreEqual (new Size (25,23), c.DesiredSize, "c desired"); Assert.AreEqual (new Size (25,23), c.DesiredSize, "c desired"); Assert.AreEqual (new Size (25,23), new Size (c.ActualWidth,c.ActualHeight), "c actual3"); Assert.AreEqual (new Size (25,23), c.RenderSize, "c render"); Assert.AreEqual (new Rect (10,10,25,23), LayoutInformation.GetLayoutSlot (c), "c slot2"); }
public void ComputeReducedSize_StretchUniform_InstrinsicBorder_InTree () { Border b = new Border (); b.UseLayoutRounding = true; var c = new Path (); b.Child = c; b.Width = 10; b.Height = 10; Assert.IsTrue (c.UseLayoutRounding, "use rounding"); Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired0"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual0"); var data = new RectangleGeometry (); data.Rect = new Rect (0,10,25,23); c.Data = data; c.Stretch = Stretch.Uniform; Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired1"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1"); Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot"); c.Measure (new Size (10, 10)); Assert.AreEqual (new Size (10,9), c.DesiredSize, "c desired2"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual2"); Assert.AreEqual (new Size (0,0), c.RenderSize, "c render2"); Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot2"); c.Arrange (new Rect (10,10,c.DesiredSize.Width,c.DesiredSize.Height)); CreateAsyncTest (b, () => { Assert.AreEqual (new Rect (0,0,10,10), LayoutInformation.GetLayoutSlot (c), "c slot2"); Assert.AreEqual (new Size (10,9), c.DesiredSize, "c desired"); Assert.AreEqual (c.RenderSize, new Size (c.ActualWidth, c.ActualHeight), "render == actual"); Assert.AreEqual (10, c.ActualWidth, "c.ActualWidth == " + c.ActualWidth.ToString ()); Assert.IsTrue (c.ActualHeight > 9 && c.ActualHeight < 9.2, "c actual.height == " + c.ActualHeight.ToString ()); }); }
public void ComputeLargerSize_StretchUniform_IntrinsicBorder () { Border b = new Border (); var c = new Path (); b.Child = c; c.Stretch = Stretch.Uniform; Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired0"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual0"); var data = new RectangleGeometry (); data.Rect = new Rect (0,10,25,23); c.Data = data; Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired1"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1"); Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot"); c.Measure (new Size (100, 100)); Assert.AreEqual (new Size (100,92), c.DesiredSize, "c desired2"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual2"); Assert.AreEqual (new Size (0,0), c.RenderSize, "c render2"); Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot2"); c.Arrange (new Rect (8,6,c.DesiredSize.Width,c.DesiredSize.Height)); Assert.AreEqual (new Size (100,92), c.DesiredSize, "c desired3"); Assert.AreEqual (new Size (100,92), new Size (c.ActualWidth,c.ActualHeight), "c actual3"); Assert.AreEqual (new Size (100,92), c.RenderSize, "c render3"); Assert.AreEqual (new Rect (8,6,100,92), LayoutInformation.GetLayoutSlot (c), "c slot3"); }
public void ComputeRestrainedSizeIntrinsicBorder () { Border b = new Border (); var c = new Path (); b.Child = c; Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired0"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual0"); var data = new RectangleGeometry (); data.Rect = new Rect (0,10,25,23); c.Data = data; Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired1"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1"); Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot"); c.Measure (new Size (10, 10)); Assert.AreEqual (new Size (10,10), c.DesiredSize, "c desired2"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual2"); Assert.AreEqual (new Size (0,0), c.RenderSize, "c render2"); Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot2"); c.Arrange (new Rect (10,10,c.DesiredSize.Width,c.DesiredSize.Height)); Assert.AreEqual (new Size (10,10), c.DesiredSize, "c desired"); Assert.AreEqual (new Size (25,33), new Size (c.ActualWidth,c.ActualHeight), "c actual3"); Assert.AreEqual (new Size (25,33), c.RenderSize, "c render"); Assert.AreEqual (new Rect (10,10,10,10), LayoutInformation.GetLayoutSlot (c), "c slot2"); }
public void ComputeActualSizeIntrinsic () { var c = new Path (); //Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired"); //Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1"); var data = new RectangleGeometry (); data.Rect = new Rect (0,10,25,23); c.Data = data; Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1"); Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot"); c.Measure (new Size (100, 100)); Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual2"); Assert.AreEqual (new Size (0,0), c.RenderSize, "c render"); c.Arrange (new Rect (0,0,c.DesiredSize.Width,c.DesiredSize.Height)); Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired"); Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual3"); Assert.AreEqual (new Size (0,0), c.RenderSize, "c render"); }