Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
text_renderer_tests.cpp File Reference
#include <stdio.h>
#include <cstdint>
#include "gtest/gtest.h"
#include "../RenderingLibrary/Include/image_data.hpp"
#include "../RenderingLibrary/Include/text_renderer.hpp"

Go to the source code of this file.

Functions

 TEST (ImageDataTest, CreateGlyphBitmapStatic)
 TEST (ImageDataTest, CreateGlyphBitmap)
 TEST (ImageDataTest, CreateTextBitmap1)
 TEST (ImageDataTest, CreateTextBitmap2)

Function Documentation

◆ TEST() [1/4]

TEST ( ImageDataTest ,
CreateGlyphBitmap  )

Definition at line 29 of file text_renderer_tests.cpp.

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}

◆ TEST() [2/4]

TEST ( ImageDataTest ,
CreateGlyphBitmapStatic  )

Definition at line 19 of file text_renderer_tests.cpp.

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}
ImageData CreateGlyphBitmap(char const character)

◆ TEST() [3/4]

TEST ( ImageDataTest ,
CreateTextBitmap1  )

Definition at line 41 of file text_renderer_tests.cpp.

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}

◆ TEST() [4/4]

TEST ( ImageDataTest ,
CreateTextBitmap2  )

Definition at line 54 of file text_renderer_tests.cpp.

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}