private static LayoutTransformControl CreateWithChildAndMeasureAndTransform(
                                                double width,
                                                double height,
                                                Transform transform)
        {
            var lt = new LayoutTransformControl()
            {
                LayoutTransform = transform,
                Template = new FuncControlTemplate<LayoutTransformControl>(
                                p => new ContentPresenter() { Content = p.Content })
            };

            lt.Content = new Rectangle() { Width = width, Height = height };

            lt.ApplyTemplate();

            //we need to force create visual child
            //so the measure after is correct
            (lt.Presenter as ContentPresenter).UpdateChild();

            Assert.NotNull(lt.Presenter?.Child);

            lt.Measure(Size.Infinity);
            lt.Arrange(new Rect(lt.DesiredSize));

            return lt;
        }
        private static void TransformRootBoundsTest(Size size, Transform transform, Rect expectedBounds)
        {
            LayoutTransformControl lt = CreateWithChildAndMeasureAndTransform(size.Width, size.Height, transform);

            Rect outBounds = lt.TransformRoot.Bounds;

            Assert.Equal(outBounds.X, expectedBounds.X);
            Assert.Equal(outBounds.Y, expectedBounds.Y);
            Assert.Equal(outBounds.Width, expectedBounds.Width);
            Assert.Equal(outBounds.Height, expectedBounds.Height);
        }
 public abstract void PushTransform(Transform transform);
        private static void TransformMeasureSizeTest(Size size, Transform transform, Size expectedSize)
        {
            LayoutTransformControl lt = CreateWithChildAndMeasureAndTransform(
                size.Width,
                size.Height,
                transform);

            Size outSize = lt.DesiredSize;

            Assert.Equal(outSize.Width, expectedSize.Width);
            Assert.Equal(outSize.Height, expectedSize.Height);
        }
 public override void PushTransform(Transform transform)
 {
     Matrix3x2 m = transform.Value.ToSharpDX();
     this.target.Transform = this.target.Transform * m;
     this.stack.Push(m);
 }