Add unit test for ModelTool::DetectLodIndex and improve LOD index detection further

#765
This commit is contained in:
Wojtek Figat
2022-10-29 11:38:20 +02:00
parent bd562a374a
commit 5cfe3b88c7
3 changed files with 37 additions and 8 deletions

View File

@@ -0,0 +1,24 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
#include "Engine/Tools/ModelTool/ModelTool.h"
#include <ThirdParty/catch2/catch.hpp>
TEST_CASE("ModelTool")
{
SECTION("Test DetectLodIndex")
{
CHECK(ModelTool::DetectLodIndex(TEXT("mesh")) == 0);
CHECK(ModelTool::DetectLodIndex(TEXT("mesh LOD")) == 0);
CHECK(ModelTool::DetectLodIndex(TEXT("mesh LOD0")) == 0);
CHECK(ModelTool::DetectLodIndex(TEXT("mesh LOD1")) == 1);
CHECK(ModelTool::DetectLodIndex(TEXT("mesh_LOD1")) == 1);
CHECK(ModelTool::DetectLodIndex(TEXT("mesh_lod1")) == 1);
CHECK(ModelTool::DetectLodIndex(TEXT("mesh_lod2")) == 2);
CHECK(ModelTool::DetectLodIndex(TEXT("lod0")) == 0);
CHECK(ModelTool::DetectLodIndex(TEXT("lod1")) == 1);
CHECK(ModelTool::DetectLodIndex(TEXT("lod_2")) == 2);
CHECK(ModelTool::DetectLodIndex(TEXT("mesh_lod_0")) == 0);
CHECK(ModelTool::DetectLodIndex(TEXT("mesh_lod_1")) == 1);
CHECK(ModelTool::DetectLodIndex(TEXT("mesh lod_2")) == 2);
}
}

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Flax.Build;
using Flax.Build.NativeCpp;
/// <summary>
/// Engine tests module.
@@ -14,6 +15,14 @@ public class Tests : EngineModule
Deploy = false;
}
/// <inheritdoc />
public override void Setup(BuildOptions options)
{
base.Setup(options);
options.PrivateDependencies.Add("ModelTool");
}
/// <inheritdoc />
public override void GetFilesToDeploy(List<string> files)
{