def test_rainbow(self): app = App() labelEntry = LabelEntry(Page(app)) self.assertEqual(None, labelEntry.label.styleHandler) app.rainbow() self.assertEqual(["Original", "Rainbow"], list(labelEntry.label.styleHandler.allStyles.keys())) self.assertEqual( True, labelEntry.label.styleHandler.getStyle("Rainbow").isEnabled()) self.assertEqual(["Original", "Hover", "Click", "Rainbow"], list(labelEntry.entry.styleHandler.allStyles.keys())) self.assertEqual( True, labelEntry.entry.styleHandler.getStyle("Rainbow").isEnabled()) self.assertEqual( ["Original", "Rainbow"], list(app.getChildren()[0].frame.styleHandler.allStyles.keys())) self.assertEqual( True, app.getChildren()[0].frame.styleHandler.getStyle( "Rainbow").isEnabled()) app.rainbow(reset=True) self.assertEqual( False, labelEntry.label.styleHandler.getStyle("Rainbow").isEnabled()) self.assertEqual( False, labelEntry.entry.styleHandler.getStyle("Rainbow").isEnabled()) self.assertEqual( False, app.getChildren()[0].frame.styleHandler.getStyle( "Rainbow").isEnabled())
def test_init(self): app = App() self.assertIs(app.app, app) self.assertTrue(isinstance(app.widget, tk.Tk)) self.assertIs(app.widget.element, app) self.assertEqual(app.getChildren(), []) self.assertFalse(app.isShown()) app.show(mainloop=False) self.assertTrue(app.isShown()) app.hide() self.assertFalse(app.isShown()) app.remove() self.assertEqual(False, app.isShown(error=False))
def test_children(self): app = App() self.assertEqual(app.getChildren(), []) app.showChildren(mainloop=False) app.hideChildren() app.removeChildren() page = Page(app) self.assertEqual(app.getChildren(), [page]) self.assertFalse(page.isShown()) app.showChildren(mainloop=False) self.assertTrue(page.isShown()) app.hideChildren() self.assertFalse(page.isShown()) app.removeChildren() self.assertRaises(tk.TclError, page.isShown) self.assertEqual(app.getChildren(), []) page = Page(app, height=200) page2 = Page(app) self.assertEqual(app.getChildren(), [page, page2]) self.assertEqual(app.getChildren(ignore=page), [page2]) self.assertEqual(app.getChildren(ignore=page2), [page]) self.assertEqual(app.getChildren(ignore=(page, page2)), []) self.assertFalse(page.isShown()) self.assertFalse(page2.isShown()) app.showChildren(ignore=(page, page2), mainloop=False) self.assertFalse(page.isShown()) self.assertFalse(page2.isShown()) app.showChildren(ignore=page, mainloop=False) self.assertFalse(page.isShown()) self.assertTrue(page2.isShown()) app.hideChildren() self.assertFalse(page.isShown()) self.assertFalse(page2.isShown()) app.showChildren(mainloop=False) self.assertTrue(page.isShown()) self.assertTrue(page2.isShown()) app.removeChildren() self.assertEqual(app.getChildren(), []) page = Page(app, width=200) page2 = Page(page) page2.show(mainloop=False) self.assertTrue(page.isShown()) page.hideChildren() self.assertFalse(page2.isShown()) page2.show(mainloop=False) self.assertTrue(page2.isShown()) self.assertEqual([page, page2], app.getChildren(recurrent=True)) labelEntry = LabelEntry(page2) self.assertEqual( [page, page2, labelEntry, labelEntry.label, labelEntry.entry], app.getChildren(recurrent=True))