summaryrefslogtreecommitdiffstats
path: root/tests/test_interface.py
blob: 2e45e1d9d0b49956eb81d56ea02b86cbee9444f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import unittest

import testmodule
from common import gobject, testhelper
from gobject import GObject, GInterface

GUnknown = gobject.type_from_name("TestUnknown")
Unknown = GUnknown.pytype

class MyUnknown(Unknown, testhelper.Interface):
    def __init__(self):
        Unknown.__init__(self)
        self.called = False

    def do_iface_method(self):
        self.called = True
        Unknown.do_iface_method(self)

gobject.type_register(MyUnknown)

class TestIfaceImpl(unittest.TestCase):
    def testMethodCall(self):
        m = MyUnknown()
        m.iface_method()
        self.assertEqual(m.called, True)