mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	[3.13] gh-120873: Add tests for new widget options in Tk 8.7 (GH-120877) (GH-120879)
(cherry picked from commit a046c848c1)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
			
			
This commit is contained in:
		
							parent
							
								
									61e6b6ab4a
								
							
						
					
					
						commit
						cffead81fa
					
				
					 3 changed files with 104 additions and 36 deletions
				
			
		|  | @ -2,7 +2,7 @@ | |||
| 
 | ||||
| import re | ||||
| import tkinter | ||||
| from test.test_tkinter.support import (AbstractTkTest, tk_version, | ||||
| from test.test_tkinter.support import (AbstractTkTest, requires_tk, tk_version, | ||||
|                                   pixels_conv, tcl_obj_eq) | ||||
| import test.support | ||||
| 
 | ||||
|  | @ -17,6 +17,7 @@ class AbstractWidgetTest(AbstractTkTest): | |||
|     _clip_highlightthickness = True | ||||
|     _clip_pad = False | ||||
|     _clip_borderwidth = False | ||||
|     _allow_empty_justify = False | ||||
| 
 | ||||
|     @property | ||||
|     def scaling(self): | ||||
|  | @ -200,6 +201,7 @@ def test_keys(self): | |||
|             aliases = { | ||||
|                 'bd': 'borderwidth', | ||||
|                 'bg': 'background', | ||||
|                 'bgimg': 'backgroundimage', | ||||
|                 'fg': 'foreground', | ||||
|                 'invcmd': 'invalidcommand', | ||||
|                 'vcmd': 'validatecommand', | ||||
|  | @ -242,6 +244,10 @@ def test_configure_activeforeground(self): | |||
|         widget = self.create() | ||||
|         self.checkColorParam(widget, 'activeforeground') | ||||
| 
 | ||||
|     def test_configure_activerelief(self): | ||||
|         widget = self.create() | ||||
|         self.checkReliefParam(widget, 'activerelief') | ||||
| 
 | ||||
|     def test_configure_anchor(self): | ||||
|         widget = self.create() | ||||
|         self.checkEnumParam(widget, 'anchor', | ||||
|  | @ -253,6 +259,11 @@ def test_configure_background(self): | |||
|         if 'bg' in self.OPTIONS: | ||||
|             self.checkColorParam(widget, 'bg') | ||||
| 
 | ||||
|     @requires_tk(8, 7) | ||||
|     def test_configure_backgroundimage(self): | ||||
|         widget = self.create() | ||||
|         self.checkImageParam(widget, 'backgroundimage') | ||||
| 
 | ||||
|     def test_configure_bitmap(self): | ||||
|         widget = self.create() | ||||
|         self.checkParam(widget, 'bitmap', 'questhead') | ||||
|  | @ -299,8 +310,10 @@ def test_configure_font(self): | |||
|         widget = self.create() | ||||
|         self.checkParam(widget, 'font', | ||||
|                         '-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*') | ||||
|         self.checkInvalidParam(widget, 'font', '', | ||||
|                                errmsg='font "" doesn\'t exist') | ||||
|         is_ttk = widget.__class__.__module__ == 'tkinter.ttk' | ||||
|         if not is_ttk: | ||||
|             self.checkInvalidParam(widget, 'font', '', | ||||
|                                    errmsg='font "" doesn\'t exist') | ||||
| 
 | ||||
|     def test_configure_foreground(self): | ||||
|         widget = self.create() | ||||
|  | @ -355,7 +368,10 @@ def test_configure_jump(self): | |||
| 
 | ||||
|     def test_configure_justify(self): | ||||
|         widget = self.create() | ||||
|         self.checkEnumParam(widget, 'justify', 'left', 'right', 'center', | ||||
|         values = ('left', 'right', 'center') | ||||
|         if self._allow_empty_justify: | ||||
|             values += ('',) | ||||
|         self.checkEnumParam(widget, 'justify', *values, | ||||
|                             fullname='justification') | ||||
| 
 | ||||
|     def test_configure_orient(self): | ||||
|  | @ -379,6 +395,16 @@ def test_configure_pady(self): | |||
|         self.checkParam(widget, 'pady', -2, expected=expected, | ||||
|                         conv=self._conv_pad_pixels) | ||||
| 
 | ||||
|     @requires_tk(8, 7) | ||||
|     def test_configure_placeholder(self): | ||||
|         widget = self.create() | ||||
|         self.checkParam(widget, 'placeholder', 'xxx') | ||||
| 
 | ||||
|     @requires_tk(8, 7) | ||||
|     def test_configure_placeholderforeground(self): | ||||
|         widget = self.create() | ||||
|         self.checkColorParam(widget, 'placeholderforeground') | ||||
| 
 | ||||
|     def test_configure_relief(self): | ||||
|         widget = self.create() | ||||
|         self.checkReliefParam(widget, 'relief') | ||||
|  | @ -424,6 +450,11 @@ def test_configure_textvariable(self): | |||
|         var = tkinter.StringVar(self.root) | ||||
|         self.checkVariableParam(widget, 'textvariable', var) | ||||
| 
 | ||||
|     @requires_tk(8, 7) | ||||
|     def test_configure_tile(self): | ||||
|         widget = self.create() | ||||
|         self.checkBooleanParam(widget, 'tile') | ||||
| 
 | ||||
|     def test_configure_troughcolor(self): | ||||
|         widget = self.create() | ||||
|         self.checkColorParam(widget, 'troughcolor') | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Islington (bot)
						Miss Islington (bot)