From a0200a9dbbcaf2056611060a3e6575babeb4b4d8 Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 11 Dec 2021 22:55:40 +0100 Subject: [PATCH] Test certain properties with menu parsing integration test --- .../Game/IW4/Menu/MenuParsingIW4IT.cpp | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/test/ObjLoadingTests/Game/IW4/Menu/MenuParsingIW4IT.cpp b/test/ObjLoadingTests/Game/IW4/Menu/MenuParsingIW4IT.cpp index 56de1ed0..657ef1d4 100644 --- a/test/ObjLoadingTests/Game/IW4/Menu/MenuParsingIW4IT.cpp +++ b/test/ObjLoadingTests/Game/IW4/Menu/MenuParsingIW4IT.cpp @@ -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); + } }