public void TestTransformationLayersDeepClone()
        {
            // layers should be cloned
            var layer          = new TextLayer("Hello").FontSize(10).FontFamily("Arial");
            var transformation = new Transformation().Overlay(layer);

            var clone = transformation.Clone();

            layer.FontSize(20);

            Assert.AreEqual(transformation.Generate(), "l_text:Arial_20:Hello");
            Assert.AreEqual(clone.Generate(), "l_text:Arial_10:Hello");
        }
Exemple #2
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");
        }