chore: snapshot editor work and restore tests

Key points:\n- restore the tests tree removed by bc47e6e\n- capture current editor workspace, scene, and docs reshuffle changes\n- keep local cloud.nvdb resources ignored from this commit
This commit is contained in:
2026-04-25 22:11:47 +08:00
parent 9ab1beb2c4
commit 12b71a319f
911 changed files with 3518184 additions and 1823 deletions

View File

@@ -0,0 +1,40 @@
#include <gtest/gtest.h>
#include "UI/BuiltInIconLayoutUtils.h"
namespace {
using XCEngine::Editor::UI::ComputeFittedIconSize;
TEST(BuiltInIconLayoutUtilsTest, ReturnsZeroWhenTextureOrBoundsAreInvalid) {
EXPECT_EQ(
ComputeFittedIconSize(0, 64, ImVec2(0.0f, 0.0f), ImVec2(64.0f, 64.0f)).x,
0.0f);
EXPECT_EQ(
ComputeFittedIconSize(64, 64, ImVec2(10.0f, 0.0f), ImVec2(10.0f, 64.0f)).y,
0.0f);
}
TEST(BuiltInIconLayoutUtilsTest, FitsWidthLimitedRegions) {
const ImVec2 size = ComputeFittedIconSize(
256,
128,
ImVec2(0.0f, 0.0f),
ImVec2(64.0f, 64.0f));
EXPECT_FLOAT_EQ(size.x, 64.0f);
EXPECT_FLOAT_EQ(size.y, 32.0f);
}
TEST(BuiltInIconLayoutUtilsTest, FitsHeightLimitedRegions) {
const ImVec2 size = ComputeFittedIconSize(
128,
256,
ImVec2(0.0f, 0.0f),
ImVec2(80.0f, 40.0f));
EXPECT_FLOAT_EQ(size.x, 20.0f);
EXPECT_FLOAT_EQ(size.y, 40.0f);
}
} // namespace