add set_input_mode tests and tweak implementation