#!/usr/bin/python
# Test case for bug 620513
# http://bugzilla.novell.com/show_bug.cgi?id=620513

import gtk

def create_view (text):
	view = gtk.TextView()
	# NOTE: it freezes only when wrap_mode is gtk.WRAP_WORD_CHAR !
	view.set_wrap_mode (gtk.WRAP_WORD_CHAR)
	view.get_buffer().set_text (text)
	return view

def create_box():
	# NOTE: it freezes only when homogeneous = True !
	hbox = gtk.HBox (True, 6)
	# NOTE: it freezes only when columns number >= 3 !
	for col in xrange (3):
		view = create_view ("aaaaaaaaaaaaaaaaaaaaaaaaaaa")
		hbox.pack_start (view, True)
	return hbox

widget = create_box()

scroll = gtk.ScrolledWindow()
# NOTE: it freezes much faster when hscroll policy is gtk.POLICY_NEVER !
scroll.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scroll.add_with_viewport (widget)

window = gtk.Window()
window.add (scroll)
window.set_title ("Resize me !")
window.set_default_size (400, 400)
window.set_border_width (12)
window.set_property ("allow_shrink", True)
window.show_all()
window.connect ("delete_event", gtk.main_quit)
gtk.main()

