mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	[3.9] bpo-33289: Return RGB triplet of ints instead of floats from tkinter.colorchooser (GH-6578). (GH-24318)
(cherry picked from commit 6713e869c4)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
			
			
This commit is contained in:
		
							parent
							
								
									ff06957710
								
							
						
					
					
						commit
						3d5434d5cb
					
				
					 5 changed files with 103 additions and 27 deletions
				
			
		|  | @ -192,6 +192,26 @@ def test_clipboard_astral(self): | |||
|         with self.assertRaises(tkinter.TclError): | ||||
|             root.clipboard_get() | ||||
| 
 | ||||
|     def test_winfo_rgb(self): | ||||
|         root = self.root | ||||
|         rgb = root.winfo_rgb | ||||
| 
 | ||||
|         # Color name. | ||||
|         self.assertEqual(rgb('red'), (65535, 0, 0)) | ||||
|         self.assertEqual(rgb('dark slate blue'), (18504, 15677, 35723)) | ||||
|         # #RGB - extends each 4-bit hex value to be 16-bit. | ||||
|         self.assertEqual(rgb('#F0F'), (0xFFFF, 0x0000, 0xFFFF)) | ||||
|         # #RRGGBB - extends each 8-bit hex value to be 16-bit. | ||||
|         self.assertEqual(rgb('#4a3c8c'), (0x4a4a, 0x3c3c, 0x8c8c)) | ||||
|         # #RRRRGGGGBBBB | ||||
|         self.assertEqual(rgb('#dede14143939'), (0xdede, 0x1414, 0x3939)) | ||||
|         # Invalid string. | ||||
|         with self.assertRaises(tkinter.TclError): | ||||
|             rgb('#123456789a') | ||||
|         # RGB triplet is invalid input. | ||||
|         with self.assertRaises(tkinter.TclError): | ||||
|             rgb((111, 78, 55)) | ||||
| 
 | ||||
|     def test_event_repr_defaults(self): | ||||
|         e = tkinter.Event() | ||||
|         e.serial = 12345 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka