コード例 #1
0
 def setUp(self):
     Application.init(services=[
         "event_manager",
         "component_registry",
         "element_factory",
         "main_window",
         "action_manager",
         "properties",
         "namespace",
         "diagrams",
         "toolbox",
     ])
     main_window = Application.get_service("main_window")
     main_window.open()
     self.element_factory = Application.get_service("element_factory")
     self.diagram = self.element_factory.create(UML.Diagram)
     self.page = DiagramPage(
         self.diagram,
         Application.get_service("event_manager"),
         self.element_factory,
         Application.get_service("properties"),
     )
     self.page.construct()
     assert self.page.diagram == self.diagram
     assert self.page.view.canvas == self.diagram.canvas
     assert len(self.element_factory.lselect()) == 1
コード例 #2
0
class DiagramPageTestCase(unittest.TestCase):
    def setUp(self):
        Application.init(
            services=[
                "event_manager",
                "component_registry",
                "element_factory",
                "main_window",
                "properties",
                "namespace",
                "diagrams",
                "toolbox",
                "elementeditor",
                "export_menu",
                "tools_menu",
            ]
        )
        main_window = Application.get_service("main_window")
        main_window.open()
        self.element_factory = Application.get_service("element_factory")
        self.diagram = self.element_factory.create(UML.Diagram)
        self.page = DiagramPage(
            self.diagram,
            Application.get_service("event_manager"),
            self.element_factory,
            Application.get_service("properties"),
        )
        self.page.construct()
        assert self.page.diagram == self.diagram
        assert self.page.view.canvas == self.diagram.canvas
        assert len(self.element_factory.lselect()) == 1

    def tearDown(self):
        self.page.close()
        del self.page
        self.diagram.unlink()
        del self.diagram
        Application.shutdown()
        assert len(self.element_factory.lselect()) == 0

    def test_creation(self):
        pass

    def test_placement(self):
        box = Box()
        self.diagram.canvas.add(box)
        self.diagram.canvas.update_now()
        self.page.view.request_update([box])

        self.diagram.create(
            CommentItem, subject=self.element_factory.create(UML.Comment)
        )
        assert len(self.element_factory.lselect()) == 2
コード例 #3
0
 def setUp(self):
     Application.init(services=[
         "element_factory",
         "main_window",
         "action_manager",
         "properties",
         "element_dispatcher",
     ])
     main_window = Application.get_service("main_window")
     main_window.open()
     self.element_factory = Application.get_service("element_factory")
     self.diagram = self.element_factory.create(UML.Diagram)
     self.page = DiagramPage(self.diagram)
     self.page.construct()
     self.assertEqual(self.page.diagram, self.diagram)
     self.assertEqual(self.page.view.canvas, self.diagram.canvas)
     self.assertEqual(len(self.element_factory.lselect()), 1)
コード例 #4
0
ファイル: test_diagrampage.py プロジェクト: weizx208/gaphor
class DiagramPageTestCase(unittest.TestCase):
    def setUp(self):
        Application.init(
            services=[
                "element_factory",
                "main_window",
                "action_manager",
                "properties",
                "element_dispatcher",
            ]
        )
        main_window = Application.get_service("main_window")
        main_window.open()
        self.element_factory = Application.get_service("element_factory")
        self.diagram = self.element_factory.create(UML.Diagram)
        self.page = DiagramPage(self.diagram)
        self.page.construct()
        self.assertEqual(self.page.diagram, self.diagram)
        self.assertEqual(self.page.view.canvas, self.diagram.canvas)
        self.assertEqual(len(self.element_factory.lselect()), 1)

    def tearDown(self):
        self.page.close()
        del self.page
        self.diagram.unlink()
        del self.diagram
        Application.shutdown()
        assert len(self.element_factory.lselect()) == 0

    def test_creation(self):
        pass

    def test_placement(self):
        box = Box()
        self.diagram.canvas.add(box)
        self.diagram.canvas.update_now()
        self.page.view.request_update([box])

        comment = self.diagram.create(
            CommentItem, subject=self.element_factory.create(UML.Comment)
        )
        self.assertEqual(len(self.element_factory.lselect()), 2)
コード例 #5
0
def page(diagram, event_manager, element_factory, properties):
    page = DiagramPage(diagram, event_manager, element_factory, properties,
                       UMLModelingLanguage())
    page.construct()
    assert page.diagram == diagram
    assert page.view.canvas == diagram.canvas
    yield page
    page.close()
コード例 #6
0
ファイル: test_diagrampage.py プロジェクト: bellyfat/gaphor
def page(session, diagram, element_factory):
    page = DiagramPage(
        diagram,
        session.get_service("event_manager"),
        element_factory,
        session.get_service("properties"),
    )
    page.construct()
    assert page.diagram == diagram
    assert page.view.canvas == diagram.canvas
    yield page
    page.close()
コード例 #7
0
ファイル: test_diagrampage.py プロジェクト: amolenaar/gaphor
 def setUp(self):
     Application.init(
         services=[
             "element_factory",
             "main_window",
             "action_manager",
             "properties",
             "element_dispatcher",
         ]
     )
     main_window = Application.get_service("main_window")
     main_window.open()
     self.element_factory = Application.get_service("element_factory")
     self.diagram = self.element_factory.create(UML.Diagram)
     self.page = DiagramPage(self.diagram)
     self.page.construct()
     self.assertEqual(self.page.diagram, self.diagram)
     self.assertEqual(self.page.view.canvas, self.diagram.canvas)
     self.assertEqual(len(self.element_factory.lselect()), 1)