InputFuzzer¶
Overview¶
For generating random mouse/touch input to a Display, to hopefully discover bugs in an automated fashion.
@author Jonathan Olson <jonathan.olson@colorado.edu>
Class InputFuzzer¶
Constructor¶
new InputFuzzer( display, seed )¶
Instance Methods¶
fuzzEvents( averageEventCount, allowMouse, allowTouch, maximumPointerCount )¶
Sends a certain (expected) number of random events through the input system for the display. @public
@param {number} averageEventCount @param {boolean} allowMouse @param {boolean} allowTouch @param {number} maximumPointerCount
createTouchEvent( type, touches )¶
Creates a touch event from multiple touch "items". @private
@param {string} type - The main event type, e.g. 'touchmove'. @param {Array.<Object>} touches - A subset of touch objects stored on the fuzzer itself. @returns {Event} - If possible a TouchEvent, but may be a CustomEvent
getRandomPosition()¶
Returns a random position somewhere in the display's global coordinates. @private
@returns {Vector2}
createTouch( position )¶
Creates a touch from a position (and adds it). @private
@param {Vector2} position @returns {Object}
removeTouch( touch )¶
Removes a touch from our list. @private
@param {Object} touch
touchStart( touch )¶
Triggers a touchStart for the given touch. @private
@param {Object} touch
touchMove( touch )¶
Triggers a touchMove for the given touch (to a random position in the display). @private
@param {Object} touch
touchEnd( touch )¶
Triggers a touchEnd for the given touch. @private
@param {Object} touch
touchCancel( touch )¶
Triggers a touchCancel for the given touch. @private
@param {Object} touch
mouseToggle()¶
Triggers a mouse toggle (switching from down => up or vice versa). @private
mouseMove()¶
Triggers a mouse move (to a random position in the display). @private
Source Code¶
See the source for InputFuzzer.js in the scenery repository.