void IVisualAnalyzer.Compare()
        {
            MagickImage magickBaseImg   = new MagickImage(mAct.baseImage);
            MagickImage magickTargetImg = new MagickImage(mAct.targetImage);

            var diffImg = new MagickImage();

            double percentageDifference;

            // TODO: add combo with list of options for user to choose the Error Matic and Cahnnels
            ActInputValue AIV = mAct.GetOrCreateInputParam(ActVisualTesting.Fields.ErrorMetric);

            //TODO: fix me - removed hard code
            //caused build problem on build machine so temp fix for now
            ErrorMetric EM = ErrorMetric.Fuzz;

            percentageDifference = magickBaseImg.Compare(magickTargetImg, EM, diffImg, Channels.Red);
            percentageDifference = percentageDifference * 100;
            percentageDifference = Math.Round(percentageDifference, 2);

            Bitmap ImgToSave = diffImg.ToBitmap();

            mAct.CompareResult = ImgToSave;

            mAct.AddOrUpdateReturnParamActual("Percentage Difference", percentageDifference + "");

            mAct.AddScreenShot(ImgToSave, "Compare Result");
        }
示例#2
0
        public UIElementsComparisonPage(ActVisualTesting mAct)
        {
            InitializeComponent();
            InitLayout();

            BaselineInfoFileUCVE.Init(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.BaselineInfoFile), true, true, UCValueExpression.eBrowserType.File, "*", BaselineInfoFileUCVE_FileSelected);
        }
示例#3
0
        public ActVisualTestingEditPage(GingerCore.Actions.ActVisualTesting Act)
        {
            InitializeComponent();
            this.mAct = Act;

            //Visual Testing Engine
            VisualTestingEngineComboBox.Init(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.VisualAnalyzer, ActVisualTesting.eVisualTestingAnalyzer.BitmapPixelsComparison.ToString()), typeof(ActVisualTesting.eVisualTestingAnalyzer), false, new SelectionChangedEventHandler(VisualTestingEngineComboBox_SelectionChanged));

            //Saved baseline image path for that action
            CurrentBaselineImagePathTxtBox.Init(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.SavedBaseImageFilenameString), true, true, UCValueExpression.eBrowserType.File, "*", BaseLineFileSelected_Click);
            UpdateBaseLineImage();
            //TODO: hook value change and update

            CurrentBaselineImagePathTxtBox.ValueTextBox.TextChanged += ValueTextBox_TextChanged;
            //Saved Applitools baseline image path

            //Saved Target image file path
            TargetImageFileNameUCVE.Init(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.SavedTargetImageFilenameString), true, true, UCValueExpression.eBrowserType.File, "*", BrowseTargetImageFromFile_Click);
            UpdateTargetImage();

            ShowCompareResult();
            ChangeAppScreenSizeComboBox.Init(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.ChangeAppWindowSize, ActVisualTesting.eChangeAppWindowSize.None.ToString()), typeof(ActVisualTesting.eChangeAppWindowSize), false, new SelectionChangedEventHandler(ChangeAppWindowSize_Changed));

            WidthUCVE.BindControl(mAct, ActVisualTesting.Fields.SetAppWindowWidth);
            HeightUCVE.BindControl(mAct, ActVisualTesting.Fields.SetAppWindowHeight);

            if (mAct.IsTargetSourceFromScreenshot)
            {
                TargetScreenShotRadioButton.IsChecked = true;
            }
            else
            {
                TargetImageFileRadioButton.IsChecked = true;
            }

            if (mAct.CreateBaselineAction)
            {
                CreateBaselineRadioButton.IsChecked = true;
            }
            else
            {
                CompareRadioButton.IsChecked = true;
            }

            mAct.PropertyChanged += mAct_PropertyChanged;
        }
        public BitmapPixelsComaprePage(ActVisualTesting mAct)
        {
            InitializeComponent();

            InitLayout();
            ActInputValue AIV = mAct.GetOrCreateInputParam(ActVisualTesting.Fields.ErrorMetric);

            ErrorMetricComboBox.Init(AIV, typeof(ImageMagick.ErrorMetric));
        }
示例#5
0
 private string GetApplitoolsAPIKey()
 {
     return(mAct.GetOrCreateInputParam(ActVisualTesting.Fields.ApplitoolsKey).ValueForDriver);
 }