예제 #1
0
    def test_place(self):
        app = App()
        Page(app, width=200, height=200).show(mainloop=False)
        page = Page(app, width=10, height=10, bg="green")
        app.showChildren(mainloop=False)

        page.place(Vec2(100, 100))
        self.assertEqual(Vec2(100, 100), page.getTopLeftPos())
예제 #2
0
    def test_pos(self):
        app = App()
        page = Page(app, width=200, height=100)
        self.assertEqual(Vec2(), page.getTopLeftPos())
        self.assertEqual(Vec2(1), page.getBottomRightPos())
        self.assertEqual(Vec2(1), page.getSize())

        page.show(mainloop=False)
        self.assertEqual(True, page.getWindowPos().inrange(1, 500))
        self.assertEqual(Vec2(200, 100), page.getSize())
        self.assertEqual(Vec2(0), page.getTopLeftPos())
        self.assertEqual(Vec2(200, 100), page.getBottomRightPos())

        page.setSize(Vec2(250, 300))
        app.widget.update()
        self.assertEqual(Vec2(250, 300), page.getSize())

        page.setSize(120)
        app.widget.update()
        self.assertEqual(Vec2(120), page.getSize())