fix: Dump dvar of IW4 menu items without edit field data (#1063)

* fix: Dump dvar of IW4 menu items without edit field data

* fix: ensure dvar property sets edit field features

* chore: add comment explaining why additional dump location for dvar is there

* fix: test data that has invalid type and dvar combinations

---------

Co-authored-by: Jan Laupetin <[email protected]>
This commit is contained in:
wroyandJan Laupetin authored and GitHub committed 2026-11-16 23:32:09 +01:00
1 parent 28605c74ae
commit 7b24b776fa
8 files changed
+58 -5

No files matched your search

@@ -93,7 +93,7 @@ TEST_CASE("MenuListLoaderIW3: Loads dumped menus and preserves IW3 data", "[iw3]
name "empty_text"
text ""
rect 10 20 180 24 1 2
type 1
type 0
visible 1
forecolor 0.9 0.9 1 0.07
dvar "ui_fallback_text"
@@ -99,7 +99,7 @@ TEST_CASE("MenuListLoaderT4: Loads dumped menus and preserves T4 data", "[t4][me
name "empty_text"
text ""
rect 10 20 180 24 1 2
type 1
type 0
visible 1
forecolor 0.9 0.9 1 0.07
dvar "ui_fallback_text"
@@ -434,4 +434,27 @@ namespace test::parsing::menu::sequence::item
REQUIRE(multiValueFeatures->m_step_names == std::vector<std::string>{"@MPUI_RULES_5MINUTES", ""});
REQUIRE(multiValueFeatures->m_string_values == std::vector<std::string>{"5", "0"});
}
TEST_CASE("ItemScopeSequences: Ensure dvar sets edit field properties", "[parsing][sequence][menu]")
{
ItemSequenceTestsHelper helper(FeatureLevel::IW4, false);
const TokenPos pos;
helper.Tokens({
SimpleParserValue::Identifier(pos, new std::string("dvar")),
SimpleParserValue::String(pos, new std::string("foobar")),
SimpleParserValue::EndOfFile(pos),
});
const auto result = helper.PerformTest();
REQUIRE(result);
REQUIRE(helper.m_consumed_token_count == 2);
const auto* item = helper.m_state->m_current_item;
REQUIRE(item);
REQUIRE(item->m_dvar == "foobar");
REQUIRE(item->m_feature_type == CommonItemFeatureType::EDIT_FIELD);
REQUIRE(item->m_edit_field_features);
}
} // namespace test::parsing::menu::sequence::item