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

Go to the source code of this file.

Functions

 TEST (ImageDataTest, TextureAtlasMaker)

Function Documentation

◆ TEST()

TEST ( ImageDataTest ,
TextureAtlasMaker  )

Definition at line 19 of file texture_atlas_maker_tests.cpp.

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}
Represents raw 2D image data stored in memory.
void WritePngFile(char const *filename)
Writes the image data to a PNG file.
Represents a color with red, green, blue, and alpha channels.