[testinggtk] window.destroy() should remove it from the toplevels list.



commit 77b7a9f687eeab563e3d815ab4636bd5e26603a2
Author: Björn Lindqvist <bjourne gmail com>
Date:   Fri Jul 10 13:46:01 2009 +0200

    window.destroy() should remove it from the toplevels list.

 tests/test_window.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_window.py b/tests/test_window.py
index cf0da94..c93943a 100644
--- a/tests/test_window.py
+++ b/tests/test_window.py
@@ -323,6 +323,18 @@ def test_destroy():
     win = gtk.Window()
     win.destroy()
 
+def test_destroy_removes_window_from_toplevels():
+    '''
+    Calling ``destroy()`` on a ``gtk.Window`` should remove it from
+    the list of toplevels.
+    '''
+    windows = [gtk.Window() for x in range(2)]
+    assert len(gtk.window_list_toplevels()) == 2
+    windows[0].destroy()
+    assert len(gtk.window_list_toplevels()) == 1
+    windows[1].destroy()
+    assert len(gtk.window_list_toplevels()) == 0
+
 @utils.pass_on_warnings 
 def test_set_parent_on_toplevel():
     '''



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]