示例#1
0
 public static void CollectRegions(EyesBase eyes, EyesScreenshot screenshot,
                                   ICheckSettingsInternal checkSettingsInternal, ImageMatchSettings imageMatchSettings)
 {
     eyes.Logger.Verbose("enter");
     CollectSimpleRegions_(checkSettingsInternal, imageMatchSettings, eyes, screenshot);
     CollectFloatingRegions_(checkSettingsInternal, imageMatchSettings, eyes, screenshot);
     CollectAccessibilityRegions_(checkSettingsInternal, imageMatchSettings, eyes, screenshot);
     LogRegions_(eyes.Logger, imageMatchSettings);
     eyes.Logger.Verbose("exit");
 }
示例#2
0
        public MatchResult PerformMatch(IList <Trigger> userInputs,
                                        AppOutputWithScreenshot appOutput,
                                        string tag, bool replaceLast,
                                        ImageMatchSettings imageMatchSettings,
                                        EyesBase eyes, string source)
        {
            // called from regular flow and from check many flow.
            string agentSetupStr = eyes.GetAgentSetupString();

            return(PerformMatch_(userInputs, appOutput, tag, replaceLast, imageMatchSettings, agentSetupStr, source, null));
        }
        private static IMutableRegion[] CollectSimpleRegions_(EyesBase eyes,
                                                              EyesScreenshot screenshot, IGetRegions[] regionProviders, string type)
        {
            List <IMutableRegion> mutableRegions = new List <IMutableRegion>();

            foreach (IGetRegions regionProvider in regionProviders)
            {
                mutableRegions.AddRange(regionProvider.GetRegions(eyes, screenshot));
            }
            eyes.Logger.Log(TraceLevel.Debug, eyes.TestId, Stage.Check, new { type, regions = mutableRegions });
            return(mutableRegions.ToArray());
        }
示例#4
0
        private static IMutableRegion[] CollectSimpleRegions_(EyesBase eyes,
                                                              EyesScreenshot screenshot, IGetRegions[] regionProviders, string type)
        {
            eyes.Logger.Verbose("enter - region type: {0}", type);
            List <IMutableRegion> mutableRegions = new List <IMutableRegion>();

            foreach (IGetRegions regionProvider in regionProviders)
            {
                mutableRegions.AddRange(regionProvider.GetRegions(eyes, screenshot));
            }
            eyes.Logger.Verbose("exit");
            return(mutableRegions.ToArray());
        }
示例#5
0
        public MatchWindowTask(Logger logger, IServerConnector serverConnector,
                               RunningSession runningSession, TimeSpan retryTimeout,
                               EyesBase eyes)
        {
            ArgumentGuard.NotNull(logger, nameof(logger));
            ArgumentGuard.NotNull(serverConnector, nameof(serverConnector));
            ArgumentGuard.NotNull(runningSession, nameof(runningSession));

            Logger_              = logger;
            serverConnector_     = serverConnector;
            runningSession_      = runningSession;
            defaultRetryTimeout_ = (int)retryTimeout.TotalMilliseconds;
            getAppOutput_        = null;
            eyes_ = eyes;
        }
示例#6
0
        public MatchResult PerformMatch(AppOutputWithScreenshot appOutput,
                                        string tag, bool ignoreMismatch,
                                        ICheckSettingsInternal checkSettingsInternal,
                                        ImageMatchSettings imageMatchSettings,
                                        IList <IRegion> regions,
                                        IList <VisualGridSelector[]> regionSelectors,
                                        EyesBase eyes, string source, string renderId = null)
        {
            EyesScreenshot screenshot    = appOutput.Screenshot;
            string         agentSetupStr = eyes.GetAgentSetupString();

            CollectRegions_(imageMatchSettings, regions, regionSelectors);
            CollectRegions_(imageMatchSettings, checkSettingsInternal);
            return(PerformMatch_(new Trigger[0], appOutput, tag, ignoreMismatch, imageMatchSettings, agentSetupStr, source, renderId));
        }
 public IList <FloatingMatchSettings> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot)
 {
     return(new FloatingMatchSettings[] {
         new FloatingMatchSettings()
         {
             Left = rect_.Left,
             Top = rect_.Top,
             Width = rect_.Width,
             Height = rect_.Height,
             MaxLeftOffset = maxLeftOffset_,
             MaxUpOffset = maxUpOffset_,
             MaxRightOffset = maxRightOffset_,
             MaxDownOffset = maxDownOffset_
         }
     });
 }
示例#8
0
 public IList <AccessibilityRegionByRectangle> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot)
 {
     return(new AccessibilityRegionByRectangle[] { this });
 }
示例#9
0
        public static ImageMatchSettings CreateImageMatchSettings(ICheckSettingsInternal checkSettingsInternal, EyesBase eyes, EyesScreenshot screenshot)
        {
            eyes.Logger.Verbose("enter");
            ImageMatchSettings imageMatchSettings = CreateImageMatchSettings(checkSettingsInternal, eyes);

            if (imageMatchSettings != null)
            {
                CollectSimpleRegions_(checkSettingsInternal, imageMatchSettings, eyes, screenshot);
                CollectFloatingRegions_(checkSettingsInternal, imageMatchSettings, eyes, screenshot);
                CollectAccessibilityRegions_(checkSettingsInternal, imageMatchSettings, eyes, screenshot);
                LogRegions_(eyes.Logger, imageMatchSettings);
            }
            eyes.Logger.Verbose("exit");
            return(imageMatchSettings);
        }
示例#10
0
        public static ImageMatchSettings CreateImageMatchSettings(ICheckSettingsInternal checkSettingsInternal, EyesBase eyes)
        {
            ImageMatchSettings imageMatchSettings = null;

            if (checkSettingsInternal != null)
            {
                imageMatchSettings                       = eyes.DefaultMatchSettings.Clone();
                imageMatchSettings.MatchLevel            = checkSettingsInternal.GetMatchLevel() ?? eyes.MatchLevel;
                imageMatchSettings.IgnoreCaret           = checkSettingsInternal.GetIgnoreCaret() ?? eyes.IgnoreCaret;
                imageMatchSettings.UseDom                = checkSettingsInternal.GetUseDom() ?? eyes.UseDom;
                imageMatchSettings.EnablePatterns        = checkSettingsInternal.GetEnablePatterns() ?? eyes.EnablePatterns;
                imageMatchSettings.IgnoreDisplacements   = checkSettingsInternal.GetIgnoreDisplacements() ?? eyes.Config.IgnoreDisplacements;
                imageMatchSettings.AccessibilitySettings = eyes.Config.AccessibilityValidation;
            }
            return(imageMatchSettings);
        }
示例#11
0
        private static void CollectAccessibilityRegions_(ICheckSettingsInternal checkSettingsInternal,
                                                         ImageMatchSettings imageMatchSettings, EyesBase eyes,
                                                         EyesScreenshot screenshot)
        {
            eyes.Logger.Verbose("enter");
            List <AccessibilityRegionByRectangle> accessibilityRegions = new List <AccessibilityRegionByRectangle>();

            foreach (IGetAccessibilityRegion regionProvider in checkSettingsInternal.GetAccessibilityRegions())
            {
                accessibilityRegions.AddRange(regionProvider.GetRegions(eyes, screenshot));
            }
            imageMatchSettings.Accessibility = accessibilityRegions.ToArray();
            eyes.Logger.Verbose("exit");
        }
示例#12
0
        private static void CollectFloatingRegions_(ICheckSettingsInternal checkSettingsInternal,
                                                    ImageMatchSettings imageMatchSettings, EyesBase eyes,
                                                    EyesScreenshot screenshot)
        {
            eyes.Logger.Verbose("enter");
            List <FloatingMatchSettings> floatingRegions = new List <FloatingMatchSettings>();

            foreach (IGetFloatingRegion regionProvider in checkSettingsInternal.GetFloatingRegions())
            {
                floatingRegions.AddRange(regionProvider.GetRegions(eyes, screenshot));
            }
            imageMatchSettings.Floating = floatingRegions.ToArray();
            eyes.Logger.Verbose("exit");
        }
        private static void CollectFloatingRegions_(ICheckSettingsInternal checkSettingsInternal,
                                                    ImageMatchSettings imageMatchSettings, EyesBase eyes,
                                                    EyesScreenshot screenshot)
        {
            List <FloatingMatchSettings> floatingRegions = new List <FloatingMatchSettings>();

            foreach (IGetFloatingRegion regionProvider in checkSettingsInternal.GetFloatingRegions())
            {
                floatingRegions.AddRange(regionProvider.GetRegions(eyes, screenshot));
            }
            imageMatchSettings.Floating = floatingRegions.ToArray();
            eyes.Logger.Log(TraceLevel.Debug, eyes.TestId, Stage.Check,
                            new { type = "floating", regions = floatingRegions });
        }
示例#14
0
 private static void CollectSimpleRegions_(ICheckSettingsInternal checkSettingsInternal,
                                           ImageMatchSettings imageMatchSettings, EyesBase eyes,
                                           EyesScreenshot screenshot)
 {
     eyes.Logger.Verbose("enter");
     imageMatchSettings.Ignore  = CollectSimpleRegions_(eyes, screenshot, checkSettingsInternal.GetIgnoreRegions(), "Ignore");
     imageMatchSettings.Strict  = CollectSimpleRegions_(eyes, screenshot, checkSettingsInternal.GetStrictRegions(), "Strict");
     imageMatchSettings.Layout  = CollectSimpleRegions_(eyes, screenshot, checkSettingsInternal.GetLayoutRegions(), "Layout");
     imageMatchSettings.Content = CollectSimpleRegions_(eyes, screenshot, checkSettingsInternal.GetContentRegions(), "Content");
     eyes.Logger.Verbose("exit");
 }
        private static void CollectAccessibilityRegions_(ICheckSettingsInternal checkSettingsInternal,
                                                         ImageMatchSettings imageMatchSettings, EyesBase eyes,
                                                         EyesScreenshot screenshot)
        {
            List <AccessibilityRegionByRectangle> accessibilityRegions = new List <AccessibilityRegionByRectangle>();

            foreach (IGetAccessibilityRegion regionProvider in checkSettingsInternal.GetAccessibilityRegions())
            {
                accessibilityRegions.AddRange(regionProvider.GetRegions(eyes, screenshot));
            }
            imageMatchSettings.Accessibility = accessibilityRegions.ToArray();
            eyes.Logger.Log(TraceLevel.Debug, eyes.TestId, Stage.Check,
                            new { type = "accessibility", regions = accessibilityRegions });
        }
 public IList <IMutableRegion> GetRegions(EyesBase eyesBase, EyesScreenshot screenshot)
 {
     return(new IMutableRegion[] { region });
 }
示例#17
0
 internal void SetEyes(EyesBase eyes)
 {
     eyes_ = eyes;
 }
        public static ImageMatchSettings CreateImageMatchSettings(ICheckSettingsInternal checkSettingsInternal, EyesBase eyes, EyesScreenshot screenshot)
        {
            ImageMatchSettings imageMatchSettings = CreateImageMatchSettings(checkSettingsInternal, eyes);

            if (imageMatchSettings != null)
            {
                CollectSimpleRegions_(checkSettingsInternal, imageMatchSettings, eyes, screenshot);
                CollectFloatingRegions_(checkSettingsInternal, imageMatchSettings, eyes, screenshot);
                CollectAccessibilityRegions_(checkSettingsInternal, imageMatchSettings, eyes, screenshot);
            }
            eyes.Logger.Log(TraceLevel.Info, eyes.TestId, Stage.Check, new { regions = imageMatchSettings });
            return(imageMatchSettings);
        }