コード例 #1
0
ファイル: ApiTest.cs プロジェクト: valmont/CloudinaryDotNet
        public void TestTransformationClone()
        {
            // transformation should be cloneable
            Transformation transform1 = new Transformation().X(100).Y(100).Width(200).Crop("fill").Chain().Radius(10).Chain().Crop("crop").Width(100).Angle("12", "13", "14");
            Transformation transform2 = transform1.Clone();

            transform1 = transform1.Angle("22", "23").Chain().Crop("fill");

            Assert.AreEqual(3, transform1.NestedTransforms.Count);
            Assert.AreEqual(1, transform1.Params.Count);
            Assert.AreEqual(2, transform2.NestedTransforms.Count);
            Assert.AreEqual(3, transform2.Params.Count);
        }
コード例 #2
0
        public void TestCloneWithNested()
        {
            // transformation should be cloneable, including nested transformations
            Transformation transformation = new Transformation().X(100).Y(100).Width(200)
                                            .Crop("fill").Chain().Radius(10).Chain().Crop("crop").Width(100).Angle("12", "13", "14");

            Transformation clone = transformation.Clone();

            transformation.NestedTransforms[0].Width(300);
            transformation = transformation.Angle("22", "23").Chain().Crop("fill");

            Assert.AreEqual(transformation.Generate(),
                            "c_fill,w_300,x_100,y_100/r_10/a_22.23,c_crop,w_100/c_fill");
            Assert.AreEqual(clone.Generate(),
                            "c_fill,w_200,x_100,y_100/r_10/a_12.13.14,c_crop,w_100");
        }
コード例 #3
0
        public void TestUrlClone()
        {
            // url should be cloneable
            var layer          = new TextLayer("Hello").FontFamily("Arial").FontSize(10);
            var transformation = new Transformation().Angle(12).Overlay(layer);

            Url url1 = m_api.UrlImgUp.Transform(transformation);
            Url url2 = url1.Clone().Action("go");

            transformation.Angle(14);
            layer.FontSize(20);

            string result1 = url1.BuildUrl("test");
            string result2 = url2.BuildUrl("test");

            Assert.AreEqual(TestConstants.DefaultImageUpPath + "a_14,l_text:Arial_20:Hello/test", result1,
                            "Original Url should not be affected by changes to a cloned Url");
            Assert.AreEqual(TestConstants.DefaultRootPath + "image/go/a_12,l_text:Arial_10:Hello/test", result2,
                            "Cloned Url should not be affected by changes to source Url params and layers");
        }
コード例 #4
0
ファイル: ApiTest.cs プロジェクト: iitr-ankur/CloudinaryMono
        public void TestTransformationClone()
        {
            // transformation should be cloneable
            Transformation transform1 = new Transformation().X(100).Y(100).Width(200).Crop("fill").Chain().Radius(10).Chain().Crop("crop").Width(100).Angle("12", "13", "14");
            Transformation transform2 = transform1.Clone();
            transform1 = transform1.Angle("22", "23").Chain().Crop("fill");

            Assert.AreEqual(3, transform1.NestedTransforms.Count);
            Assert.AreEqual(1, transform1.Params.Count);
            Assert.AreEqual(2, transform2.NestedTransforms.Count);
            Assert.AreEqual(3, transform2.Params.Count);
        }