示例#1
0
def test_createDrawing_ellipse():
    topology = Topology()
    shape_data = {
        "x":
        42,
        "y":
        12,
        "z":
        0,
        "rotation":
        0,
        "drawing_id":
        str(uuid.uuid4()),
        "svg":
        "<svg height=\"105.0\" width=\"158.0\"><ellipse cx=\"79\" cy=\"52\" rx=\"79\" ry=\"53\" style=\"stroke-width:2;stroke:#000000;fill:#ffffff;\" /></svg>",
    }
    topology._main_window = MagicMock()
    topology.createDrawing(shape_data)
    topology._main_window.uiGraphicsView.createDrawingItem.assert_called_with(
        "ellipse",
        42,
        12,
        0,
        rotation=0,
        svg=shape_data["svg"],
        drawing_id=shape_data["drawing_id"])
示例#2
0
def test_createDrawing_svg():
    """
    If SVG is more complex we consider it as an image
    """
    topology = Topology()
    shape_data = {
        "x": 42,
        "y": 12,
        "z": 0,
        "locked": False,
        "rotation": 0,
        "drawing_id": str(uuid.uuid4()),
        "svg":
        "<svg height=\"105.0\" width=\"158.0\"><rect><line/></rect></svg>",
    }
    topology._main_window = MagicMock()
    topology.createDrawing(shape_data)
    topology._main_window.uiGraphicsView.createDrawingItem.assert_called_with(
        "image",
        42,
        12,
        0,
        locked=False,
        rotation=0,
        svg=shape_data["svg"],
        drawing_id=shape_data["drawing_id"])
示例#3
0
def test_createDrawing_text():
    topology = Topology()
    shape_data = {
        "x": 42,
        "y": 12,
        "z": 0,
        "rotation": 0,
        "drawing_id": str(uuid.uuid4()),
        "svg": "<svg height=\"105.0\" width=\"158.0\"><text/></svg>",
    }
    topology._main_window = MagicMock()
    topology.createDrawing(shape_data)
    topology._main_window.uiGraphicsView.createDrawingItem.assert_called_with("text", 42, 12, 0, rotation=0, svg=shape_data["svg"], drawing_id=shape_data["drawing_id"])
示例#4
0
def test_createDrawing_ellipse():
    topology = Topology()
    shape_data = {
        "x": 42,
        "y": 12,
        "z": 0,
        "rotation": 0,
        "drawing_id": str(uuid.uuid4()),
        "svg": "<svg height=\"105.0\" width=\"158.0\"><ellipse cx=\"79\" cy=\"52\" rx=\"79\" ry=\"53\" style=\"stroke-width:2;stroke:#000000;fill:#ffffff;\" /></svg>",
    }
    topology._main_window = MagicMock()
    topology.createDrawing(shape_data)
    topology._main_window.uiGraphicsView.createDrawingItem.assert_called_with("ellipse", 42, 12, 0, rotation=0, svg=shape_data["svg"], drawing_id=shape_data["drawing_id"])
示例#5
0
def test_createDrawing_svg():
    """
    If SVG is more complex we consider it as an image
    """
    topology = Topology()
    shape_data = {
        "x": 42,
        "y": 12,
        "z": 0,
        "rotation": 0,
        "drawing_id": str(uuid.uuid4()),
        "svg": "<svg height=\"105.0\" width=\"158.0\"><rect><line/></rect></svg>",
    }
    topology._main_window = MagicMock()
    topology.createDrawing(shape_data)
    topology._main_window.uiGraphicsView.createDrawingItem.assert_called_with("image", 42, 12, 0, rotation=0, svg=shape_data["svg"], drawing_id=shape_data["drawing_id"])
示例#6
0
def test_createDrawing_text():
    topology = Topology()
    shape_data = {
        "x": 42,
        "y": 12,
        "z": 0,
        "rotation": 0,
        "drawing_id": str(uuid.uuid4()),
        "svg": "<svg height=\"105.0\" width=\"158.0\"><text/></svg>",
    }
    topology._main_window = MagicMock()
    topology.createDrawing(shape_data)
    topology._main_window.uiGraphicsView.createDrawingItem.assert_called_with(
        "text",
        42,
        12,
        0,
        rotation=0,
        svg=shape_data["svg"],
        drawing_id=shape_data["drawing_id"])