feat: add integration test framework and rack/grid command support
This commit is contained in:
committed by
Loic Coenen (aider)
parent
9fda1b2669
commit
e6e0a47749
@@ -173,6 +173,27 @@ int carla_disconnect_plugin(int id) {
|
||||
return any ? 0 : -1; // return -1 if no connections were found (harmless)
|
||||
}
|
||||
|
||||
#ifdef TESTING
|
||||
int carla_test_connection_count(void) {
|
||||
return conn_count;
|
||||
}
|
||||
|
||||
int carla_test_add_connection(int plugin_id, const char *plugin_port, const char *looper_port) {
|
||||
if (!plugin_port || !looper_port) return -1;
|
||||
if (conn_count >= MAX_CONNECTIONS) return -1;
|
||||
|
||||
strncpy(connections[conn_count].plugin_port, plugin_port,
|
||||
sizeof(connections[conn_count].plugin_port) - 1);
|
||||
connections[conn_count].plugin_port[sizeof(connections[conn_count].plugin_port) - 1] = '\0';
|
||||
strncpy(connections[conn_count].looper_port, looper_port,
|
||||
sizeof(connections[conn_count].looper_port) - 1);
|
||||
connections[conn_count].looper_port[sizeof(connections[conn_count].looper_port) - 1] = '\0';
|
||||
connections[conn_count].plugin_id = plugin_id;
|
||||
conn_count++;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
CarlaHostHandle carla_get_handle(void) {
|
||||
return handle;
|
||||
}
|
||||
|
||||
@@ -19,4 +19,9 @@ void carla_set_bypass(int id, bool bypass);
|
||||
int carla_disconnect_plugin(int id);
|
||||
CarlaHostHandle carla_get_handle(void);
|
||||
|
||||
#ifdef TESTING
|
||||
int carla_test_connection_count(void);
|
||||
int carla_test_add_connection(int plugin_id, const char *plugin_port, const char *looper_port);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -235,6 +235,19 @@ void tui_run(void) {
|
||||
colon_buf[colon_len] = '\0';
|
||||
colon_len = 0;
|
||||
in_colon = false;
|
||||
// Check first token before calling handle_client_command
|
||||
char cmd_copy[256];
|
||||
strncpy(cmd_copy, colon_buf, sizeof(cmd_copy)-1);
|
||||
cmd_copy[sizeof(cmd_copy)-1] = '\0';
|
||||
char *first = strtok(cmd_copy, " ");
|
||||
if (first) {
|
||||
if (strcmp(first, "rack") == 0) {
|
||||
rack_mode = true;
|
||||
rack_selected = 0;
|
||||
} else if (strcmp(first, "grid") == 0) {
|
||||
rack_mode = false;
|
||||
}
|
||||
}
|
||||
int dummy_id;
|
||||
handle_client_command(colon_buf, &dummy_id);
|
||||
draw_grid();
|
||||
|
||||
Reference in New Issue
Block a user