Beispiel #1
0
        public void TestWaterMarkRegex()
        {
            Dictionary <string, TextLayer> data = new Dictionary <string, TextLayer>
            {
                {
                    "watermark=text-watermark goodness,color-fff,size-36,style-italic,opacity-80,position-30,150,shadow-true,font-arial",
                    new TextLayer
                    {
                        Text       = "watermark goodness",
                        FontColor  = ColorTranslator.FromHtml("#" + "ffffff"),
                        FontSize   = 36,
                        Style      = FontStyle.Italic,
                        Opacity    = 80,
                        Position   = new Point(30, 150),
                        DropShadow = true,
                        FontFamily = new FontFamily("arial")
                    }
                },
                {
                    "watermark=watermark goodness&color=fff&fontsize=36&fontstyle=italic&fontopacity=80&textposition=30,150&textshadow=true&fontfamily=arial",
                    new TextLayer
                    {
                        Text       = "watermark goodness",
                        FontColor  = ColorTranslator.FromHtml("#" + "ffffff"),
                        FontSize   = 36,
                        Style      = FontStyle.Italic,
                        Opacity    = 80,
                        Position   = new Point(30, 150),
                        DropShadow = true,
                        FontFamily = new FontFamily("arial")
                    }
                },
                {
                    "watermark=watermark goodness&color=fff&fontsize=36&fontstyle=italic&fontopacity=80&watermark.position=30,150&textshadow=true&fontfamily=arial",
                    new TextLayer
                    {
                        Text       = "watermark goodness",
                        FontColor  = ColorTranslator.FromHtml("#" + "ffffff"),
                        FontSize   = 36,
                        Style      = FontStyle.Italic,
                        Opacity    = 80,
                        Position   = new Point(30, 150),
                        DropShadow = true,
                        FontFamily = new FontFamily("arial")
                    }
                }
            };

            Processors.Watermark watermark = new Processors.Watermark();
            foreach (KeyValuePair <string, TextLayer> item in data)
            {
                watermark.MatchRegexIndex(item.Key);
                TextLayer result = watermark.Processor.DynamicParameter;
                Assert.AreEqual(item.Value, result);
            }
        }
        public void TestWaterMarkRegex()
        {
            Dictionary <string, TextLayer> data = new Dictionary <string, TextLayer>
            {
                {
                    "watermark=watermark goodness&color=fff&fontsize=36&fontstyle=italic&fontopacity=80&textposition=30,150&dropshadow=true&fontfamily=arial",
                    new TextLayer
                    {
                        Text       = "watermark goodness",
                        FontColor  = ColorTranslator.FromHtml("#" + "ffffff"),
                        FontSize   = 36,
                        Style      = FontStyle.Italic,
                        Opacity    = 80,
                        Position   = new Point(30, 150),
                        DropShadow = true,
                        FontFamily = new FontFamily("arial")
                    }
                },
                {
                    "watermark=لا أحد يحب الألم بذاته، يسعى ورائه أو يبتغيه، ببساطة لأنه الألم&color=fff&fontsize=36&fontstyle=italic&fontopacity=80&textposition=30,150&dropshadow=true&fontfamily=arial&vertical=true&rtl=true",
                    new TextLayer
                    {
                        Text        = "لا أحد يحب الألم بذاته، يسعى ورائه أو يبتغيه، ببساطة لأنه الألم",
                        FontColor   = ColorTranslator.FromHtml("#" + "ffffff"),
                        FontSize    = 36,
                        Style       = FontStyle.Italic,
                        Opacity     = 80,
                        Position    = new Point(30, 150),
                        DropShadow  = true,
                        FontFamily  = new FontFamily("arial"),
                        Vertical    = true,
                        RightToLeft = true
                    }
                }
            };

            Processors.Watermark watermark = new Processors.Watermark();
            foreach (KeyValuePair <string, TextLayer> item in data)
            {
                watermark.MatchRegexIndex(item.Key);
                TextLayer result = watermark.Processor.DynamicParameter;
                Assert.AreEqual(item.Value, result);
            }
        }
        public void TestWaterMarkRegex()
        {
            Dictionary<string, TextLayer> data = new Dictionary<string, TextLayer>
            {
                {
                    "watermark=watermark goodness&color=fff&fontsize=36&fontstyle=italic&fontopacity=80&textposition=30,150&dropshadow=true&fontfamily=arial", 
                    new TextLayer
                        {
                            Text = "watermark goodness", 
                            FontColor = ColorTranslator.FromHtml("#" + "ffffff"), 
                            FontSize = 36,
                            Style = FontStyle.Italic,
                            Opacity = 80, 
                            Position = new Point(30, 150),
                            DropShadow = true, 
                            FontFamily = new FontFamily("arial") 
                        }
                },
                {
                    "watermark=لا أحد يحب الألم بذاته، يسعى ورائه أو يبتغيه، ببساطة لأنه الألم&color=fff&fontsize=36&fontstyle=italic&fontopacity=80&textposition=30,150&dropshadow=true&fontfamily=arial&vertical=true&rtl=true", 
                    new TextLayer
                        {
                            Text = "لا أحد يحب الألم بذاته، يسعى ورائه أو يبتغيه، ببساطة لأنه الألم", 
                            FontColor = ColorTranslator.FromHtml("#" + "ffffff"), 
                            FontSize = 36,
                            Style = FontStyle.Italic,
                            Opacity = 80, 
                            Position = new Point(30, 150),
                            DropShadow = true, 
                            FontFamily = new FontFamily("arial"),
                            Vertical = true,
                            RightToLeft = true
                        }
                }
            };

            Processors.Watermark watermark = new Processors.Watermark();
            foreach (KeyValuePair<string, TextLayer> item in data)
            {
                watermark.MatchRegexIndex(item.Key);
                TextLayer result = watermark.Processor.DynamicParameter;
                Assert.AreEqual(item.Value, result);
            }
        }