summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test/test_tkinter/test_misc.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-01-02 08:32:13 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-01-02 08:32:13 (GMT)
commite48741a61946d97444acc395f6874bf3346bbf33 (patch)
tree3524b0be9025b5f49724c3acb189689913465631 /Lib/tkinter/test/test_tkinter/test_misc.py
parentb83a86a21031ea46fdfbaa53be186a08c6cb16dc (diff)
parent4cf4f3a7c62c4db00d56507ac9e37a05381941cb (diff)
downloadcpython-e48741a61946d97444acc395f6874bf3346bbf33.zip
cpython-e48741a61946d97444acc395f6874bf3346bbf33.tar.gz
cpython-e48741a61946d97444acc395f6874bf3346bbf33.tar.bz2
Merge heads
Diffstat (limited to 'Lib/tkinter/test/test_tkinter/test_misc.py')
-rw-r--r--Lib/tkinter/test/test_tkinter/test_misc.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/Lib/tkinter/test/test_tkinter/test_misc.py b/Lib/tkinter/test/test_tkinter/test_misc.py
new file mode 100644
index 0000000..d325b31
--- /dev/null
+++ b/Lib/tkinter/test/test_tkinter/test_misc.py
@@ -0,0 +1,45 @@
+import unittest
+import tkinter
+from tkinter import ttk
+from test import support
+
+support.requires('gui')
+
+class MiscTest(unittest.TestCase):
+
+ def setUp(self):
+ self.root = ttk.setup_master()
+
+ def test_tk_setPalette(self):
+ root = self.root
+ root.tk_setPalette('black')
+ self.assertEqual(root['background'], 'black')
+ root.tk_setPalette('white')
+ self.assertEqual(root['background'], 'white')
+ self.assertRaisesRegex(tkinter.TclError,
+ '^unknown color name "spam"$',
+ root.tk_setPalette, 'spam')
+
+ root.tk_setPalette(background='black')
+ self.assertEqual(root['background'], 'black')
+ root.tk_setPalette(background='blue', highlightColor='yellow')
+ self.assertEqual(root['background'], 'blue')
+ self.assertEqual(root['highlightcolor'], 'yellow')
+ root.tk_setPalette(background='yellow', highlightColor='blue')
+ self.assertEqual(root['background'], 'yellow')
+ self.assertEqual(root['highlightcolor'], 'blue')
+ self.assertRaisesRegex(tkinter.TclError,
+ '^unknown color name "spam"$',
+ root.tk_setPalette, background='spam')
+ self.assertRaisesRegex(tkinter.TclError,
+ '^must specify a background color$',
+ root.tk_setPalette, spam='white')
+ self.assertRaisesRegex(tkinter.TclError,
+ '^must specify a background color$',
+ root.tk_setPalette, highlightColor='blue')
+
+
+tests_gui = (MiscTest, )
+
+if __name__ == "__main__":
+ support.run_unittest(*tests_gui)