class TestQtMenuBar(object): """ Unit tests for the QtMenuBar """ def __init__(self): """ Create an application instance so that widgets can be created """ if not QApplication.instance(): self.app = QApplication([]) def setUp(self): """ Set up the widget for testing """ self.menu = QtMenu(None, uuid4().hex, QtLocalPipe(uuid4)) self.menu.create() def test_set_title(self): """ Test the QtMenu's set_title command """ title = 'Menu title' self.menu.recv_message({'action':'set-title', 'title':title}) assert self.menu.widget.title() == title