Issue #22236: Tkinter tests now don't reuse default root window. New root

window is created for every test class.

Fixed Tkinter images copying operations in NoDefaultRoot mode.

Tcl command names generated for "after" callbacks now contains a name of
original function.
This commit is contained in:
Serhiy Storchaka 2014-08-24 09:07:47 +03:00
parent ee55826072
commit d00aff2f62
15 changed files with 231 additions and 271 deletions

View file

@ -1,16 +1,12 @@
import unittest
import tkinter
from tkinter import ttk
from test import support
from tkinter.test.support import requires_tcl
from tkinter.test.support import AbstractTkTest, requires_tcl
support.requires('gui')
class MiscTest(unittest.TestCase):
def setUp(self):
self.root = ttk.setup_master()
class MiscTest(AbstractTkTest, unittest.TestCase):
def test_image_types(self):
image_types = self.root.image_types()
@ -23,15 +19,13 @@ class MiscTest(unittest.TestCase):
self.assertIsInstance(image_names, tuple)
class BitmapImageTest(unittest.TestCase):
class BitmapImageTest(AbstractTkTest, unittest.TestCase):
@classmethod
def setUpClass(cls):
AbstractTkTest.setUpClass.__func__(cls)
cls.testfile = support.findfile('python.xbm', subdir='imghdrdata')
def setUp(self):
self.root = ttk.setup_master()
def test_create_from_file(self):
image = tkinter.BitmapImage('::img::test', master=self.root,
foreground='yellow', background='blue',
@ -107,16 +101,13 @@ class BitmapImageTest(unittest.TestCase):
'-foreground {} {} #000000 yellow')
class PhotoImageTest(unittest.TestCase):
class PhotoImageTest(AbstractTkTest, unittest.TestCase):
@classmethod
def setUpClass(cls):
AbstractTkTest.setUpClass.__func__(cls)
cls.testfile = support.findfile('python.gif', subdir='imghdrdata')
def setUp(self):
self.root = ttk.setup_master()
self.wantobjects = self.root.wantobjects()
def create(self):
return tkinter.PhotoImage('::img::test', master=self.root,
file=self.testfile)