예제 #1
0
class TestQtLabel(object):
    """ Unit tests for the QtLabel

    """
    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.label = QtLabel(None, uuid4().hex, QtLocalPipe(uuid4))
        self.label.create()

    def test_set_text(self):
        """ Test the QtLabel's set_text command

        """
        text = "test"
        self.label.recv_message({'action':'set-text', 'text':text})
        assert self.label.widget.text() == text

    def test_set_word_wrap(self):
        """ Test the QtLabel's set_word_wrap command

        """
        wrap = True
        self.label.recv_message({'action':'set-word_wrap',
                                 'word_wrap':wrap})
        assert self.label.widget.wordWrap() == wrap
예제 #2
0
    def setUp(self):
        """ Set up the widget for testing

        """
        self.label = QtLabel(None, uuid4().hex, QtLocalPipe(uuid4))
        self.label.create()