def test_pos(self): app = App() self.assertEqual(Vec2(), app.getWindowPos()) self.assertEqual(Vec2(1), app.getSize()) app.show(mainloop=False) self.assertEqual(True, app.getWindowPos().inrange(1, 500)) self.assertEqual(Vec2(), app.getTopLeftPos()) self.assertEqual(Vec2(200), app.getBottomRightPos()) self.assertEqual(Vec2(200), app.getSize()) app.setSize(Vec2(250, 300)) app.widget.update() self.assertEqual(Vec2(250, 300), app.getSize()) app.setSize(145) app.widget.update() self.assertEqual(Vec2(145), app.getSize()) page = Page(app, width=300, height=250) page.show(mainloop=False) self.assertEqual(Vec2(300, 250), app.getBottomRightPos()) self.assertEqual(Vec2(300, 250), app.getSize()) self.assertEqual(True, app.getMouse().inrange(-100000, 100000)) self.assertEqual(page.frame, app.getElementByPos(10)) page.remove() self.assertEqual(app, app.getElementByPos(10)) self.assertEqual(None, app.getElementByPos(-10)) self.assertEqual(None, app.getElementByPos(400))
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_states(self): app = App() self.assertEqual(False, app.isShown()) self.assertEqual(True, app.exists()) self.assertEqual(True, app.isPacked()) app.show(mainloop=False) self.assertEqual(True, app.isShown()) self.assertEqual(True, app.exists()) self.assertEqual(True, app.isPacked()) app.hide() self.assertEqual(False, app.isShown()) self.assertEqual(True, app.exists()) self.assertEqual(True, app.isPacked()) app.remove() self.assertEqual(False, app.isShown()) self.assertEqual(False, app.exists()) self.assertEqual(False, app.isPacked())