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

Function TestAxisComplex

axis_test.go:253–413  ·  view source on GitHub ↗

Test configured axes using multiple pairs on one axis.

(t *testing.T)

Source from the content-addressed store, hash-verified

251
252// Test configured axes using multiple pairs on one axis.
253func TestAxisComplex(t *testing.T) {
254 Input = NewInputManager()
255
256 for _, cfg := range axSimpleCfg {
257 Input.RegisterAxis(cfg.Name, cfg.Pairs[0], cfg.Pairs[1])
258 }
259
260 runAxisChecks("Init (0.0)", t, axPass0)
261
262 // Empty update pass0
263 Input.update()
264 runAxisChecks("Pass (0.1)", t, axPass0)
265 Input.update()
266 runAxisChecks("Pass (0.2)", t, axPass0)
267 Input.update()
268 runAxisChecks("Pass (0.3)", t, axPass0)
269
270 // Set even true pass1
271 Input.update()
272 Input.keys.Set(axSimpleCfg[1].Pairs[0].Max, true)
273 Input.keys.Set(axSimpleCfg[3].Pairs[0].Max, true)
274 Input.keys.Set(axSimpleCfg[5].Pairs[0].Max, true)
275
276 runAxisChecks("Pass (1.0)", t, axPass1)
277
278 // Keeps state on pass2
279 Input.update()
280 runAxisChecks("Pass (2.0)", t, axPass2)
281 Input.update()
282 runAxisChecks("Pass (2.1)", t, axPass2)
283 Input.update()
284 runAxisChecks("Pass (2.2)", t, axPass2)
285 Input.update()
286 runAxisChecks("Pass (2.3)", t, axPass2)
287
288 // Set even true pass3
289 Input.update()
290 Input.keys.Set(axSimpleCfg[1].Pairs[0].Max, false)
291 Input.keys.Set(axSimpleCfg[3].Pairs[0].Max, false)
292 Input.keys.Set(axSimpleCfg[5].Pairs[0].Max, false)
293
294 runAxisChecks("Pass (3.0)", t, axPass3)
295
296 // Keeps state on pass4
297 Input.update()
298 runAxisChecks("Pass (4.0)", t, axPass4)
299 Input.update()
300 runAxisChecks("Pass (4.1)", t, axPass4)
301 Input.update()
302 runAxisChecks("Pass (4.2)", t, axPass4)
303 Input.update()
304 runAxisChecks("Pass (4.3)", t, axPass4)
305
306 // Set even true pass5
307 Input.update()
308 Input.keys.Set(axSimpleCfg[1].Pairs[0].Min, true)
309 Input.keys.Set(axSimpleCfg[3].Pairs[0].Min, true)
310 Input.keys.Set(axSimpleCfg[5].Pairs[0].Min, true)

Callers

nothing calls this directly

Calls 5

NewInputManagerFunction · 0.85
runAxisChecksFunction · 0.85
RegisterAxisMethod · 0.80
updateMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected