diff --git a/app/tests/test_control_msg_serialize.c b/app/tests/test_control_msg_serialize.c index 0d19919e..e43c7ce4 100644 --- a/app/tests/test_control_msg_serialize.c +++ b/app/tests/test_control_msg_serialize.c @@ -411,6 +411,26 @@ static void test_serialize_open_hard_keyboard(void) { assert(!memcmp(buf, expected, sizeof(expected))); } +static void test_serialize_start_app(void) { + struct sc_control_msg msg = { + .type = SC_CONTROL_MSG_TYPE_START_APP, + .start_app = { + .name = "firefox", + }, + }; + + uint8_t buf[SC_CONTROL_MSG_MAX_SIZE]; + size_t size = sc_control_msg_serialize(&msg, buf); + assert(size == 9); + + const uint8_t expected[] = { + SC_CONTROL_MSG_TYPE_START_APP, + 7, // length + 'f', 'i', 'r', 'e', 'f', 'o', 'x', // app name + }; + assert(!memcmp(buf, expected, sizeof(expected))); +} + static void test_serialize_reset_video(void) { struct sc_control_msg msg = { .type = SC_CONTROL_MSG_TYPE_RESET_VIDEO, @@ -448,6 +468,7 @@ int main(int argc, char *argv[]) { test_serialize_uhid_input(); test_serialize_uhid_destroy(); test_serialize_open_hard_keyboard(); + test_serialize_start_app(); test_serialize_reset_video(); return 0; }