Skip to content
This repository was archived by the owner on Aug 10, 2022. It is now read-only.

Commit 7e35942

Browse files
committed
Add ignore_displacement
1 parent e99bc92 commit 7e35942

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

eyes_common/applitools/common/match.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class ImageMatchSettings(object):
9797
send_dom = attr.ib(default=False, metadata={JsonInclude.THIS: True})
9898
use_dom = attr.ib(default=False, metadata={JsonInclude.THIS: True})
9999
enable_patterns = attr.ib(default=False, metadata={JsonInclude.THIS: True})
100+
ignore_displacement = attr.ib(default=False, metadata={JsonInclude.THIS: True})
100101

101102
ignore = attr.ib(
102103
factory=list, type=typing.List[Region], metadata={JsonInclude.THIS: True}

eyes_core/applitools/core/eyes_base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,10 @@ def _match_window(self, region_provider, tag, ignore_mismatch, check_settings):
703703
check_settings = check_settings.ignore_caret(
704704
get_config_value("enable_patterns")
705705
)
706+
if check_settings.values.ignore_displacement is None:
707+
check_settings = check_settings.ignore_displacement(
708+
self.configuration.default_match_settings.ignore_displacement
709+
)
706710

707711
region = region_provider.get_region()
708712
logger.debug("params: ([{}], {}, {})".format(region, tag, retry_timeout_ms))

eyes_core/applitools/core/fluent/check_settings.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ class CheckSettingsValues(object):
3131
target_region = attr.ib(init=False, default=None) # type: Optional[Region]
3232
timeout = attr.ib(init=False, default=-1) # type: Num # milliseconds
3333

34-
ignore_caret = attr.ib(init=False, default=False) # type: bool
35-
stitch_content = attr.ib(init=False, default=False) # type: bool
34+
ignore_caret = attr.ib(init=False, default=None) # type: bool
35+
stitch_content = attr.ib(init=False, default=None) # type: bool
3636
match_level = attr.ib(init=False, default=None) # type: Optional[MatchLevel]
3737
name = attr.ib(init=False, default=None) # type: Optional[Text]
3838

39-
send_dom = attr.ib(init=False, default=False) # type: bool
40-
use_dom = attr.ib(init=False, default=False)
41-
enable_patterns = attr.ib(init=False, default=False)
39+
send_dom = attr.ib(init=False, default=None) # type: bool
40+
use_dom = attr.ib(init=False, default=None)
41+
enable_patterns = attr.ib(init=False, default=None)
42+
ignore_displacement = attr.ib(init=False, default=None)
43+
4244
ignore_regions = attr.ib(init=False, factory=list) # type: List[GetRegion]
4345
layout_regions = attr.ib(init=False, factory=list) # type: List[GetRegion]
4446
strict_regions = attr.ib(init=False, factory=list) # type: List[GetRegion]
@@ -224,6 +226,11 @@ def enable_patterns(self, enable=True):
224226
self.values.enable_patterns = enable
225227
return self
226228

229+
def ignore_displacement(self, should_ignore=True):
230+
# type: (bool) -> CheckSettings
231+
self.values.ignore_displacement = should_ignore
232+
return self
233+
227234
def __regions(self, regions, method_name):
228235
if not regions:
229236
raise TypeError(

eyes_core/applitools/core/match_window_task.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ def _try_take_screenshot(
279279
send_dom=check_settings.values.send_dom,
280280
use_dom=check_settings.values.use_dom,
281281
enable_patterns=check_settings.values.enable_patterns,
282+
ignore_displacement=check_settings.values.ignore_displacement,
282283
)
283284
self._match_result = self.perform_match(
284285
app_output,

0 commit comments

Comments
 (0)