Exemple #1
0
        public void ImagePatternInCircle()
        {
            InitBlank(50, 50);
            context.Arc(25, 25, 20, 0, 360);
            var img = ReferenceImageManager.LoadReferenceImage("pattern-sample.png");

            context.Pattern = new Xwt.Drawing.ImagePattern(img);
            context.Fill();
            CheckImage("ImagePatternInCircle.png");
        }
Exemple #2
0
 public void Run(string[] args)
 {
     Application.Invoke(delegate {
         var r = new NUnitLite.Runner.TextUI(Console.Out);
         r.Execute(args);
         ReferenceImageManager.ShowImageVerifier();
         Application.Exit();
     });
     Application.Run();
 }
Exemple #3
0
        public void ImagePattern()
        {
            InitBlank(70, 70);
            context.Rectangle(5, 5, 40, 60);
            var img = ReferenceImageManager.LoadReferenceImage("pattern-sample.png");

            context.Pattern = new Xwt.Drawing.ImagePattern(img);
            context.Fill();
            CheckImage("ImagePattern.png");
        }
Exemple #4
0
        public void ImagePatternWithScaleTransformWithAlpha()
        {
            InitBlank(70, 70);
            context.Scale(2, 0.5);
            context.Rectangle(5, 5, 20, 120);
            var img = ReferenceImageManager.LoadReferenceImage("pattern-sample.png");

            context.Pattern = new Xwt.Drawing.ImagePattern(img.WithAlpha(0.5));
            context.Fill();
            CheckImage("ImagePatternWithScaleTransformWithAlpha.png");
        }
 public void CheckWidgetRender(string refImageName, Xwt.Widget widget, int winWidth = 300, int winHeight = 100)
 {
     using (var win = new Window {
         Width = winWidth, Height = winHeight
     }) {
         win.Content = widget;
         ShowWindow(win);
         var img = Toolkit.CurrentEngine.RenderWidget(widget);
         ReferenceImageManager.CheckImage(refImageName, img);
     }
 }
Exemple #6
0
        public void ImagePatternInTriangle()
        {
            InitBlank(50, 50);
            context.MoveTo(25, 5);
            context.LineTo(45, 20);
            context.LineTo(5, 45);
            context.ClosePath();
            var img = ReferenceImageManager.LoadReferenceImage("pattern-sample.png");

            context.Pattern = new Xwt.Drawing.ImagePattern(img);
            context.Fill();
            CheckImage("ImagePatternInTriangle.png");
        }
Exemple #7
0
        protected void CheckImage(string refImageName, double scaleFactor = 1)
        {
            if (builder == null)
            {
                return;
            }
            var img = builder.ToBitmap(scaleFactor);

            builder.Dispose();
            builder = null;

            ReferenceImageManager.CheckImage(refImageName, img);
        }
Exemple #8
0
        void CheckImage(string refImageName)
        {
            if (builder == null)
            {
                return;
            }
            var img = builder.ToBitmap((int)builder.Width, (int)builder.Height);

            builder.Dispose();
            builder = null;

            ReferenceImageManager.CheckImage(refImageName, img);
        }
        public void AlignCenterWrappedChangeText()
        {
            var la = new Label("Some text here");

            la.TextAlignment   = Alignment.Center;
            la.Wrap            = WrapMode.Word;
            la.WidthRequest    = 200;
            la.BackgroundColor = Xwt.Drawing.Colors.LightGray;

            using (var win = new Window {
                Width = 200, Height = 100
            }) {
                win.Content = la;
                ShowWindow(win);
                la.Text = "Some text here Some text here";
                WaitForEvents();
                var img = Toolkit.CurrentEngine.RenderWidget(la);
                ReferenceImageManager.CheckImage("Label.AlignCenterWrappedChangeText.png", img);
            }
        }
Exemple #10
0
        public void Init()
        {
            if (Toolkit.CurrentEngine == null)
            {
                var projName = Path.GetFileNameWithoutExtension(typeof(ReferenceImageManager).Assembly.CodeBase);

                if (projName.ToLower().Contains("gtk"))
                {
                    Xwt.Application.Initialize(Xwt.ToolkitType.Gtk);
                }
                else if (projName.ToLower().Contains("wpf"))
                {
                    Xwt.Application.Initialize(Xwt.ToolkitType.Wpf);
                }
                else if (projName.ToLower().Contains("mac"))
                {
                    Xwt.Application.Initialize(Xwt.ToolkitType.XamMac);
                }
                ReferenceImageManager.Init(projName);
            }
        }
 public void Init()
 {
     Application.Initialize(Xwt.ToolkitType.Cocoa);
     ReferenceImageManager.Init("MacTestRunner");
 }
Exemple #12
0
 public void Cleanup()
 {
     ReferenceImageManager.ShowImageVerifier();
 }
Exemple #13
0
 public void TearDown()
 {
     ReferenceImageManager.ShowImageVerifier();
 }