Improve Catalog
ci / checks (push) Successful in 46m42s

This commit is contained in:
khodowany
2026-09-27 11:03:43 -05:00
parent a416a80dd9
commit 142d843fac
418 changed files with 440 additions and 324488 deletions
+5 -21
View File
@@ -22,7 +22,7 @@
namespace {
auto performance(std::string id) -> vamp_zero::score_reference {
return {.category = vamp_zero::score_category::PERFORMANCE, .id = std::move(id)};
return {.id = std::move(id)};
}
auto drain(boost::asio::io_context &io) -> void {
@@ -147,7 +147,7 @@ BOOST_AUTO_TEST_CASE(score_loader_stale_error_does_not_replace_pending_selection
BOOST_CHECK_EQUAL(fixture.loader.snapshot().document->id, "available");
}
BOOST_AUTO_TEST_CASE(score_loader_catalog_identity_and_category_invalidate_selection) {
BOOST_AUTO_TEST_CASE(score_loader_catalog_identity_invalidates_same_score_selection) {
auto fixture = loader_fixture{};
fixture.loader.select(fixture.catalog, performance("same-id"));
drain(fixture.io);
@@ -160,13 +160,6 @@ BOOST_AUTO_TEST_CASE(score_loader_catalog_identity_and_category_invalidate_selec
fixture.scores->complete(1);
drain(fixture.io);
BOOST_REQUIRE(fixture.loader.snapshot().document);
fixture.loader.select(fixture.catalog, vamp_zero::score_reference{.category = vamp_zero::score_category::PRACTICE, .id = "same-id"});
BOOST_CHECK(!fixture.loader.snapshot().document);
drain(fixture.io);
BOOST_REQUIRE_EQUAL(fixture.scores->requests.size(), 3U);
BOOST_CHECK(fixture.scores->requests.back().category == vamp_zero::score_category::PRACTICE);
fixture.scores->complete(2);
drain(fixture.io);
}
BOOST_AUTO_TEST_CASE(score_loader_reuses_active_score_and_releases_on_menu_exit) {
@@ -316,10 +309,9 @@ BOOST_AUTO_TEST_CASE(score_loader_completion_can_overlap_stop_and_consumer_destr
BOOST_CHECK(entered_status == std::future_status::ready);
}
BOOST_AUTO_TEST_CASE(selected_score_reference_uses_active_part_and_practice_part) {
BOOST_AUTO_TEST_CASE(selected_score_reference_uses_active_part) {
auto catalog = std::make_shared<vamp_zero::catalog>();
catalog->performance.parts = {{.id = "part-a"}, {.id = "part-b"}};
catalog->practice.exercises = {{.id = "scale", .parts = {{.id = "scale-c"}, {.id = "scale-d"}}}};
catalog->parts = {{.id = "part-a"}, {.id = "part-b"}};
auto state = vamp_zero::app_state{.catalog = catalog};
BOOST_CHECK(!vamp_zero::selected_score_reference(state));
state.mode = vamp_zero::app_mode::PERFORMANCE_SCORE;
@@ -327,15 +319,7 @@ BOOST_AUTO_TEST_CASE(selected_score_reference_uses_active_part_and_practice_part
auto reference = vamp_zero::selected_score_reference(state);
BOOST_REQUIRE(reference);
BOOST_CHECK_EQUAL(reference->id, "part-b");
BOOST_CHECK(reference->category == vamp_zero::score_category::PERFORMANCE);
state.mode = vamp_zero::app_mode::PRACTICE_SCORE;
state.active_practice_id = "scale";
state.selected_practice_part_index = 2;
reference = vamp_zero::selected_score_reference(state);
BOOST_REQUIRE(reference);
BOOST_CHECK_EQUAL(reference->id, "scale-d");
BOOST_CHECK(reference->category == vamp_zero::score_category::PRACTICE);
state.selected_practice_part_index = 0;
state.active_part_id = "missing";
BOOST_CHECK(!vamp_zero::selected_score_reference(state));
state.catalog.reset();
BOOST_CHECK(!vamp_zero::selected_score_reference(state));