@@ -606,40 +606,35 @@ def test_set_color_sample(self):
606606
607607 def test_paint_theme_sample (self ):
608608 eq = self .assertEqual
609- d = self .page
610- del d .paint_theme_sample
611- hs_tag = d .highlight_sample .tag_cget
609+ page = self .page
610+ del page .paint_theme_sample # Delete masking mock.
611+ hs_tag = page .highlight_sample .tag_cget
612612 gh = idleConf .GetHighlight
613- fg = 'foreground'
614- bg = 'background'
615613
616614 # Create custom theme based on IDLE Dark.
617- d .theme_source .set (True )
618- d .builtin_name .set ('IDLE Dark' )
615+ page .theme_source .set (True )
616+ page .builtin_name .set ('IDLE Dark' )
619617 theme = 'IDLE Test'
620- d .create_new (theme )
621- d .set_color_sample .called = 0
618+ page .create_new (theme )
619+ page .set_color_sample .called = 0
622620
623621 # Base theme with nothing in `changes`.
624- d .paint_theme_sample ()
625- eq ( hs_tag ( 'break' , fg ), gh ( theme , 'break' , fgBg = 'fg' ))
626- eq ( hs_tag ( 'cursor' , bg ), gh ( theme , 'normal' , fgBg = 'bg' ))
627- self . assertNotEqual ( hs_tag ( 'console' , fg ), 'blue' )
628- self .assertNotEqual (hs_tag ('console' , bg ), 'yellow' )
629- eq (d .set_color_sample .called , 1 )
622+ page .paint_theme_sample ()
623+ new_console = { 'foreground' : 'blue' ,
624+ 'background' : 'yellow' ,}
625+ for key , value in new_console . items ():
626+ self .assertNotEqual (hs_tag ('console' , key ), value )
627+ eq (page .set_color_sample .called , 1 )
630628
631629 # Apply changes.
632- changes .add_option ('highlight' , theme , 'console-foreground' , 'blue' )
633- changes .add_option ('highlight' , theme , 'console-background' , 'yellow' )
634- d .paint_theme_sample ()
635-
636- eq (hs_tag ('break' , fg ), gh (theme , 'break' , fgBg = 'fg' ))
637- eq (hs_tag ('cursor' , bg ), gh (theme , 'normal' , fgBg = 'bg' ))
638- eq (hs_tag ('console' , fg ), 'blue' )
639- eq (hs_tag ('console' , bg ), 'yellow' )
640- eq (d .set_color_sample .called , 2 )
630+ for key , value in new_console .items ():
631+ changes .add_option ('highlight' , theme , 'console-' + key , value )
632+ page .paint_theme_sample ()
633+ for key , value in new_console .items ():
634+ eq (hs_tag ('console' , key ), value )
635+ eq (page .set_color_sample .called , 2 )
641636
642- d .paint_theme_sample = Func ()
637+ page .paint_theme_sample = Func ()
643638
644639 def test_delete_custom (self ):
645640 eq = self .assertEqual
0 commit comments