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

Function runBtnChecks

button_test.go:72–86  ·  view source on GitHub ↗

Checks the state of all configured buttons against the expected state.

(msg string, t *testing.T, expect [6]btnState)

Source from the content-addressed store, hash-verified

70
71// Checks the state of all configured buttons against the expected state.
72func runBtnChecks(msg string, t *testing.T, expect [6]btnState) {
73 for i, cfg := range btnSimpleCfg {
74 exp := expect[i]
75 btn := Input.Button(cfg.Name)
76 if exp.down != btn.Down() {
77 t.Error(msg, " Invalid on: ", cfg.Name, " - Down")
78 }
79 if exp.justUp != btn.JustReleased() {
80 t.Error(msg, " Invalid on: ", cfg.Name, " - Just Up")
81 }
82 if exp.justDown != btn.JustPressed() {
83 t.Error(msg, " Invalid on: ", cfg.Name, " - Just Down")
84 }
85 }
86}
87
88// Test configured axes using a single key on one button.
89func TestButtonSimple(t *testing.T) {

Callers 2

TestButtonSimpleFunction · 0.85
TestButtonComplexFunction · 0.85

Calls 5

ButtonMethod · 0.80
DownMethod · 0.45
ErrorMethod · 0.45
JustReleasedMethod · 0.45
JustPressedMethod · 0.45

Tested by

no test coverage detected