Esempio n. 1
0
    def test_has_image_compound_horizontal(self):
        for comp in ["left", "right"]:
            b = Button(image=self.image, compound=comp)
            b.pack()

            # Height should be the biggest out of text and image + ipady
            h = max(b.img_height, b.text_height)

            self.assertEqual(b.height, h + b.defaults["ipady"])
            self.assertEqual(b.width, self.image.width() + b.defaults["ipadx"])
Esempio n. 2
0
    def test_has_image_and_text_compound_vertical(self):
        for comp in ["top", "bottom"]:
            b = Button(image=self.image, text="Testing", compound=comp)
            b.pack()

            # Width should be the biggest out of text and image + ipadx
            w = max(b.img_width, b.text_width)

            self.assertEqual(b.height, self.image.height() +
                             b.font.metrics("linespace") +
                             b.defaults["ipady"])
            self.assertEqual(b.width, w + b.defaults["ipadx"])
Esempio n. 3
0
 def test_has_image_compound_vertical(self):
     for comp in ["top", "bottom"]:
         b = Button(image=self.image, compound=comp)
         b.pack()
         self.assertEqual(b.height, self.image.height() + b.defaults["ipady"])
         self.assertEqual(b.width, self.image.width() + b.defaults["ipadx"])