public ICheckSettings Accessibility(Rectangle region, AccessibilityRegionType regionType)
        {
            CheckSettings clone = Clone();

            clone.Accessibility_(region, regionType);
            return(clone);
        }
        protected virtual CheckSettings Clone()
        {
            CheckSettings clone = new CheckSettings();

            PopulateClone_(clone);
            return(clone);
        }
        public ICheckSettings VisualGridOptions(params VisualGridOption[] options)
        {
            CheckSettings clone = Clone();

            clone.visualGridOptions_ = (VisualGridOption[])options?.Clone();
            return(clone);
        }
        /// <summary>
        /// Defines that the screenshot will contain the entire element or region, even if it's outside the view.
        /// </summary>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings Fully()
        {
            CheckSettings clone = Clone();

            clone.stitchContent_ = true;
            return(clone);
        }
        protected void PopulateClone_(CheckSettings clone)
        {
            clone.targetRegion_        = targetRegion_;
            clone.matchLevel_          = matchLevel_;
            clone.stitchContent_       = stitchContent_;
            clone.timeout_             = timeout_;
            clone.ignoreCaret_         = ignoreCaret_;
            clone.sendDom_             = sendDom_;
            clone.name_                = name_;
            clone.useDom_              = useDom_;
            clone.replaceLast_         = replaceLast_;
            clone.enablePatterns_      = enablePatterns_;
            clone.ignoreDisplacements_ = ignoreDisplacements_;

            clone.ignoreRegions_.AddRange(ignoreRegions_);
            clone.contentRegions_.AddRange(contentRegions_);
            clone.layoutRegions_.AddRange(layoutRegions_);
            clone.strictRegions_.AddRange(strictRegions_);
            clone.floatingRegions_.AddRange(floatingRegions_);

            clone.accessibilityRegions_.AddRange(accessibilityRegions_);

            clone.visualGridOptions_ = (VisualGridOption[])visualGridOptions_?.Clone();

            foreach (KeyValuePair <string, string> kvp in scriptHooks_)
            {
                clone.scriptHooks_.Add(kvp.Key, kvp.Value);
            }
        }
        public ICheckSettings IgnoreDisplacements(bool ignoreDisplacements = true)
        {
            CheckSettings clone = Clone();

            clone.ignoreDisplacements_ = ignoreDisplacements;
            return(clone);
        }
        /// <summary>
        /// Adds a floating region.
        /// </summary>
        /// <param name="region">The content rectangle.</param>
        /// <param name="maxUpOffset">How much the content can move up.</param>
        /// <param name="maxDownOffset">How much the content can move down.</param>
        /// <param name="maxLeftOffset">How much the content can move to the left.</param>
        /// <param name="maxRightOffset">How much the content can move to the right.</param>
        /// <remarks>A floating region is a a region that can be placed within the boundries of a bigger region.</remarks>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings Floating(Rectangle region, int maxUpOffset, int maxDownOffset, int maxLeftOffset, int maxRightOffset)
        {
            CheckSettings clone = Clone();

            clone.Floating_(region, maxUpOffset, maxDownOffset, maxLeftOffset, maxRightOffset);
            return(clone);
        }
        public ICheckSettings Accessibility(AccessibilityRegionByRectangle region)
        {
            CheckSettings clone = Clone();

            clone.Accessibility_(region);
            return(clone);
        }
        /// <summary>
        /// Shortcut to set the match level to <see cref="MatchLevel.Content"/>.
        /// </summary>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings Content()
        {
            CheckSettings clone = Clone();

            clone.matchLevel_ = Applitools.MatchLevel.Content;
            return(clone);
        }
        /// <summary>
        /// Set the match level by which to compare the screenshot.
        /// </summary>
        /// <param name="matchLevel">The match level to use.</param>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings MatchLevel(MatchLevel matchLevel)
        {
            CheckSettings clone = Clone();

            clone.matchLevel_ = matchLevel;
            return(clone);
        }
        /// <summary>
        /// Shortcut to set the match level to <see cref="MatchLevel.Strict"/>.
        /// </summary>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings Strict()
        {
            CheckSettings clone = Clone();

            clone.matchLevel_ = Applitools.MatchLevel.Strict;
            return(clone);
        }
        /// <summary>
        /// Shortcut to set the match level to <see cref="MatchLevel.Layout"/>.
        /// </summary>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings Layout()
        {
            CheckSettings clone = Clone();

            clone.matchLevel_ = Applitools.MatchLevel.Layout;
            return(clone);
        }
Beispiel #13
0
        public ICheckSettings VariationGroupId(string variationGroupId)
        {
            CheckSettings clone = Clone();

            clone.variationGroupId_ = variationGroupId;
            return(clone);
        }
        public ICheckSettings EnablePatterns(bool enablePatterns = true)
        {
            CheckSettings clone = Clone();

            clone.enablePatterns_ = enablePatterns;
            return(clone);
        }
        public ICheckSettings BeforeRenderScreenshotHook(string hook)
        {
            CheckSettings clone = Clone();

            clone.scriptHooks_.Add(BEFORE_CAPTURE_SCREENSHOT, hook);
            return(clone);
        }
        public ICheckSettings ReplaceLast(bool replaceLast = true)
        {
            CheckSettings clone = Clone();

            clone.replaceLast_ = replaceLast;
            return(clone);
        }
        /// <summary>
        /// A setter for the checkpoint name.
        /// </summary>
        /// <param name="name">A name by which to identify the checkpoint.</param>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings WithName(string name)
        {
            CheckSettings clone = Clone();

            clone.name_ = name;
            return(clone);
        }
        public ICheckSettings UseDom(bool useDom = true)
        {
            CheckSettings clone = Clone();

            clone.useDom_ = useDom;
            return(clone);
        }
        /// <summary>
        /// Defines whether to send the document DOM or not.
        /// </summary>
        /// <param name="sendDom">When <c>true</c> sends the DOM to the server (the default).</param>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings SendDom(bool sendDom = true)
        {
            CheckSettings clone = Clone();

            clone.sendDom_ = sendDom;
            return(clone);
        }
        /// <summary>
        /// Defines if to detect and ignore a blinking caret in the screenshot. Defaults to <c>true</c>.
        /// </summary>
        /// <param name="ignoreCaret">Whether or not to detect and ignore a blinking caret in the screenshot.</param>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings IgnoreCaret(bool ignoreCaret = true)
        {
            CheckSettings clone = Clone();

            clone.ignoreCaret_ = ignoreCaret;
            return(clone);
        }
        /// <summary>
        /// Defines the timeout to use when aquiring and comparing screenshots.
        /// </summary>
        /// <param name="timeout">The timeout to use.</param>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings Timeout(TimeSpan timeout)
        {
            CheckSettings clone = Clone();

            clone.timeout_ = (int)timeout.TotalMilliseconds;
            return(clone);
        }
        /// <summary>
        /// Defines whether the screenshot will contain the entire element or region, even if it's outside the view.
        /// </summary>
        /// <param name="fully">Set the value of whether to take a full screenshot or not.</param>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings Fully(bool fully)
        {
            CheckSettings clone = Clone();

            clone.stitchContent_ = fully;
            return(clone);
        }
Beispiel #23
0
        public ICheckSettings EnablePatterns(bool enablePatterns = true)
        {
            CheckSettings clone = Clone();

            clone.enablePatterns_ = enablePatterns;
            clone.fluentCode_.Append($".{nameof(EnablePatterns)}({enablePatterns})");
            return(clone);
        }
Beispiel #24
0
        public ICheckSettings BeforeRenderScreenshotHook(string hook)
        {
            CheckSettings clone = Clone();

            clone.scriptHooks_.Add(BEFORE_CAPTURE_SCREENSHOT, hook);
            clone.fluentCode_.Append($".{nameof(BeforeRenderScreenshotHook)}({hook})");
            return(clone);
        }
Beispiel #25
0
        public ICheckSettings UseDom(bool useDom = true)
        {
            CheckSettings clone = Clone();

            clone.useDom_ = useDom;
            clone.fluentCode_.Append($".{nameof(UseDom)}({useDom})");
            return(clone);
        }
Beispiel #26
0
        public ICheckSettings IgnoreDisplacements(bool ignoreDisplacements = true)
        {
            CheckSettings clone = Clone();

            clone.ignoreDisplacements_ = ignoreDisplacements;
            clone.fluentCode_.Append($".{nameof(IgnoreDisplacements)}({ignoreDisplacements})");
            return(clone);
        }
Beispiel #27
0
        /// <summary>
        /// Defines whether to send the document DOM or not.
        /// </summary>
        /// <param name="sendDom">When <c>true</c> sends the DOM to the server (the default).</param>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings SendDom(bool sendDom = true)
        {
            CheckSettings clone = Clone();

            clone.sendDom_ = sendDom;
            clone.fluentCode_.Append($".{nameof(SendDom)}({sendDom})");
            return(clone);
        }
Beispiel #28
0
        public ICheckSettings ReplaceLast(bool replaceLast = true)
        {
            CheckSettings clone = Clone();

            clone.replaceLast_ = replaceLast;
            clone.fluentCode_.Append($".{nameof(ReplaceLast)}({replaceLast})");
            return(clone);
        }
Beispiel #29
0
        /// <summary>
        /// Defines if to detect and ignore a blinking caret in the screenshot. Defaults to <c>true</c>.
        /// </summary>
        /// <param name="ignoreCaret">Whether or not to detect and ignore a blinking caret in the screenshot.</param>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings IgnoreCaret(bool ignoreCaret = true)
        {
            CheckSettings clone = Clone();

            clone.ignoreCaret_ = ignoreCaret;
            clone.fluentCode_.Append($".{nameof(IgnoreCaret)}({ignoreCaret})");
            return(clone);
        }
Beispiel #30
0
        /// <summary>
        /// A setter for the checkpoint name.
        /// </summary>
        /// <param name="name">A name by which to identify the checkpoint.</param>
        /// <returns>An updated clone of this settings object.</returns>
        public ICheckSettings WithName(string name)
        {
            CheckSettings clone = Clone();

            clone.name_ = name;
            clone.fluentCode_.Append($".{nameof(WithName)}(\"{name}\")");
            return(clone);
        }