summaryrefslogtreecommitdiff
path: root/Lib/idlelib/TreeWidget.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-05-24 18:48:18 -0400
committerTerry Jan Reedy <tjreedy@udel.edu>2014-05-24 18:48:18 -0400
commit1b392ffe67febbe8740520289bb828fdf060e363 (patch)
tree27d5496ec5479afd9d1a36efcd02614315e7c447 /Lib/idlelib/TreeWidget.py
parent10cbb1e463378391d2368874bb31af0447fa73e6 (diff)
downloadcpython-git-1b392ffe67febbe8740520289bb828fdf060e363.tar.gz
Issue #21477: Idle htest: merge and modify run and runall; add many tests.
Patch by Saimadhav Heblikar
Diffstat (limited to 'Lib/idlelib/TreeWidget.py')
-rw-r--r--Lib/idlelib/TreeWidget.py32
1 files changed, 15 insertions, 17 deletions
diff --git a/Lib/idlelib/TreeWidget.py b/Lib/idlelib/TreeWidget.py
index 1f4854ddc4..2ae6555a39 100644
--- a/Lib/idlelib/TreeWidget.py
+++ b/Lib/idlelib/TreeWidget.py
@@ -448,29 +448,27 @@ class ScrolledCanvas:
return "break"
-# Testing functions
-
-def test():
- from idlelib import PyShell
- root = Toplevel(PyShell.root)
- root.configure(bd=0, bg="yellow")
- root.focus_set()
+def _tree_widget(parent):
+ root = Tk()
+ root.title("Test TreeWidget")
+ width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
+ root.geometry("+%d+%d"%(x, y + 150))
+ # test with scrollable canvas
sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
- sc.frame.pack(expand=1, fill="both")
- item = FileTreeItem("C:/windows/desktop")
+ sc.frame.pack(expand=1, fill="both", side=LEFT)
+ item = FileTreeItem(os.getcwd())
node = TreeNode(sc.canvas, None, item)
node.expand()
-def test2():
- # test w/o scrolling canvas
- root = Tk()
- root.configure(bd=0)
+ # test without scrollable canvas
canvas = Canvas(root, bg="white", highlightthickness=0)
- canvas.pack(expand=1, fill="both")
- item = FileTreeItem(os.curdir)
+ canvas.pack(expand=0, fill="both", side=RIGHT)
+ item = FileTreeItem(os.getcwd())
node = TreeNode(canvas, None, item)
node.update()
- canvas.focus_set()
+
+ root.mainloop()
if __name__ == '__main__':
- test()
+ from idlelib.idle_test.htest import run
+ run(_tree_widget)