def test_item_removal(self): canvas = Canvas() view = GtkView(canvas) window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.add(view) window.show_all() box = Box() canvas.add(box) # No gtk main loop, so updates occur instantly assert not canvas.require_update() # Process pending (expose) events, which cause the canvas to be drawn. while gtk.events_pending(): gtk.main_iteration() assert len(canvas.get_all_items()) == len(view._qtree) view.focused_item = box canvas.remove(box) assert len(canvas.get_all_items()) == 0 assert len(view._qtree) == 0 window.destroy()
def test_item_removal(self): canvas = Canvas() view = GtkView(canvas) window = Gtk.Window.new(Gtk.WindowType.TOPLEVEL) window.add(view) window.show_all() box = Box() canvas.add(box) # No gtk main loop, so updates occur instantly assert not canvas.require_update() # Process pending (expose) events, which cause the canvas to be drawn. while Gtk.events_pending(): Gtk.main_iteration() assert len(canvas.get_all_items()) == len(view._qtree) view.focused_item = box canvas.remove(box) assert len(canvas.get_all_items()) == 0 assert len(view._qtree) == 0 window.destroy()