Checks the state of keys in the configuration against the expected state.
(msg string, t *testing.T, mgr *KeyManager, expect [12]keyState)
| 132 | |
| 133 | // Checks the state of keys in the configuration against the expected state. |
| 134 | func runKeyChecks(msg string, t *testing.T, mgr *KeyManager, expect [12]keyState) { |
| 135 | for i, cd := range keySimpleCfg { |
| 136 | exp := expect[i] |
| 137 | sto := mgr.Get(cd) |
| 138 | |
| 139 | if exp.state != sto.State() { |
| 140 | t.Error(msg, " Invalid on: ", cd, " - State") |
| 141 | } |
| 142 | if (KeyStateUp == exp.state) != sto.Up() { |
| 143 | t.Error(msg, " Invalid on: ", cd, " - Up") |
| 144 | } |
| 145 | if (KeyStateDown == exp.state) != sto.Down() { |
| 146 | t.Error(msg, " Invalid on: ", cd, " - Down") |
| 147 | } |
| 148 | if (KeyStateJustUp == exp.state) != sto.JustReleased() { |
| 149 | t.Error(msg, " Invalid on: ", cd, " - Just Up") |
| 150 | } |
| 151 | if (KeyStateJustDown == exp.state) != sto.JustPressed() { |
| 152 | t.Error(msg, " Invalid on: ", cd, " - Just Down") |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | // This test sets up a key manager and changes the states a few times, every |
| 158 | // time the state changes the results are checked against the expected outcome. |
no test coverage detected