mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 22:44:05 +08:00
change: set the coordinate precision to 1 pixel
This commit is contained in:
@@ -7,8 +7,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/httprunner/funplugin"
|
"github.com/httprunner/funplugin"
|
||||||
|
|
||||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -438,8 +436,8 @@ type PointF struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p PointF) IsIdentical(p2 PointF) bool {
|
func (p PointF) IsIdentical(p2 PointF) bool {
|
||||||
return builtin.IsZeroFloat64(math.Abs(p.X-p2.X)) &&
|
// set the coordinate precision to 1 pixel
|
||||||
builtin.IsZeroFloat64(math.Abs(p.Y-p2.Y))
|
return math.Abs(p.X-p2.X) < 1 && math.Abs(p.Y-p2.Y) < 1
|
||||||
}
|
}
|
||||||
|
|
||||||
type Rect struct {
|
type Rect struct {
|
||||||
|
|||||||
@@ -483,9 +483,10 @@ func (box Box) IsEmpty() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (box Box) IsIdentical(box2 Box) bool {
|
func (box Box) IsIdentical(box2 Box) bool {
|
||||||
|
// set the coordinate precision to 1 pixel
|
||||||
return box.Point.IsIdentical(box2.Point) &&
|
return box.Point.IsIdentical(box2.Point) &&
|
||||||
builtin.IsZeroFloat64(math.Abs(box.Width-box2.Width)) &&
|
math.Abs(box.Width-box2.Width) < 1 &&
|
||||||
builtin.IsZeroFloat64(math.Abs(box.Height-box2.Height))
|
math.Abs(box.Height-box2.Height) < 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (box Box) Center() PointF {
|
func (box Box) Center() PointF {
|
||||||
|
|||||||
Reference in New Issue
Block a user