Ejemplo n.º 1
0
    def test_bezier_curve(self):
        """
        BezierCurves are output correctly.
        """

        writer = KiCAD()
        bezier = BezierCurve((0, 0), (1, 1), (2, 2), (3, 3))
        line = writer.get_shape_line(bezier)
        self.assertEqual(line, 'P 2 %(unit)d %(convert)d 0 22 22 33 33 N\n')
Ejemplo n.º 2
0
    def test_arc(self):
        """
        Arcs are output correctly.
        """

        writer = KiCAD()
        arc = Arc(0, 0, -0.5, 0.5, 1)
        line = writer.get_shape_line(arc)
        self.assertEqual(line, 'A 0 0 11 900 -900 %(unit)d %(convert)d 0 N\n')
Ejemplo n.º 3
0
    def test_rectangle(self):
        """
        Rectangles are output correctly.
        """

        writer = KiCAD()
        rect = Rectangle(10, 20, 5, 10)
        line = writer.get_shape_line(rect)
        self.assertEqual(line, 'S 111 222 167 111 %(unit)d %(convert)d 0 N\n')
Ejemplo n.º 4
0
    def test_arc(self):
        """
        Arcs are output correctly.
        """

        writer = KiCAD()
        arc = Arc(0, 0, -0.5, 0.5, 1)
        line = writer.get_shape_line(arc)
        self.assertEqual(line, 'A 0 0 11 900 -900 %(unit)d %(convert)d 0 N\n')
Ejemplo n.º 5
0
    def test_rectangle(self):
        """
        Rectangles are output correctly.
        """

        writer = KiCAD()
        rect = Rectangle(10, 20, 5, 10)
        line = writer.get_shape_line(rect)
        self.assertEqual(line, 'S 111 222 167 111 %(unit)d %(convert)d 0 N\n')
Ejemplo n.º 6
0
    def test_bezier_curve(self):
        """
        BezierCurves are output correctly.
        """

        writer = KiCAD()
        bezier = BezierCurve((0, 0), (1, 1), (2, 2), (3, 3))
        line = writer.get_shape_line(bezier)
        self.assertEqual(line, 'P 2 %(unit)d %(convert)d 0 22 22 33 33 N\n')
Ejemplo n.º 7
0
    def test_polygon(self):
        """
        Polygons are output correctly.
        """

        writer = KiCAD()
        poly = Polygon()
        poly.add_point(0, 0)
        poly.add_point(0, 10)
        poly.add_point(10, 10)
        poly.add_point(10, 0)
        line = writer.get_shape_line(poly)
        self.assertEqual(line, 'P 5 %(unit)d %(convert)d 0 0 0 0 111 111 111 111 0 0 0 N\n')
Ejemplo n.º 8
0
    def test_rectangle(self):
        """
        Rectangles are output correctly.
        """

        writer = KiCAD()
        rect = Rectangle(10, 20, 5, 10)
        line = writer.get_shape_line(rect)
        self.assertEqual(line, 'S ' + str(int(10 / MULT)) + ' '
            + str(int(20 / MULT)) + ' '
            + str(int(15 / MULT)) + ' '
            + str(int(10 / MULT)) + ' '
            + '%(unit)d %(convert)d 0 N\n')
Ejemplo n.º 9
0
    def test_polygon(self):
        """
        Polygons are output correctly.
        """

        writer = KiCAD()
        poly = Polygon()
        poly.add_point(0, 0)
        poly.add_point(0, 10)
        poly.add_point(10, 10)
        poly.add_point(10, 0)
        line = writer.get_shape_line(poly)
        self.assertEqual(
            line, 'P 5 %(unit)d %(convert)d 0 0 0 0 111 111 111 111 0 0 0 N\n')