Rendering Engine
0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
text_renderer_tests.cpp
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <cstdint>
3
#include "gtest/gtest.h"
4
5
#include "
../RenderingLibrary/Include/image_data.hpp
"
6
#include "
../RenderingLibrary/Include/text_renderer.hpp
"
7
8
using
::testing::EmptyTestEventListener;
9
using
::testing::InitGoogleTest;
10
using
::testing::Test;
11
using
::testing::TestEventListeners;
12
using
::testing::TestInfo;
13
using
::testing::TestPartResult;
14
using
::testing::TestSuite;
15
using
::testing::UnitTest;
16
17
using namespace
rendering_engine
;
18
19
TEST
(ImageDataTest, CreateGlyphBitmapStatic)
20
{
21
std::string
const
pathToFont{
"../Content/Fonts/Exo/Exo-Medium.otf"
};
22
23
auto
imageData = std::make_shared<ImageData>(
TextRenderer::CreateGlyphBitmap
(pathToFont,
'7'
));
24
imageData->WritePngFile(
"testGlyphStatic.png"
);
25
26
EXPECT_NE( imageData,
nullptr
);
27
}
28
29
TEST
(ImageDataTest, CreateGlyphBitmap)
30
{
31
std::string
const
pathToFont{
"../Content/Fonts/Exo/Exo-Medium.otf"
};
32
33
TextRenderer
textRenderer(pathToFont, 14);
34
35
auto
imageData = std::make_shared<ImageData>( textRenderer.
CreateGlyphBitmap
(
'4'
) );
36
imageData->WritePngFile(
"testGlyphBitmap.png"
);
37
38
EXPECT_NE(imageData,
nullptr
);
39
}
40
41
TEST
(ImageDataTest, CreateTextBitmap1)
42
{
43
std::string
const
pathToFont{
"../Content/Fonts/Pirulen/pirulen_rg.otf"
};
44
45
TextRenderer
textRenderer( pathToFont, 48 );
46
47
std::string testText{
"This is Pirulen font test text 123 string"
};
48
auto
imageData = std::make_shared<ImageData>( textRenderer.
CreateStringBitmap
(testText) );
49
imageData->WritePngFile(
"testPirulenFontTextString.png"
);
50
51
EXPECT_NE(imageData,
nullptr
);
52
}
53
54
TEST
(ImageDataTest, CreateTextBitmap2)
55
{
56
std::string
const
pathToFont{
"../Content/Fonts/DigitalDream/DIGITALDREAM.ttf"
};
57
58
TextRenderer
textRenderer(pathToFont, 48);
59
60
std::string testText{
"This_is_DIGITAL-DREAM_font_test_text_123_string"
};
61
auto
imageData = std::make_shared<ImageData>( textRenderer.
CreateStringBitmap
(testText) );
62
imageData->WritePngFile(
"testDigitalDreamFontTextString.png"
);
63
64
EXPECT_NE(imageData,
nullptr
);
65
}
rendering_engine::TextRenderer
Definition
text_renderer.hpp:24
rendering_engine::TextRenderer::CreateGlyphBitmap
ImageData CreateGlyphBitmap(char const character)
Definition
text_renderer.cpp:61
rendering_engine::TextRenderer::CreateStringBitmap
ImageData CreateStringBitmap(std::string text)
Definition
text_renderer.cpp:91
image_data.hpp
rendering_engine
Definition
actor.hpp:11
text_renderer.hpp
TEST
TEST(ImageDataTest, CreateGlyphBitmapStatic)
Definition
text_renderer_tests.cpp:19
RenderingEngine
Tests
text_renderer_tests.cpp
Generated by
1.14.0