MCPcopy Index your code
hub / github.com/python/cpython / test_theme_create_vsapi

Method test_theme_create_vsapi

Lib/test/test_ttk/test_style.py:412–443  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

410 style.theme_use(curr_theme)
411
412 def test_theme_create_vsapi(self):
413 style = self.style
414 if 'xpnative' not in style.theme_names():
415 self.skipTest("requires 'xpnative' theme")
416 curr_theme = style.theme_use()
417 new_theme = 'testtheme5'
418 style.theme_create(new_theme, settings={
419 'pin' : {
420 'element create': ['vsapi', 'EXPLORERBAR', 3, [
421 ('pressed', '!selected', 3),
422 ('active', '!selected', 2),
423 ('pressed', 'selected', 6),
424 ('active', 'selected', 5),
425 ('selected', 4),
426 ('', 1)]],
427 },
428 'Explorer.Pin' : {
429 'layout': [('Explorer.Pin.pin', {'sticky': 'news'})],
430 },
431 })
432
433 style.theme_use(new_theme)
434 self.assertIn('pin', style.element_names())
435 self.assertEqual(style.layout('Explorer.Pin'),
436 [('Explorer.Pin.pin', {'sticky': 'nswe'})])
437
438 pin = ttk.Checkbutton(self.root, style='Explorer.Pin')
439 pin.pack(expand=True, fill='both')
440 self.assertEqual(pin.winfo_reqwidth(), 16)
441 self.assertEqual(pin.winfo_reqheight(), 16)
442
443 style.theme_use(curr_theme)
444
445
446if __name__ == "__main__":

Callers

nothing calls this directly

Calls 11

theme_namesMethod · 0.80
skipTestMethod · 0.80
theme_useMethod · 0.80
theme_createMethod · 0.80
assertInMethod · 0.80
element_namesMethod · 0.80
layoutMethod · 0.80
winfo_reqwidthMethod · 0.80
winfo_reqheightMethod · 0.80
assertEqualMethod · 0.45
packMethod · 0.45

Tested by

no test coverage detected