[3.12] gh-86673: Harden test_ttk.test_element_create_image (GH-123335) (#124655)

(cherry picked from commit 08e1bbe4a3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-09-27 08:48:00 +02:00 committed by GitHub
parent 5dd07ebc0c
commit 4d38254e20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -227,13 +227,13 @@ class StyleTest(AbstractTkTest, unittest.TestCase):
foreground='blue', background='yellow')
img3 = tkinter.BitmapImage(master=self.root, file=imgfile,
foreground='white', background='black')
style.element_create('Button.button', 'image',
style.element_create('TestButton.button', 'image',
img1, ('pressed', img2), ('active', img3),
border=(2, 4), sticky='we')
self.assertIn('Button.button', style.element_names())
self.assertIn('TestButton.button', style.element_names())
style.layout('Button', [('Button.button', {'sticky': 'news'})])
b = ttk.Button(self.root, style='Button')
style.layout('TestButton', [('TestButton.button', {'sticky': 'news'})])
b = ttk.Button(self.root, style='TestButton')
b.pack(expand=True, fill='both')
self.assertEqual(b.winfo_reqwidth(), 16)
self.assertEqual(b.winfo_reqheight(), 16)