Ejemplo n.º 1
0
 def setUp(self):
     self.object = base.Object()
     self.subclassObject = ObjectSubclass()
     self.eventsReceived = []
     for eventType in (self.object.subjectChangedEventType(),
                       self.object.descriptionChangedEventType(),
                       self.object.appearanceChangedEventType()):
         patterns.Publisher().registerObserver(self.onEvent, eventType)
Ejemplo n.º 2
0
 def setUp(self):
     self.object = base.Object()
     self.subclassObject = ObjectSubclass()
     self.eventsReceived = []
     for eventType in (self.object.subjectChangedEventType(), 
                       self.object.descriptionChangedEventType(),
                       self.object.foregroundColorChangedEventType(),
                       self.object.backgroundColorChangedEventType(),
                       self.object.fontChangedEventType(),
                       self.object.iconChangedEventType(),
                       self.object.selectedIconChangedEventType()):
         patterns.Publisher().registerObserver(self.onEvent, eventType)
Ejemplo n.º 3
0
 def testSetSelectedIconOnCreation(self):
     domainObject = base.Object(selectedIcon='icon')
     self.assertEqual('icon', domainObject.selectedIcon())
Ejemplo n.º 4
0
 def testSetFontOnCreation(self):
     domainObject = base.Object(font=wx.SWISS_FONT)
     self.assertEqual(wx.SWISS_FONT, domainObject.font())
Ejemplo n.º 5
0
 def testSetBackgroundColorOnCreation(self):
     domainObject = base.Object(bgColor=wx.GREEN)
     self.assertEqual(wx.GREEN, domainObject.backgroundColor())
Ejemplo n.º 6
0
 def testSetForegroundColorOnCreation(self):
     domainObject = base.Object(fgColor=wx.GREEN)
     self.assertEqual(wx.GREEN, domainObject.foregroundColor())
Ejemplo n.º 7
0
 def testSetDescriptionOnCreation(self):
     domainObject = base.Object(description='Hi')
     self.assertEqual('Hi', domainObject.description())
Ejemplo n.º 8
0
 def testSetSubjectOnCreation(self):
     domainObject = base.Object(subject='Hi')
     self.assertEqual('Hi', domainObject.subject())
Ejemplo n.º 9
0
 def testSetModificationDateTimeOnCreation(self):
     modification_datetime = date.DateTime(2012, 12, 12, 10, 0, 0)
     domain_object = base.Object(modificationDateTime=modification_datetime)
     self.assertEqual(modification_datetime,
                      domain_object.modificationDateTime())
Ejemplo n.º 10
0
 def testSetCreationDateTimeOnCreation(self):
     creation_datetime = date.DateTime(2012, 12, 12, 10, 0, 0)
     domain_object = base.Object(creationDateTime=creation_datetime)
     self.assertEqual(creation_datetime, domain_object.creationDateTime())
Ejemplo n.º 11
0
 def testDifferentObjectsHaveDifferentIds(self):
     self.assertNotEqual(base.Object().id(), self.object.id())
Ejemplo n.º 12
0
 def testSetIdOnCreation(self):
     domainObject = base.Object(id='123')
     self.assertEqual('123', domainObject.id())
Ejemplo n.º 13
0
 def testCyclicReference(self):
     domainObject = base.Object()
     weak = weakref.ref(domainObject)
     del domainObject  # Assuming CPython
     self.failUnless(weak() is None)