Beispiel #1
0
    def find_box_corners(self, x, y, width, height):
        assert not self.obj.ignored

        tl, tr, br, bl = image.find_box_corners(self.obj.surface.surface, self.matrix, x, y, width, height)

        tolerance = defs.find_box_corners_tolerance
        if (
            abs(x - tl[0]) > tolerance
            or abs(y - tl[1]) > tolerance
            or abs(x + width - tr[0]) > tolerance
            or abs(y - tr[1]) > tolerance
            or abs(x + width - br[0]) > tolerance
            or abs(y + height - br[1]) > tolerance
            or abs(x - bl[0]) > tolerance
            or abs(y + height - bl[1]) > tolerance
        ):
            raise AssertionError("The found values differ too much from where the box should be.")
        return tl, tr, br, bl
Beispiel #2
0
    def find_box_corners(self, x, y, width, height):
        assert (not self.obj.ignored)

        tl, tr, br, bl = image.find_box_corners(self.obj.surface.surface,
                                                self.matrix, x, y, width,
                                                height)

        tolerance = defs.find_box_corners_tolerance
        if (abs(x - tl[0]) > tolerance or abs(y - tl[1]) > tolerance
                or abs(x + width - tr[0]) > tolerance
                or abs(y - tr[1]) > tolerance
                or abs(x + width - br[0]) > tolerance
                or abs(y + height - br[1]) > tolerance
                or abs(x - bl[0]) > tolerance
                or abs(y + height - bl[1]) > tolerance):
            raise AssertionError(
                "The found values differ too much from where the box should be."
            )
        return tl, tr, br, bl