mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-07-31 21:28:52 +00:00
Rename "event" to "message"
After the recent refactorings, a "control event" is not necessarily an "event" (it may be a "command"). Similarly, the unique "device event" used to send the device clipboard content is more a "reponse" to the request from the client than an "event". Rename both to "message", and rename the message types to better describe their intent.
This commit is contained in:
parent
f710d76c9e
commit
28980bbc90
28 changed files with 777 additions and 778 deletions
28
app/tests/test_device_msg_deserialize.c
Normal file
28
app/tests/test_device_msg_deserialize.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "device_msg.h"
|
||||
|
||||
#include <stdio.h>
|
||||
static void test_deserialize_clipboard(void) {
|
||||
const unsigned char input[] = {
|
||||
DEVICE_MSG_TYPE_CLIPBOARD,
|
||||
0x00, 0x03, // text length
|
||||
0x41, 0x42, 0x43, // "ABC"
|
||||
};
|
||||
|
||||
struct device_msg msg;
|
||||
ssize_t r = device_msg_deserialize(input, sizeof(input), &msg);
|
||||
assert(r == 6);
|
||||
|
||||
assert(msg.type == DEVICE_MSG_TYPE_CLIPBOARD);
|
||||
assert(msg.clipboard.text);
|
||||
assert(!strcmp("ABC", msg.clipboard.text));
|
||||
|
||||
device_msg_destroy(&msg);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
test_deserialize_clipboard();
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue