Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added test for copying ClassItem.

  • Loading branch information...
commit 0645c78ef3dab3711b8fc04320fbd7ffcab9d8f9 1 parent dcebd35
@amolenaar authored
Showing with 33 additions and 0 deletions.
  1. +33 −0 gaphor/services/tests/test_copyservice.py
View
33 gaphor/services/tests/test_copyservice.py
@@ -13,6 +13,7 @@ class CopyServiceTestCase(TestCase):
def test_init(self):
service = CopyService()
service.init(Application)
+ # No exception? ok!
def test_copy(self):
service = CopyService()
@@ -28,4 +29,36 @@ def test_copy(self):
assert len(diagram.canvas.get_all_items()) == 2, diagram.canvas.get_all_items()
+ def test_copy_named_item(self):
+ service = CopyService()
+ service.init(Application)
+
+ ef = Application.get_service('element_factory')
+ diagram = ef.create(UML.Diagram)
+ c = diagram.create(items.ClassItem, subject=ef.create(UML.Class))
+
+ c.name = 'Name'
+
+ import gobject
+ self.assertEquals(0, gobject.main_depth())
+
+ diagram.canvas.update_now()
+ i = list(diagram.canvas.get_all_items())
+ self.assertEquals(1, len(i), i)
+ self.assertEquals('Name', i[0]._name.text)
+
+ service.copy([c])
+ assert diagram.canvas.get_all_items() == [ c ]
+
+ service.paste(diagram)
+
+ i = diagram.canvas.get_all_items()
+
+ self.assertEquals(2, len(i), i)
+
+ diagram.canvas.update_now()
+
+ self.assertEquals('Name', i[0]._name.text)
+ self.assertEquals('Name', i[1]._name.text)
+
# vim:sw=4:et
Please sign in to comment.
Something went wrong with that request. Please try again.