Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Side by Side Diff: Lib/tkinter/test/test_ttk/test_widgets.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/tkinter/test/support.py ('k') | Lib/turtle.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import unittest 1 import unittest
2 import tkinter 2 import tkinter
3 import os 3 import os
4 from tkinter import ttk 4 from tkinter import ttk
5 from test.support import requires, run_unittest 5 from test.support import requires, run_unittest
6 import sys
7 6
8 import tkinter.test.support as support 7 import tkinter.test.support as support
9 from tkinter.test.test_ttk.test_functions import MockTclObj, MockStateSpec 8 from tkinter.test.test_ttk.test_functions import MockTclObj, MockStateSpec
10 9
11 requires('gui') 10 requires('gui')
12 11
13 class WidgetTest(unittest.TestCase): 12 class WidgetTest(unittest.TestCase):
14 """Tests methods available in every ttk widget.""" 13 """Tests methods available in every ttk widget."""
15 14
16 def setUp(self): 15 def setUp(self):
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 self.assertEqual(self.nb.index('end'), 1) 554 self.assertEqual(self.nb.index('end'), 1)
556 self.nb.add(self.child2) 555 self.nb.add(self.child2)
557 self.assertEqual(self.nb.index('end'), 1) 556 self.assertEqual(self.nb.index('end'), 1)
558 self.nb.select(self.child2) 557 self.nb.select(self.child2)
559 558
560 self.assertTrue(self.nb.tab('current')) 559 self.assertTrue(self.nb.tab('current'))
561 self.nb.add(self.child1, text='a') 560 self.nb.add(self.child1, text='a')
562 561
563 self.nb.pack() 562 self.nb.pack()
564 self.nb.wait_visibility() 563 self.nb.wait_visibility()
565 if sys.platform == 'darwin': 564 self.assertEqual(self.nb.tab('@5,5'), self.nb.tab('current'))
566 tb_idx = "@20,5"
567 else:
568 tb_idx = "@5,5"
569 self.assertEqual(self.nb.tab(tb_idx), self.nb.tab('current'))
570 565
571 for i in range(5, 100, 5): 566 for i in range(5, 100, 5):
572 try: 567 if self.nb.tab('@%d, 5' % i, text=None) == 'a':
573 if self.nb.tab('@%d, 5' % i, text=None) == 'a': 568 break
574 break
575 except tkinter.TclError:
576 pass
577
578 else: 569 else:
579 self.fail("Tab with text 'a' not found") 570 self.fail("Tab with text 'a' not found")
580 571
581 572
582 def test_add_and_hidden(self): 573 def test_add_and_hidden(self):
583 self.assertRaises(tkinter.TclError, self.nb.hide, -1) 574 self.assertRaises(tkinter.TclError, self.nb.hide, -1)
584 self.assertRaises(tkinter.TclError, self.nb.hide, 'hi') 575 self.assertRaises(tkinter.TclError, self.nb.hide, 'hi')
585 self.assertRaises(tkinter.TclError, self.nb.hide, None) 576 self.assertRaises(tkinter.TclError, self.nb.hide, None)
586 self.assertRaises(tkinter.TclError, self.nb.add, None) 577 self.assertRaises(tkinter.TclError, self.nb.add, None)
587 self.assertRaises(tkinter.TclError, self.nb.add, ttk.Label(), 578 self.assertRaises(tkinter.TclError, self.nb.add, ttk.Label(),
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 self.nb.event_generate('<Shift-Control-Tab>') 715 self.nb.event_generate('<Shift-Control-Tab>')
725 self.assertEqual(self.nb.select(), str(self.child1)) 716 self.assertEqual(self.nb.select(), str(self.child1))
726 self.nb.focus_force() 717 self.nb.focus_force()
727 self.nb.event_generate('<Shift-Control-Tab>') 718 self.nb.event_generate('<Shift-Control-Tab>')
728 self.assertEqual(self.nb.select(), str(self.child2)) 719 self.assertEqual(self.nb.select(), str(self.child2))
729 720
730 self.nb.tab(self.child1, text='a', underline=0) 721 self.nb.tab(self.child1, text='a', underline=0)
731 self.nb.enable_traversal() 722 self.nb.enable_traversal()
732 self.nb.focus_force() 723 self.nb.focus_force()
733 support.simulate_mouse_click(self.nb, 5, 5) 724 support.simulate_mouse_click(self.nb, 5, 5)
734 if sys.platform == 'darwin': 725 self.nb.event_generate('<Alt-a>')
735 self.nb.event_generate('<Option-a>')
736 else:
737 self.nb.event_generate('<Alt-a>')
738 self.assertEqual(self.nb.select(), str(self.child1)) 726 self.assertEqual(self.nb.select(), str(self.child1))
739 727
740 728
741 class TreeviewTest(unittest.TestCase): 729 class TreeviewTest(unittest.TestCase):
742 730
743 def setUp(self): 731 def setUp(self):
744 support.root_deiconify() 732 support.root_deiconify()
745 self.tv = ttk.Treeview(padding=0) 733 self.tv = ttk.Treeview(padding=0)
746 734
747 def tearDown(self): 735 def tearDown(self):
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 1130
1143 1131
1144 tests_gui = ( 1132 tests_gui = (
1145 WidgetTest, ButtonTest, CheckbuttonTest, RadiobuttonTest, 1133 WidgetTest, ButtonTest, CheckbuttonTest, RadiobuttonTest,
1146 ComboboxTest, EntryTest, PanedwindowTest, ScaleTest, NotebookTest, 1134 ComboboxTest, EntryTest, PanedwindowTest, ScaleTest, NotebookTest,
1147 TreeviewTest 1135 TreeviewTest
1148 ) 1136 )
1149 1137
1150 if __name__ == "__main__": 1138 if __name__ == "__main__":
1151 run_unittest(*tests_gui) 1139 run_unittest(*tests_gui)
OLDNEW
« no previous file with comments | « Lib/tkinter/test/support.py ('k') | Lib/turtle.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+