Delete invasive font atlas tests
This commit is contained in:
1 parent
22a90fe07c
commit
1bc73b6d2f
9 files changed
+37
-263
No files matched your search
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include "Asset.h"
|
||||
#include "FontAssetTestHooks.h"
|
||||
#include "Containers/Map.h"
|
||||
#include "Graphics/Texture.h"
|
||||
#include "Math/Math.h"
|
||||
@@ -38,33 +37,6 @@ class FontAsset : public Asset {
|
||||
// packs every glyph of `fontSize` into one atlas (created lazily on first use by
|
||||
// shapeText); public so the unit test can drive the real packer
|
||||
void loadGlyphs(uint32 fontSize);
|
||||
// test seam, mirrors exactly what FontLoader::import does (the only other path that
|
||||
// sets ttfFile/graphics): a unit test uses it to drive loadGlyphs() and read the
|
||||
// produced atlas back for validation against FreeType ground truth
|
||||
void importForTest(const char* ttfBytes, uint64 size, Gfx::PGraphics graphics) {
|
||||
this->ttfFile = Array<char>(size);
|
||||
std::memcpy(this->ttfFile.data(), ttfBytes, size);
|
||||
this->graphics = graphics;
|
||||
loadFace();
|
||||
}
|
||||
// unit test: reads the packed atlas + UV rects back for validation (friend)
|
||||
FontAssetGlyphRects exportForTest(uint32 fontSize) const {
|
||||
const FontData& data = fontSizes.at(fontSize);
|
||||
FontAssetGlyphRects out;
|
||||
out.atlasWidth = data.atlas->getWidth();
|
||||
out.atlasHeight = data.atlas->getHeight();
|
||||
out.atlas = data.atlas;
|
||||
for (auto& [id, glyph] : data.glyphs) {
|
||||
FontAssetGlyphRects::Rect r;
|
||||
r.uvOffset = glyph.uvOffset;
|
||||
r.uvSize = glyph.uvSize;
|
||||
r.width = glyph.size.x;
|
||||
r.height = glyph.size.y;
|
||||
out.glyphs[id] = r;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
struct RenderGlyph {
|
||||
Gfx::PTexture2D texture; // the font's atlas for this size (shared by all its glyphs)
|
||||
Vector2 uvOffset;
|
||||
@@ -84,8 +56,6 @@ class FontAsset : public Asset {
|
||||
Array<char> ttfFile;
|
||||
Map<uint32, FontData> fontSizes;
|
||||
friend class FontLoader;
|
||||
// unit test: drives the packer and reads the resulting atlas back for validation
|
||||
friend class FontAssetAtlasProbe;
|
||||
};
|
||||
DECLARE_REF(FontAsset)
|
||||
} // namespace Seele
|
||||
Reference in new issue
Block a user