unit testing - How to specify properties of wx.MouseEvent? -


i trying write pyunit unit test 1 of wxpython classes, receives mouse wheel events. unit test spawns mouse event

event = wx.mouseevent(mousetype=wx.wxevt_mousewheel) 

unfortunately, spawns mouse wheel event wheelrotation = 0. mouseevent class prevents me manually setting nonzero wheel rotation in turn prevents me testing nontrivial cases of event handler.

is there way synthetically generate mouse wheel events nonzero rotations (which can used in unit tests)?

not 100% sure valid way but:

>>> import wx >>> event = wx.mouseevent(mousetype=wx.wxevt_mousewheel) >>> event.wheelrotation = 22 traceback (most recent call last):   file "<stdin>", line 1, in <module> attributeerror: can't set attribute >>> event.m_wheelrotation = 22 >>> event.wheelrotation 22                                                                              >>> event.m_wheelrotation = 25 >>> event.wheelrotation                                                  25                                                                              >>>  

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -