Skip to content

Commit

Permalink
test OR resizing too
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@8051 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Nov 4, 2014
1 parent 3986a62 commit 6862687
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions src/tests/xpra/test_apps/test_window_resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ def change_callback(self, window, entry):
print("text=%s" % entry.get_text())
window.set_title(entry.get_text())

width = 400
height = 200
counter = 0
def main():
def make_window(OR=False):
class State(object):
pass
state = State()
state.counter = 0
state.width = 400-OR*100
state.height = 200-OR*50
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_size_request(width, height)
window.set_size_request(state.width, state.height)
window.connect("delete_event", gtk.mainquit)
window.set_title("OR=%s" % OR)
window.set_position(gtk.WIN_POS_CENTER)
vbox = gtk.VBox()
hbox = gtk.HBox()
w_e = gtk.Entry(max=64)
Expand All @@ -33,33 +38,35 @@ def set_size(*args):

btn = gtk.Button("auto resize me")
def resize(*args):
global width, height
width = max(200, (width+20) % 600)
height = max(200, (height+20) % 400)
print("resizing to %s x %s" % (width, height))
window.resize(width, height)
state.width = max(200, (state.width+20) % 600)
state.height = max(200, (state.height+20) % 400)
print("resizing to %s x %s" % (state.width, state.height))
window.resize(state.width, state.height)
btn.connect('clicked', resize)
vbox.add(btn)

btn = gtk.Button("fast resize")
def do_resize_fast():
global counter
global width, height
width = max(200, (width+1) % 600)
height = max(200, (height+1) % 400)
width = max(200, (state.width+1) % 600)
height = max(200, (state.height+1) % 400)
print("resizing to %s x %s" % (width, height))
window.resize(width, height)
counter -= 1
return counter>0
state.counter -= 1
return state.counter>0
def resize_fast(*args):
global counter
counter = 200
state.counter = 200
gobject.idle_add(do_resize_fast)
btn.connect('clicked', resize_fast)
vbox.add(btn)

window.add(vbox)
window.realize()
window.window.set_override_redirect(OR)
window.show_all()

def main():
make_window(False)
make_window(True)
gtk.main()
return 0

Expand Down

0 comments on commit 6862687

Please sign in to comment.