コード例 #1
0
    def test_draw_directed_arrow_direction(self):
        d = {'a': ['b'], 'b': []}
        g = graph_from_dict(d)
        container = GraphContainer(graph=g)
        for node in g.nodes():
            GraphNodeComponent(container=container, value=node)

        # Node a is to the left of node b
        container._layout_needed = False
        container.components[0].x = 0.0
        container.components[1].x = 100.0
        container.components[0].y = 0.0
        container.components[1].y = 0.0
        self.assertPathsAreCreated(container)

        # Node a is to the right of node b
        container._layout_needed = False
        container.components[0].x = 100.0
        container.components[1].x = 0.0
        container.components[0].y = 0.0
        container.components[1].y = 0.0
        self.assertPathsAreCreated(container)

        # Node a is above of node b
        container._layout_needed = False
        container.components[0].x = 0.0
        container.components[1].x = 0.0
        container.components[0].y = 0.0
        container.components[1].y = 100.0
        self.assertPathsAreCreated(container)

        # Node a is below of node b
        container._layout_needed = False
        container.components[0].x = 0.0
        container.components[1].x = 0.0
        container.components[0].y = 100.0
        container.components[1].y = 0.0
        self.assertPathsAreCreated(container)
コード例 #2
0
    def test_draw_directed_arrow_direction(self):
        d = {'a': ['b'], 'b': []}
        g = graph_from_dict(d)
        container = GraphContainer(graph=g)
        for node in g.nodes():
            GraphNodeComponent(container=container, value=node)

        # Node a is to the left of node b
        container._layout_needed = False
        container.components[0].x = 0.0
        container.components[1].x = 100.0
        container.components[0].y = 0.0
        container.components[1].y = 0.0
        self.assertPathsAreCreated(container)

        # Node a is to the right of node b
        container._layout_needed = False
        container.components[0].x = 100.0
        container.components[1].x = 0.0
        container.components[0].y = 0.0
        container.components[1].y = 0.0
        self.assertPathsAreCreated(container)

        # Node a is above of node b
        container._layout_needed = False
        container.components[0].x = 0.0
        container.components[1].x = 0.0
        container.components[0].y = 0.0
        container.components[1].y = 100.0
        self.assertPathsAreCreated(container)

        # Node a is below of node b
        container._layout_needed = False
        container.components[0].x = 0.0
        container.components[1].x = 0.0
        container.components[0].y = 100.0
        container.components[1].y = 0.0
        self.assertPathsAreCreated(container)