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)
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)
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)
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)
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)
def setUp(self): super().setUp() self.button = Button('my button')
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)
""" 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()