コード例 #1
0
    def test_getLayerColor(self, fake_dwg, *arg):

        app_data = self.fake_appData()
        assert DxfDraw(app_data).getLayerColor('layer1') == 1
        assert DxfDraw(app_data).getLayerColor() == '7'

        pass
コード例 #2
0
    def test_getLayer(self, fake_dwg, *arg):

        app_data = self.fake_appData()
        assert DxfDraw(app_data).getLayer('layer1') == "FAKE-LAYER-1"
        assert DxfDraw(app_data).getLayer() == '0'

        pass
コード例 #3
0
 def test_makeDxf(self, *arg):
     with patch.object(VPort, 'createVPortTable') as fake_VPort, \
         patch.object(DxfDraw, "drawEntities") as fake_drawEntities:
         app_data = self.fake_appData()
         DxfDraw(app_data).makeDxf({}, 2)
         fake_VPort.assert_called_once()
         fake_drawEntities.assert_called_once()
コード例 #4
0
    def test_addDxfHatch(self, fake_dwg, fake_getLayer, fake_getLayerColor,
                         *arg):

        app_data = self.fake_appData()

        fake_msp = Mock()
        type(fake_dwg.return_value).modelspace = fake_msp
        fake_add_hatch = Mock()
        type(fake_msp.return_value).add_hatch = fake_add_hatch
        fake_edit_boundary = Mock()
        type(fake_add_hatch.return_value).edit_boundary = fake_edit_boundary
        fake_add_polyline_path = Mock()
        fake_enter = Mock(side_effect=lambda: fake_add_polyline_path)
        fake_exit = Mock()
        type(fake_edit_boundary.return_value
             ).add_polyline_path = fake_add_polyline_path
        type(fake_edit_boundary.return_value).__enter__ = fake_enter
        type(fake_edit_boundary.return_value).__exit__ = fake_exit

        DxfDraw(app_data).addDxfHatch(Mock())
        fake_dwg.assert_called_once()
        fake_getLayer.assert_called_once()
        fake_getLayerColor.assert_called_once()

        fake_msp.assert_called_once()
        fake_add_hatch.assert_called_once()
        fake_edit_boundary.assert_called_once()
        fake_enter.assert_called_once()
        fake_exit.assert_called_once()

        # fake_add_polyline_path.assert_called_once()

        pass
コード例 #5
0
    def test_addCircle(self, fake_dwg, fake_getLayer, *arg):

        app_data = self.fake_appData()
        fake_msp = Mock()
        type(fake_dwg.return_value).modelspace = fake_msp
        fake_add_circle = Mock()
        type(fake_msp.return_value).add_circle = fake_add_circle

        DxfDraw(app_data).addDxfCircle(Mock())
        fake_dwg.assert_called_once()
        fake_getLayer.assert_called_once()
        fake_msp.assert_called_once()
        fake_add_circle.assert_called_once()
コード例 #6
0
    def test_addDxfText(self, fake_dwg, fake_getLayer, *arg):

        app_data = self.fake_appData()
        fake_msp = Mock()
        type(fake_dwg.return_value).modelspace = fake_msp
        fake_add_text = Mock()
        type(fake_msp.return_value).add_text = fake_add_text

        DxfDraw(app_data).addDxfText(Mock())
        fake_dwg.assert_called_once()
        fake_getLayer.assert_called_once()

        fake_msp.assert_called_once()
        fake_add_text.assert_called_once()

        pass
コード例 #7
0
    def test_addDxfLine(self, fake_dwg, fake_getLayer, *arg):
        pt1 = (0., 0., 0.)
        pt2 = (20., 0., 3)

        line = EntityLine(pt1, pt2, "fake_layer")
        fake_msp = Mock()
        type(fake_dwg.return_value).modelspace = fake_msp
        fake_add_line = Mock()
        type(fake_msp.return_value).add_line = fake_add_line

        app_data = self.fake_appData()
        DxfDraw(app_data).addDxfLine(line)
        fake_dwg.assert_called_once()
        fake_getLayer.assert_called_once()
        fake_msp.assert_called_once()
        fake_add_line.assert_called_once()
コード例 #8
0
 def test_getFileName(self, fake_dateTimeString, *arg):
     fake_dateTimeString.return_value = "190529_1536"
     app_data = self.fake_appData()
     assert DxfDraw(app_data).getFileName() == "190529_1536-detail.dxf"
コード例 #9
0
 def test_makeDxfException(self, *arg):
     with patch.object(VPort, 'createVPortTable'), \
         patch.object(DxfDraw, "drawEntities"):
         app_data = self.fake_appData()
         assert DxfDraw(app_data).makeDxf({}, 2) == None
コード例 #10
0
 def test_addDxfEntity(self, fake_show_dimension):
     app_data = self.fake_appData()
     DxfDraw(app_data).addDimEntity(Mock())
     pass