FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[2.7] bpo-34189: Add simple tests for new Tk widget options. (GH-8396) by serhiy-storchaka · Pull Request #8400 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
25 changes: 23 additions & 2 deletions Lib/lib-tk/test/test_tkinter/test_widgets.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ class ListboxTest(AbstractWidgetTest, unittest.TestCase):
'disabledforeground', 'exportselection',
'font', 'foreground', 'height',
'highlightbackground', 'highlightcolor', 'highlightthickness',
'listvariable', 'relief',
'justify', 'listvariable', 'relief',
'selectbackground', 'selectborderwidth', 'selectforeground',
'selectmode', 'setgrid', 'state',
'takefocus', 'width', 'xscrollcommand', 'yscrollcommand',
Expand All @@ -714,6 +714,8 @@ def test_activestyle(self):
self.checkEnumParam(widget, 'activestyle',
'dotbox', 'none', 'underline')

test_justify = requires_tcl(8, 6, 5)(StandardOptionsTests.test_justify.im_func)

def test_listvariable(self):
widget = self.create()
var = tkinter.DoubleVar(self.root)
Expand Down Expand Up @@ -947,7 +949,9 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
OPTIONS = (
'background', 'borderwidth', 'cursor',
'handlepad', 'handlesize', 'height',
'opaqueresize', 'orient', 'relief',
'opaqueresize', 'orient',
'proxybackground', 'proxyborderwidth', 'proxyrelief',
'relief',
'sashcursor', 'sashpad', 'sashrelief', 'sashwidth',
'showhandle', 'width',
)
Expand All @@ -974,6 +978,23 @@ def test_opaqueresize(self):
widget = self.create()
self.checkBooleanParam(widget, 'opaqueresize')

@requires_tcl(8, 6, 5)
def test_proxybackground(self):
widget = self.create()
self.checkColorParam(widget, 'proxybackground')

@requires_tcl(8, 6, 5)
def test_proxyborderwidth(self):
widget = self.create()
self.checkPixelsParam(widget, 'proxyborderwidth',
0, 1.3, 2.9, 6, -2, '10p',
conv=noconv)

@requires_tcl(8, 6, 5)
def test_proxyrelief(self):
widget = self.create()
self.checkReliefParam(widget, 'proxyrelief')

def test_sashcursor(self):
widget = self.create()
self.checkCursorParam(widget, 'sashcursor')
Expand Down
14 changes: 13 additions & 1 deletion Lib/lib-tk/test/test_ttk/support.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import functools
import re
import unittest
import Tkinter as tkinter
Expand Down Expand Up @@ -54,9 +55,20 @@ def simulate_mouse_click(widget, x, y):
tcl_version = tuple(map(int, _tkinter.TCL_VERSION.split('.')))

def requires_tcl(*version):
return unittest.skipUnless(tcl_version >= version,
if len(version) <= 2:
return unittest.skipUnless(tcl_version >= version,
'requires Tcl version >= ' + '.'.join(map(str, version)))

def deco(test):
@functools.wraps(test)
def newtest(self):
if get_tk_patchlevel() < (8, 6, 5):
self.skipTest('requires Tcl version >= ' +
'.'.join(map(str, get_tk_patchlevel())))
test(self)
return newtest
return deco

_tk_patchlevel = None
def get_tk_patchlevel():
global _tk_patchlevel
Expand Down
Loading

Back | FazBrowse Home | New Git URL