Exemple #1
0
 def test_layer(self):
     self.assertIsNone(self.anchor.layer)
     self.anchor = Anchor(self.glyph)
     self.assertEqual(self.anchor.layer, self.glyph.layer)
     self.assertIsNotNone(self.anchor.layer)
     with self.assertRaises(AttributeError):
         self.anchor.layer = "foo"
Exemple #2
0
 def setUp(self):
     self.font = Font()
     self.glyph = self.font.newGlyph("A")
     self.anchor = Anchor(
         self.glyph,
         {"name": "anchor1", "x": 300, "y": 700}
     )
     self.notificationObject = NotificationTestObserver()
Exemple #3
0
    def test_move(self):
        a = Anchor(anchorDict=dict(x=1, y=2, name="3"))
        a.dirty = False
        self.assertEqual((a.x, a.y), (1, 2))
        a.move((10, 0))
        self.assertTrue(a.dirty)

        a.dirty = False
        self.assertEqual((a.x, a.y), (11, 2))
        a.move((0, -123))
        self.assertTrue(a.dirty)

        a.dirty = False
        self.assertEqual((a.x, a.y), (11, -121))
        a.move((-11, 121))
        self.assertEqual((a.x, a.y), (0, 0))
        self.assertTrue(a.dirty)
Exemple #4
0
 def test_instance(self):
     a = Anchor(anchorDict=dict(x=1, y=2, name="3", identifier="4",
                                color="1,1,1,1"))
     self.assertEqual((a.x, a.y, a.name, a.identifier, a.color),
                      (1, 2, "3", "4", "1,1,1,1"))
Exemple #5
0
 def test_identifiers(self):
     anchor = Anchor(self.glyph)
     self.assertEqual(anchor.identifiers, self.glyph.identifiers)
Exemple #6
0
 def test_font(self):
     self.assertIsNone(self.anchor.font)
     self.anchor = Anchor(self.glyph)
     self.assertEqual(self.anchor.font, self.font)
     with self.assertRaises(AttributeError):
         self.anchor.font = "foo"
Exemple #7
0
 def test_getParent(self):
     self.assertIsNone(self.anchor.getParent())
     self.anchor = Anchor(self.glyph)
     self.assertEqual(self.anchor.getParent(), self.glyph)
Exemple #8
0
 def setUp(self):
     self.font = Font()
     self.glyph = self.font.newGlyph("A")
     self.anchor = Anchor()