Rendering Engine
0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
texture_atlas_maker_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/texture_atlas_maker.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,
TextureAtlasMaker
)
20
{
21
ImageData
image1(10U, 10U);
22
image1.
Fill
(
Color
(255, 0, 0, 255));
23
24
ImageData
image2(5U, 5U);
25
image2.
Fill
(
Color
(0, 255, 0, 255));
26
27
ImageData
image3(2U, 2U);
28
image3.
Fill
(
Color
(0, 0, 255, 255));
29
30
std::map<char, ImageData> imageCollection;
31
32
imageCollection.emplace(
'A'
, image1);
33
imageCollection.emplace(
'B'
, image2);
34
imageCollection.emplace(
'C'
, image3);
35
36
TextureAtlasMaker
texAtlasMaker( imageCollection );
37
38
ImageData
atlasImage;
39
std::map<char, std::pair<unsigned int, unsigned int>> texAtlasData;
40
41
bool
const
result = texAtlasMaker.
CreateTextureAtlas
(texAtlasData, atlasImage);
42
if
( result )
43
{
44
atlasImage.
WritePngFile
(
"TestTextureAtlas.png"
);
45
}
46
47
EXPECT_TRUE(result);
48
}
rendering_engine::ImageData
Represents raw 2D image data stored in memory.
Definition
image_data.hpp:73
rendering_engine::ImageData::Fill
void Fill(Color color)
Fills the image with a solid color.
Definition
image_data.cpp:149
rendering_engine::ImageData::WritePngFile
void WritePngFile(char const *filename)
Writes the image data to a PNG file.
Definition
image_data.cpp:287
rendering_engine::TextureAtlasMaker
Definition
texture_atlas_maker.hpp:19
rendering_engine::TextureAtlasMaker::CreateTextureAtlas
bool CreateTextureAtlas(std::map< char, std::pair< unsigned int, unsigned int > > &texAtlasData, ImageData &texAtlasImage)
Definition
texture_atlas_maker.cpp:15
image_data.hpp
rendering_engine
Definition
actor.hpp:11
rendering_engine::Color
Represents a color with red, green, blue, and alpha channels.
Definition
image_data.hpp:21
texture_atlas_maker.hpp
TEST
TEST(ImageDataTest, TextureAtlasMaker)
Definition
texture_atlas_maker_tests.cpp:19
RenderingEngine
Tests
texture_atlas_maker_tests.cpp
Generated by
1.14.0