Cleanup
publish / publish (push) Successful in 14m40s

This commit is contained in:
khodowany
2026-09-24 19:43:50 -05:00
parent fe159948bd
commit 522254dfc1
8 changed files with 136 additions and 163 deletions
+59 -2
View File
@@ -564,7 +564,7 @@ auto closing_dialog_control::close_if(close_phase phase) const -> void {
return;
}
state_->in_handle = true;
auto status = host_.close_dialog(luma::dialog_result::CANCELLED);
auto status = host_.close_dialog(luma::dialog_result::CANCELED);
state_->status_ok = status.has_value();
state_->in_handle = false;
}
@@ -1085,6 +1085,63 @@ BOOST_AUTO_TEST_CASE(asset_cache_rejects_recursive_same_path_load) {
BOOST_TEST(resources.recursive_code == 3);
}
BOOST_AUTO_TEST_CASE(asset_cache_clear_does_not_retain_an_in_flight_texture) {
auto resources = blocking_resources{};
auto assets = luma::asset_cache{resources};
auto first = std::expected<std::shared_ptr<luma::texture>, modulus::error>{};
auto thread = std::thread{[&] { first = assets.texture("page.png"); }};
auto entered = resources.wait_for_loads(1);
assets.clear();
resources.release();
thread.join();
BOOST_REQUIRE(entered);
BOOST_REQUIRE(first);
auto second = assets.texture("page.png");
BOOST_REQUIRE(second);
BOOST_TEST(resources.load_count() == 2);
BOOST_TEST(*first != *second);
BOOST_REQUIRE(assets.texture("page.png"));
BOOST_TEST(resources.load_count() == 2);
}
BOOST_AUTO_TEST_CASE(asset_cache_failed_loads_complete_and_can_be_retried) {
struct resources final : luma::renderer_resources {
std::uint32_t calls{};
auto load_texture(std::string const &path) -> std::expected<std::shared_ptr<luma::texture>, modulus::error> override {
if (++calls == 1U) {
if (path == "null") {
return std::shared_ptr<luma::texture>{};
}
if (path == "throw") {
throw std::runtime_error{"loader failed"};
}
return std::unexpected(modulus::make_error("loader", 5, "failed"));
}
return std::make_shared<fake_texture>();
}
};
for (auto const *path : {"null", "throw", "error"}) {
auto loader = resources{};
auto assets = luma::asset_cache{loader};
BOOST_CHECK(!assets.texture(path));
BOOST_REQUIRE(assets.texture(path));
BOOST_REQUIRE(assets.texture(path));
BOOST_TEST(loader.calls == 2U);
}
}
BOOST_AUTO_TEST_CASE(theme_numbers_reject_nonfinite_and_unrepresentable_values) {
for (auto number : {-1.0, std::numeric_limits<double>::infinity(), std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::max()}) {
auto parsed = luma::parse_theme(boost::json::object{{"spacing", number}});
BOOST_REQUIRE(!parsed);
BOOST_TEST(std::string{parsed.error().category()} == "luma");
}
auto parsed = luma::parse_theme(boost::json::object{{"spacing", std::uint64_t{8}}});
BOOST_REQUIRE(parsed);
BOOST_TEST(parsed->spacing == 8.0F);
}
BOOST_AUTO_TEST_CASE(text_input_state_filters_modes_and_keyboard_updates_bound_field) {
auto changes = std::vector<std::string>{};
auto input = luma::make_text_input({
@@ -1270,7 +1327,7 @@ BOOST_AUTO_TEST_CASE(dialog_accept_and_cancel_close_with_callbacks) {
},
},
});
BOOST_TEST(static_cast<std::int32_t>(result) == static_cast<std::int32_t>(luma::dialog_result::CANCELLED));
BOOST_TEST(static_cast<std::int32_t>(result) == static_cast<std::int32_t>(luma::dialog_result::CANCELED));
}
BOOST_AUTO_TEST_CASE(dialog_uses_matching_touch_when_not_first_point) {