From d1c30000a7c2ec96c44701ab0d586cfb550ec48c Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Thu, 21 Sep 2023 21:44:36 +0800 Subject: [PATCH] change: set the coordinate precision to 1 pixel --- hrp/pkg/uixt/interface.go | 6 ++---- hrp/pkg/uixt/service_vedem.go | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hrp/pkg/uixt/interface.go b/hrp/pkg/uixt/interface.go index e292d93c..71d8e177 100644 --- a/hrp/pkg/uixt/interface.go +++ b/hrp/pkg/uixt/interface.go @@ -7,8 +7,6 @@ import ( "time" "github.com/httprunner/funplugin" - - "github.com/httprunner/httprunner/v4/hrp/internal/builtin" ) var ( @@ -438,8 +436,8 @@ type PointF struct { } func (p PointF) IsIdentical(p2 PointF) bool { - return builtin.IsZeroFloat64(math.Abs(p.X-p2.X)) && - builtin.IsZeroFloat64(math.Abs(p.Y-p2.Y)) + // set the coordinate precision to 1 pixel + return math.Abs(p.X-p2.X) < 1 && math.Abs(p.Y-p2.Y) < 1 } type Rect struct { diff --git a/hrp/pkg/uixt/service_vedem.go b/hrp/pkg/uixt/service_vedem.go index beb18e80..1660431e 100644 --- a/hrp/pkg/uixt/service_vedem.go +++ b/hrp/pkg/uixt/service_vedem.go @@ -483,9 +483,10 @@ func (box Box) IsEmpty() bool { } func (box Box) IsIdentical(box2 Box) bool { + // set the coordinate precision to 1 pixel return box.Point.IsIdentical(box2.Point) && - builtin.IsZeroFloat64(math.Abs(box.Width-box2.Width)) && - builtin.IsZeroFloat64(math.Abs(box.Height-box2.Height)) + math.Abs(box.Width-box2.Width) < 1 && + math.Abs(box.Height-box2.Height) < 1 } func (box Box) Center() PointF {