Пример #1
0
    def test_no_inside_first_and_optimised(self, make_args, red, green, blue):
        args = make_args("--all --no-inside-first --no-over-cut")

        outlines = MultiLineString(args_to_outlines(args))
        expected = MultiLineString(
            list(self.dereg(green).geoms) + list(self.dereg(blue).geoms) +
            list(self.dereg(red).geoms))
        assert outlines == expected
Пример #2
0
    def test_native_order(self, make_args, red, green, blue):
        args = make_args("--all --native-order --no-over-cut")

        outlines = MultiLineString(args_to_outlines(args))
        expected = MultiLineString(
            list(self.dereg(red).geoms) + list(self.dereg(blue).geoms) +
            list(self.dereg(green).geoms))
        assert outlines == expected
Пример #3
0
    def test_colour(self, make_args, blue):
        # Check that colour filtering works
        args = make_args("--all --color #0000FF")

        outlines = MultiLineString(args_to_outlines(args))
        expected = self.dereg(blue)
        assert not outlines.is_empty
        assert outlines.difference(expected).is_empty
Пример #4
0
    def test_defaults(self, make_args, red):
        # By default:
        # * The registration marks should be used
        # * Just the cutting layer should be used (red line)
        # * The red line should be drawn from the (0, 0) end first
        args = make_args("")

        outlines = MultiLineString(args_to_outlines(args))
        expected = self.dereg(red)
        assert outlines == expected
Пример #5
0
    def test_exclude_regmarks(self, make_args, regmarks, red, green, blue):
        args = make_args("--all")

        outlines = MultiLineString(args_to_outlines(args))
        expected = cascaded_union([
            self.dereg(red),
            self.dereg(green),
            self.dereg(blue),
        ])
        assert not outlines.is_empty
        assert outlines.difference(expected).is_empty
Пример #6
0
    def test_regmarks_disabled(self, make_args, red):
        # When regmarks are disabled
        # * The registration marks should not be used (and the coordinates
        #   should not be offset)
        # * Just the cutting layer should be used (red line) as the regmarks
        #   aren't on a cutting layer anyway.
        # * The red line should be drawn from the (0, 0) end first
        args = make_args("--no-regmarks")

        outlines = MultiLineString(args_to_outlines(args))
        expected = red
        assert outlines == expected
Пример #7
0
    def test_regmarks_included_when_not_used(self, make_args, regmarks, red,
                                             green, blue):
        args = make_args("--all --no-regmarks")

        outlines = MultiLineString(args_to_outlines(args))
        expected = cascaded_union([
            regmarks,
            red,
            green,
            blue,
        ])
        assert not outlines.is_empty
        assert outlines.difference(expected).is_empty
Пример #8
0
    def test_no_over_cut(self, make_args, red, green, blue, extra_args):
        args = make_args("--all --fast-order --inside-first " + extra_args)
        green_shifted = MultiLineString([[
            (70, 85),
            (70, 15),
            (30, 15),
            (30, 85),
            (70, 85),
        ]])
        # Sanity check
        assert green_shifted.difference(green).is_empty

        outlines = MultiLineString(args_to_outlines(args))
        expected = MultiLineString(
            list(self.dereg(blue).geoms) + list(self.dereg(red).geoms) +
            list(self.dereg(green_shifted).geoms))
        assert outlines == expected
Пример #9
0
    def test_inside_first_and_optimised(self, make_args, red, green, blue):
        args = make_args("--all --no-over-cut")

        # Re-order points so definition starts with bottom-right corner (which
        # is nearest point to end of red line)
        green_shifted = MultiLineString([[
            (70, 85),
            (70, 15),
            (30, 15),
            (30, 85),
            (70, 85),
        ]])
        # Sanity check
        assert green_shifted.difference(green).is_empty

        outlines = MultiLineString(args_to_outlines(args))
        expected = MultiLineString(
            list(self.dereg(blue).geoms) + list(self.dereg(red).geoms) +
            list(self.dereg(green_shifted).geoms))
        assert outlines == expected