Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
tkinter.test.test_ttk.test_widgets.PanedwindowTest Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_add
def test_forget
def test_insert
def test_pane
def test_sashpos

Public Attributes

 paned

Detailed Description

Definition at line 308 of file test_widgets.py.


Member Function Documentation

Definition at line 310 of file test_widgets.py.

00310 
00311     def setUp(self):
00312         support.root_deiconify()
00313         self.paned = ttk.Panedwindow()

Here is the caller graph for this function:

Definition at line 314 of file test_widgets.py.

00314 
00315     def tearDown(self):
00316         self.paned.destroy()
00317         support.root_withdraw()
00318 

Here is the caller graph for this function:

Definition at line 319 of file test_widgets.py.

00319 
00320     def test_add(self):
00321         # attempt to add a child that is not a direct child of the paned window
00322         label = ttk.Label(self.paned)
00323         child = ttk.Label(label)
00324         self.assertRaises(tkinter.TclError, self.paned.add, child)
00325         label.destroy()
00326         child.destroy()
00327         # another attempt
00328         label = ttk.Label()
00329         child = ttk.Label(label)
00330         self.assertRaises(tkinter.TclError, self.paned.add, child)
00331         child.destroy()
00332         label.destroy()
00333 
00334         good_child = ttk.Label()
00335         self.paned.add(good_child)
00336         # re-adding a child is not accepted
00337         self.assertRaises(tkinter.TclError, self.paned.add, good_child)
00338 
00339         other_child = ttk.Label(self.paned)
00340         self.paned.add(other_child)
00341         self.assertEqual(self.paned.pane(0), self.paned.pane(1))
00342         self.assertRaises(tkinter.TclError, self.paned.pane, 2)
00343         good_child.destroy()
00344         other_child.destroy()
00345         self.assertRaises(tkinter.TclError, self.paned.pane, 0)
00346 

Here is the call graph for this function:

Definition at line 347 of file test_widgets.py.

00347 
00348     def test_forget(self):
00349         self.assertRaises(tkinter.TclError, self.paned.forget, None)
00350         self.assertRaises(tkinter.TclError, self.paned.forget, 0)
00351 
00352         self.paned.add(ttk.Label())
00353         self.paned.forget(0)
00354         self.assertRaises(tkinter.TclError, self.paned.forget, 0)
00355 

Here is the call graph for this function:

Definition at line 356 of file test_widgets.py.

00356 
00357     def test_insert(self):
00358         self.assertRaises(tkinter.TclError, self.paned.insert, None, 0)
00359         self.assertRaises(tkinter.TclError, self.paned.insert, 0, None)
00360         self.assertRaises(tkinter.TclError, self.paned.insert, 0, 0)
00361 
00362         child = ttk.Label()
00363         child2 = ttk.Label()
00364         child3 = ttk.Label()
00365 
00366         self.assertRaises(tkinter.TclError, self.paned.insert, 0, child)
00367 
00368         self.paned.insert('end', child2)
00369         self.paned.insert(0, child)
00370         self.assertEqual(self.paned.panes(), (str(child), str(child2)))
00371 
00372         self.paned.insert(0, child2)
00373         self.assertEqual(self.paned.panes(), (str(child2), str(child)))
00374 
00375         self.paned.insert('end', child3)
00376         self.assertEqual(self.paned.panes(),
00377             (str(child2), str(child), str(child3)))
00378 
00379         # reinserting a child should move it to its current position
00380         panes = self.paned.panes()
00381         self.paned.insert('end', child3)
00382         self.assertEqual(panes, self.paned.panes())
00383 
00384         # moving child3 to child2 position should result in child2 ending up
00385         # in previous child position and child ending up in previous child3
00386         # position
00387         self.paned.insert(child2, child3)
00388         self.assertEqual(self.paned.panes(),
00389             (str(child3), str(child2), str(child)))
00390 

Here is the call graph for this function:

Definition at line 391 of file test_widgets.py.

00391 
00392     def test_pane(self):
00393         self.assertRaises(tkinter.TclError, self.paned.pane, 0)
00394 
00395         child = ttk.Label()
00396         self.paned.add(child)
00397         self.assertTrue(isinstance(self.paned.pane(0), dict))
00398         self.assertEqual(self.paned.pane(0, weight=None), 0)
00399         # newer form for querying a single option
00400         self.assertEqual(self.paned.pane(0, 'weight'), 0)
00401         self.assertEqual(self.paned.pane(0), self.paned.pane(str(child)))
00402 
00403         self.assertRaises(tkinter.TclError, self.paned.pane, 0,
00404             badoption='somevalue')
00405 

Here is the call graph for this function:

Definition at line 406 of file test_widgets.py.

00406 
00407     def test_sashpos(self):
00408         self.assertRaises(tkinter.TclError, self.paned.sashpos, None)
00409         self.assertRaises(tkinter.TclError, self.paned.sashpos, '')
00410         self.assertRaises(tkinter.TclError, self.paned.sashpos, 0)
00411 
00412         child = ttk.Label(self.paned, text='a')
00413         self.paned.add(child, weight=1)
00414         self.assertRaises(tkinter.TclError, self.paned.sashpos, 0)
00415         child2 = ttk.Label(self.paned, text='b')
00416         self.paned.add(child2)
00417         self.assertRaises(tkinter.TclError, self.paned.sashpos, 1)
00418 
00419         self.paned.pack(expand=True, fill='both')
00420         self.paned.wait_visibility()
00421 
00422         curr_pos = self.paned.sashpos(0)
00423         self.paned.sashpos(0, 1000)
00424         self.assertTrue(curr_pos != self.paned.sashpos(0))
00425         self.assertTrue(isinstance(self.paned.sashpos(0), int))
00426 

Here is the call graph for this function:


Member Data Documentation

Definition at line 312 of file test_widgets.py.


The documentation for this class was generated from the following file: