예제 #1
0
def component_for_rotation():
    component = Component()
    component.name = "c1"
    component.ID = "c1"
    component.entity = "MIXER"
    component.xspan = 1000
    component.yspan = 15000
    top_port = Port()
    top_port.label = "top"
    top_port.x = int(component.xspan / 2)
    top_port.y = 0
    bottom_port = Port()
    bottom_port.label = "bottom"
    bottom_port.x = int(component.xspan / 2)
    bottom_port.y = component.yspan
    component.add_component_port(top_port)
    component.add_component_port(bottom_port)

    return component
예제 #2
0
def test_component_to_parchmint_v1_x_dict(params_dict, layer_dict, port_dict,
                                          component_dict):
    layer = Layer(layer_dict)
    component = Component()
    component.name = "c1"
    component.ID = "c1"
    component.params = Params(params_dict)
    component.entity = "MIXER"
    component.layers.append(layer)
    component.add_component_port(Port(port_dict))
    component.xspan = 1000
    component.yspan = 5000
    # Test to see if the component dict is correct or not
    assert component.to_parchmint_v1() == component_dict

    # Test to see if the loading from dictionary is working correctly
    # Create dummy device to get the layer id from
    device = Device()
    device.layers.append(layer)
    component = Component(json_data=component_dict, device_ref=device)
    assert component.to_parchmint_v1() == component_dict