Example #1
0
    def setUp(self):
        super(TestHorizontalContainer, self).setUp()

        self.container = HorizontalContainer([Viewer(width=50, height=50),
                                           Viewer(width=50, height=50)])

        self.manager = Manager(self.container, window=self.window, batch=self.batch, theme=self.theme)
    def test_add_column(self):
        """
        Tests that if we add a column with 3 rows,
        we have the correct sizes.
        """
        self.container.add_column([
            Viewer(width=50, height=50),
            Viewer(width=50, height=50),
            Viewer(width=50, height=50)
        ])

        self.assertEqual(self.container.width,
                         150 + 2 * self.container.padding)
        self.assertEqual(self.container.height,
                         150 + 2 * self.container.padding)
Example #3
0
    def test_add_widget(self):
        self.container.add(Viewer(width=50, height=50))

        self.assertEqual(self.manager.width, 150 + 2*self.container.padding)
        self.assertEqual(self.manager.height, 50)

        self._test_content_position()
    def test_add(self):
        """
        Tests that we can add a new item.
        """
        item = Viewer(width=50, height=50)
        self.container.add(item)

        self.assertEqual(item.has_manager(), True)
Example #5
0
    def setUp(self):
        TestPygletGUI.setUp(self)

        self.widgets = []
        for i in range(2):
            self.widgets.append(Viewer(width=100, height=50))
        for i in range(2):
            self.widgets.append(Viewer(width=20, height=50))

        self.container = VerticalContainer([
            HorizontalContainer([self.widgets[0], self.widgets[1]], padding=0),
            HorizontalContainer([
                Spacer(), self.widgets[2],
                Spacer(), self.widgets[3],
                Spacer()
            ],
                                padding=0)
        ],
                                           padding=0)

        self.manager = Manager(self.container,
                               window=self.window,
                               batch=self.batch,
                               theme=self.theme)
    def test_substitute_element(self):
        self.container.set(1, 1, Viewer(width=100, height=50))

        self.assertEqual(self.container.width, 150 + self.container.padding)
        self.assertEqual(self.container.height, 100 + self.container.padding)