def test_parents(self): for page in Page(App()), Page(App(), width=200, height=200): page2 = Page(page) page3 = Page(page2) self.assertEqual(page3.getParents(), [page2, page]) self.assertEqual(page3.getParents(includeSelf=True), [page3, page2, page]) self.assertEqual(page3.getTopPage(), page) page3.show(mainloop=False) self.assertTrue(page3.isShown()) self.assertTrue(page2.isShown()) self.assertTrue(page.isShown()) self.assertTrue(page3.app.isShown()) self.assertTrue(page2.app.isShown()) self.assertTrue(page.app.isShown())
def test_parents(self): app = App() for page in Page(app), Page(app, width=200, height=200): Label(page, "hello") Label(page, "there") page2 = Page(page) text3 = Label(page2, "in page 2") self.assertIs(text3.getTopPage(), page) self.assertEqual(text3.getParents(), [page2, page]) self.assertEqual(text3.getParents(includeSelf=True), [text3, page2, page]) self.assertEqual([page2.frame, page2, page.frame, page], text3.getParents(includeParts=True)) page3 = Page(page2, scrollable=True) text4 = Label(page3, "in page 3") self.assertEqual([page2.frame, page2, page.frame, page], page3.getParents(includeParts=True)) self.assertEqual([page3.canvasFrame, page3.canvas, page3.frame, page3, page2.frame, page2, page.frame, page], text4.getParents(includeParts=True))