示例#1
0
            public void ShouldSetThePropertiesToTheDefaultValue()
            {
                var affine = new DrawableAffine();

                affine.ScaleX     = 2.0;
                affine.ScaleY     = 3.0;
                affine.ShearX     = 4.0;
                affine.ShearY     = 5.0;
                affine.TranslateX = 6.0;
                affine.TranslateY = 7.0;

                affine.Reset();

                Assert.Equal(1.0, affine.ScaleX);
                Assert.Equal(1.0, affine.ScaleY);
                Assert.Equal(0.0, affine.ShearX);
                Assert.Equal(0.0, affine.ShearY);
                Assert.Equal(0.0, affine.TranslateX);
                Assert.Equal(0.0, affine.TranslateY);
            }
        public void Test_Reset()
        {
            DrawableAffine affine = new DrawableAffine();

            Assert.Equal(1.0, affine.ScaleX);
            Assert.Equal(1.0, affine.ScaleY);
            Assert.Equal(0.0, affine.ShearX);
            Assert.Equal(0.0, affine.ShearY);
            Assert.Equal(0.0, affine.TranslateX);
            Assert.Equal(0.0, affine.TranslateY);

            affine.ScaleX = 2.0;
            Assert.Equal(2.0, affine.ScaleX);
            Assert.Equal(1.0, affine.ScaleY);
            Assert.Equal(0.0, affine.ShearX);
            Assert.Equal(0.0, affine.ShearY);
            Assert.Equal(0.0, affine.TranslateX);
            Assert.Equal(0.0, affine.TranslateY);

            affine.ScaleY = 3.0;
            Assert.Equal(2.0, affine.ScaleX);
            Assert.Equal(3.0, affine.ScaleY);
            Assert.Equal(0.0, affine.ShearX);
            Assert.Equal(0.0, affine.ShearY);
            Assert.Equal(0.0, affine.TranslateX);
            Assert.Equal(0.0, affine.TranslateY);

            affine.ShearX = 4.0;
            Assert.Equal(2.0, affine.ScaleX);
            Assert.Equal(3.0, affine.ScaleY);
            Assert.Equal(4.0, affine.ShearX);
            Assert.Equal(0.0, affine.ShearY);
            Assert.Equal(0.0, affine.TranslateX);
            Assert.Equal(0.0, affine.TranslateY);

            affine.ShearY = 5.0;
            Assert.Equal(2.0, affine.ScaleX);
            Assert.Equal(3.0, affine.ScaleY);
            Assert.Equal(4.0, affine.ShearX);
            Assert.Equal(5.0, affine.ShearY);
            Assert.Equal(0.0, affine.TranslateX);
            Assert.Equal(0.0, affine.TranslateY);

            affine.TranslateX = 6.0;
            Assert.Equal(2.0, affine.ScaleX);
            Assert.Equal(3.0, affine.ScaleY);
            Assert.Equal(4.0, affine.ShearX);
            Assert.Equal(5.0, affine.ShearY);
            Assert.Equal(6.0, affine.TranslateX);
            Assert.Equal(0.0, affine.TranslateY);

            affine.TranslateY = 7.0;
            Assert.Equal(2.0, affine.ScaleX);
            Assert.Equal(3.0, affine.ScaleY);
            Assert.Equal(4.0, affine.ShearX);
            Assert.Equal(5.0, affine.ShearY);
            Assert.Equal(6.0, affine.TranslateX);
            Assert.Equal(7.0, affine.TranslateY);

            affine.Reset();
            Assert.Equal(1.0, affine.ScaleX);
            Assert.Equal(1.0, affine.ScaleY);
            Assert.Equal(0.0, affine.ShearX);
            Assert.Equal(0.0, affine.ShearY);
            Assert.Equal(0.0, affine.TranslateX);
            Assert.Equal(0.0, affine.TranslateY);
        }