Beispiel #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
Beispiel #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
Beispiel #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)
Beispiel #4
0
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)
Beispiel #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()
Beispiel #6
0
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()
Beispiel #7
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)