mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #21477: Idle htest: merge and modify run and runall; add many tests.
Patch by Saimadhav Heblikar
This commit is contained in:
parent
10cbb1e463
commit
1b392ffe67
18 changed files with 412 additions and 179 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue