test: qualify internal devices across DSP, persistence and GUI workflows

This commit is contained in:
Johannes Findeisen 2026-11-05 23:44:48 +01:00
commit e76552e8dd
7 changed files with 389 additions and 8 deletions

View file

@ -712,6 +712,41 @@ int main(int argc, char **argv)
CHECK(!canvas->select_at(-20,-20) && canvas->selected_node() == SIZE_MAX);
window.do_callback();
}
// Internal devices must work without plugin fixture environment variables.
for (unsigned int instrument=0;instrument<2;++instrument) {
reset(); MainWindow window(false,""); window.show();
CHECK(window.create_track(true)==XTC_OK);
auto *sequence=timeline(&window); auto *canvas=graph_canvas(&window);
uint64_t track=sequence->selected_track();
auto *selector=sequence->instrument_choice(track); CHECK(selector);
selector->value(static_cast<int>(instrument+1));selector->do_callback();
xtc_plugin_spec spec{};
CHECK(xtc_project_get_instrument(sequence->project(),track,&spec)==XTC_OK && spec.index==instrument);
CHECK(window.undo()==XTC_OK && window.undo(true)==XTC_OK);
xtc_connection_info wire{};
CHECK(xtc_graph_get_connection(xtc_project_graph(sequence->project()),0,&wire)==XTC_OK);
unsigned int effect=instrument+2;size_t id=SIZE_MAX;
CHECK(window.insert_plugin(wire,XTC_BUILTIN_PATH,effect,&id)==XTC_OK);
CHECK(canvas->select_node(id));
CHECK(window.set_plugin_control(id,2,.75f)==XTC_OK);
CHECK(window.set_plugin_automation(id,{960,2,0,.4f},false)==XTC_OK);
CHECK(window.undo()==XTC_OK && window.undo(true)==XTC_OK);
CHECK(xtc_graph_get_plugin(xtc_project_graph(sequence->project()),id,&spec)==XTC_OK);
CHECK(spec.index==effect && spec.values[2]==.75f && spec.point_count==1);
xtc_plugin_details details{};xtc_plugin_spec edited{};
CHECK(xtc_plugin_describe(&spec,48000,&details)==XTC_OK);
Fl::add_timeout(.05,[](void *) {press(find(Fl::first_window(),"Apply"));});
CHECK(xtc_edit_plugin(spec,details,edited) && edited.index==effect);
CHECK(window.save_project("/tmp/xtc-internal-gui.xtc")==XTC_OK);
CHECK(window.new_project()==XTC_OK && window.open_project("/tmp/xtc-internal-gui.xtc")==XTC_OK);
CHECK(xtc_project_get_instrument(sequence->project(),track,&spec)==XTC_OK && spec.index==instrument);
CHECK(xtc_graph_get_plugin(xtc_project_graph(sequence->project()),id,&spec)==XTC_OK && spec.index==effect && spec.point_count==1);
size_t added=SIZE_MAX;CHECK(window.add_plugin(XTC_BUILTIN_PATH,effect,&added)==XTC_OK);
CHECK(added!=id);CHECK(window.undo()==XTC_OK);
const xtc_project *before=sequence->project();reserve_result=XTC_ERR_OUT_OF_MEMORY;
CHECK(window.add_plugin(XTC_BUILTIN_PATH,effect)==XTC_ERR_OUT_OF_MEMORY && sequence->project()==before);
reserve_result=XTC_OK;unlink("/tmp/xtc-internal-gui.xtc");window.do_callback();
}
if (const char *module = std::getenv("XTC_TEST_PLUGIN")) {
reset();
MainWindow window(false,"");