Test certain properties with menu parsing integration test

This commit is contained in:
Jan 2021-12-11 22:55:40 +01:00
parent 9435c836d3
commit a0200a9dbb

View File

@ -95,4 +95,50 @@ namespace test::game::iw4::menu::parsing
REQUIRE(menu->itemCount == 0);
REQUIRE(menu->items == nullptr);
}
TEST_CASE("MenuParsingIW4IT: Can convert simple menu", "[parsing][converting][menu][it]")
{
MenuParsingItHelper helper;
helper.AddFile(""
L("#define COOL_STYLE 5")
L("")
L("{")
L(" menuDef")
L(" {")
L(" name \"Bla\"")
L(" fullScreen 1")
L(" screenSpace")
L(" decoration")
L(" rect (351 + 69) (1336 + 1) 12 64 1 2")
L(" style COOL_STYLE")
L(" }")
L("}")
);
const auto result = helper.RunIntegrationTest();
REQUIRE(result);
const auto* menuList = helper.GetMenuListAsset();
const auto* menu = helper.GetMenuAsset("Bla");
REQUIRE(menuList->menuCount == 1);
REQUIRE(menuList->menus);
REQUIRE(menuList->menus[0] == menu);
REQUIRE(menu->window.name == "Bla"s);
REQUIRE(menu->fullScreen > 0);
REQUIRE(menu->window.staticFlags & WINDOW_FLAG_SCREEN_SPACE);
REQUIRE(menu->window.staticFlags & WINDOW_FLAG_DECORATION);
REQUIRE(menu->window.rect.x == Approx(420));
REQUIRE(menu->window.rect.y == Approx(1337));
REQUIRE(menu->window.rect.w == Approx(12));
REQUIRE(menu->window.rect.h == Approx(64));
REQUIRE(menu->window.rect.horzAlign == 1);
REQUIRE(menu->window.rect.vertAlign == 2);
REQUIRE(menu->window.style == 5);
REQUIRE(menu->itemCount == 0);
REQUIRE(menu->items == nullptr);
}
}