Esempio n. 1
0
    def test_append_page_at_index(self):
        """Tests that pages can be appended at a specified index."""
        button = Button('my button')
        self.tab.append('my tab 1', button)

        button2 = Button('second button')
        self.tab.insertAt('my tab 1', 0, button2)

        self.assertEqual(self.tab.getNumPages(), 2)
Esempio n. 2
0
    def test_append_pages(self):
        """Tests that pages can be appended to a tab."""
        button = Button('my button')
        self.tab.append('my tab 1', button)

        button2 = Button('second button')
        self.tab.append('second tab', button2)

        self.assertEqual(self.tab.getNumPages(), 2)
Esempio n. 3
0
class ButtonTest(WindowTestCase):
    def setUp(self):
        super().setUp()
        self.button = Button('my button')

    def test_text_initial_value(self):
        """Tests the button's `text` initial value is the one passed to
        constructor."""
        self.assertEqual(self.button.getText(), 'my button')

    def test_text_can_be_changed(self):
        """Tests the button text."""
        text = 'My new button'
        self.button.setText(text)
        self.assertEqual(self.button.getText(), text)
Esempio n. 4
0
    def test_delete_pages(self):
        """Tests that we can delete pages from tab."""
        button = Button('my button')
        self.tab.append('my tab 1', button)

        self.tab.delete(0)
        self.assertEqual(self.tab.getNumPages(), 0)
Esempio n. 5
0
class ButtonTest(WindowTestCase):

    def setUp(self):
        super().setUp()
        self.button = Button('my button')

    def test_text_initial_value(self):
        """Tests the button's `text` initial value is the one passed to
        constructor."""
        self.assertEqual(self.button.getText(), 'my button')

    def test_text_can_be_changed(self):
        """Tests the button text."""
        text = 'My new button'
        self.button.setText(text)
        self.assertEqual(self.button.getText(), text)
Esempio n. 6
0
    def test_margins_can_be_changed(self):
        """Tests the tab's `margin` attribute can be changed."""
        # we first have to add a page to the tab
        button = Button('my button')
        self.tab.append('my tab 1', button)

        self.tab.setMargined(0, True)
        self.assertEqual(self.tab.getMargined(0), True)
Esempio n. 7
0
 def setUp(self):
     super().setUp()
     self.button = Button('my button')
Esempio n. 8
0
    def test_margins_initial_value(self):
        """Tests the tab's `margin` initial value is False."""
        button = Button('my button')
        self.tab.append('my tab 1', button)

        self.assertEqual(self.tab.getMargined(0), False)
Esempio n. 9
0
"""
 Shows a simple group.

"""

from pylibui.core import App
from pylibui.controls import Window, Group, Button


class MyWindow(Window):
    def onClose(self, data):
        super().onClose(data)
        app.stop()


app = App()

window = MyWindow('Window', 800, 600)
window.setMargined(True)

button = Button('My Label')
group = Group('my Group')
group.setMargined(True)
group.setChild(button)
window.setChild(group)

window.show()

app.start()
app.close()
Esempio n. 10
0
 def setUp(self):
     super().setUp()
     self.button = Button('my button')