Exemplo n.º 1
0
        """
        text = "ASCII"
        o = self.canvas.Text(text=text, font=("sans serif", 20),
                             color="#ff0000")
        self.assertEqual(isinstance(o.text_get(), str), True)
        self.assertEqual(o.text_get(), text)

    def testUnicode1(self):
        """make sure that you can supply a unicode object as text

        This must both be accepted and preserved as Unicode string.
        """
        text = u"Unicode"
        o = self.canvas.Text(text=text, font=("sans serif", 20),
                             color="#ff0000")
        self.assertEqual(isinstance(o.text_get(), unicode), True)
        self.assertEqual(o.text_get(), text)

    def testUnicode2(self):
        """make sure that non-ASCII characters are treated correctly

        The used string is the word 'mojibake', btw.
        """
        text = u"文字化け"
        o = self.canvas.Text(text=text, font=("sans serif", 20),
                             color="#ff0000")
        self.assertEqual(o.text_get(), text)

unittest.main()
evas.shutdown()
Exemplo n.º 2
0
import evas
import evas.c_evas
import unittest

class PolygonBasics(unittest.TestCase):
    def setUp(self):
        self.canvas = evas.Canvas(method="buffer",
                                  size=(400, 500),
                                  viewport=(0, 0, 400, 500))
        self.canvas.engine_info_set(self.canvas.engine_info_get())

    def tearDown(self):
        del self.canvas

    def testConstructor(self):
        points = ((0, 5), (5, 0), (10, 5), (5, 10), (0, 5))
        o = evas.Polygon(self.canvas, points=points, color="#ff0000")
        self.assertEqual(o.color, (255, 0, 0, 255))

    def testCanvasFactory(self):
        points = ((0, 5), (5, 0), (10, 5), (5, 10))
        o = self.canvas.Polygon(points=points, color="#ff0000")
        self.assertEqual(isinstance(o, evas.c_evas.Polygon), True)
        self.assertEqual(o.color, (255, 0, 0, 255))


unittest.main()
evas.shutdown()