MCPcopy
hub / github.com/EngoEngine/engo / TestAxisMouse

Function TestAxisMouse

axis_test.go:427–455  ·  view source on GitHub ↗

Test some state changes on the two mouse axes.

(t *testing.T)

Source from the content-addressed store, hash-verified

425
426// Test some state changes on the two mouse axes.
427func TestAxisMouse(t *testing.T) {
428 Input = NewInputManager()
429
430 SetGlobalScale(Point{1, 1})
431
432 Input.RegisterAxis("mouse x", NewAxisMouse(AxisMouseHori))
433 Input.RegisterAxis("mouse y", NewAxisMouse(AxisMouseVert))
434
435 runAxisMouse("Pass 0", t, 0.0, 0.0)
436
437 Input.Mouse.X = 1.0
438 Input.Mouse.Y = 1.0
439 runAxisMouse("Pass 1", t, 1.0, 1.0)
440
441 // Resets state to 0.0
442 runAxisMouse("Pass 2", t, 0.0, 0.0)
443 runAxisMouse("Pass 3", t, 0.0, 0.0)
444
445 Input.Mouse.Y = -1.0
446 Input.Mouse.X = -1.0
447 runAxisMouse("Pass 4", t, -2.0, -2.0)
448
449 Input.Mouse.X = 0.0
450 Input.Mouse.Y = 0.0
451 runAxisMouse("Pass 4", t, 1.0, 1.0)
452
453 runAxisMouse("Pass 6", t, 0.0, 0.0)
454 runAxisMouse("Pass 7", t, 0.0, 0.0)
455}
456
457// Used to store results when benchmarking.
458var axResult [6]axState

Callers

nothing calls this directly

Calls 5

NewInputManagerFunction · 0.85
SetGlobalScaleFunction · 0.85
NewAxisMouseFunction · 0.85
runAxisMouseFunction · 0.85
RegisterAxisMethod · 0.80

Tested by

no test coverage detected