mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-05 11:56:00 -04:00
Merge branch 'master' of github.com:libSDL2pp/libSDL2pp
This commit is contained in:
commit
a9a71b50b7
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libSDL2pp - C++11 bindings/wrapper for SDL2
|
libSDL2pp - C++11 bindings/wrapper for SDL2
|
||||||
Copyright (C) 2013-2015 Dmitry Marakasov <amdmi3@amdmi3.ru>
|
Copyright (C) 2013-2016 Dmitry Marakasov <amdmi3@amdmi3.ru>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@ -367,7 +367,7 @@ public:
|
|||||||
/// \see http://wiki.libsdl.org/SDL_SetTextureBlendMode
|
/// \see http://wiki.libsdl.org/SDL_SetTextureBlendMode
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Texture& SetBlendMode(SDL_BlendMode blendMode);
|
Texture& SetBlendMode(SDL_BlendMode blendMode = SDL_BLENDMODE_NONE);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set an additional alpha value multiplied into render copy operations
|
/// \brief Set an additional alpha value multiplied into render copy operations
|
||||||
|
@ -1,43 +1,36 @@
|
|||||||
ADD_DEFINITIONS(-DTESTDATA_DIR="${PROJECT_SOURCE_DIR}/testdata")
|
ADD_DEFINITIONS(-DTESTDATA_DIR="${PROJECT_SOURCE_DIR}/testdata")
|
||||||
|
|
||||||
ADD_EXECUTABLE(sprites sprites.cc)
|
SET(EXAMPLES
|
||||||
TARGET_LINK_LIBRARIES(sprites ${SDL2PP_LIBRARIES})
|
audio_sine
|
||||||
|
audio_wav
|
||||||
ADD_EXECUTABLE(lines lines.cc)
|
lines
|
||||||
TARGET_LINK_LIBRARIES(lines ${SDL2PP_LIBRARIES})
|
rendertarget
|
||||||
|
sprites
|
||||||
ADD_EXECUTABLE(rendertarget rendertarget.cc)
|
)
|
||||||
TARGET_LINK_LIBRARIES(rendertarget ${SDL2PP_LIBRARIES})
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(audio_sine audio_sine.cc)
|
|
||||||
TARGET_LINK_LIBRARIES(audio_sine ${SDL2PP_LIBRARIES})
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(audio_wav audio_wav.cc)
|
|
||||||
TARGET_LINK_LIBRARIES(audio_wav ${SDL2PP_LIBRARIES})
|
|
||||||
|
|
||||||
IF(SDL2PP_WITH_IMAGE)
|
IF(SDL2PP_WITH_IMAGE)
|
||||||
ADD_EXECUTABLE(image image.cc)
|
SET(EXAMPLES ${EXAMPLES}
|
||||||
TARGET_LINK_LIBRARIES(image ${SDL2PP_LIBRARIES})
|
image
|
||||||
|
fill
|
||||||
ADD_EXECUTABLE(fill fill.cc)
|
)
|
||||||
TARGET_LINK_LIBRARIES(fill ${SDL2PP_LIBRARIES})
|
|
||||||
ENDIF(SDL2PP_WITH_IMAGE)
|
ENDIF(SDL2PP_WITH_IMAGE)
|
||||||
|
|
||||||
|
IF(SDL2PP_WITH_MIXER)
|
||||||
|
SET(EXAMPLES ${EXAMPLES}
|
||||||
|
mixer
|
||||||
|
mixer_music
|
||||||
|
mixer_music_sine
|
||||||
|
mixer_effects
|
||||||
|
)
|
||||||
|
ENDIF(SDL2PP_WITH_MIXER)
|
||||||
|
|
||||||
IF(SDL2PP_WITH_TTF)
|
IF(SDL2PP_WITH_TTF)
|
||||||
ADD_EXECUTABLE(ttf ttf.cc)
|
SET(EXAMPLES ${EXAMPLES}
|
||||||
TARGET_LINK_LIBRARIES(ttf ${SDL2PP_LIBRARIES})
|
ttf
|
||||||
|
)
|
||||||
ENDIF(SDL2PP_WITH_TTF)
|
ENDIF(SDL2PP_WITH_TTF)
|
||||||
|
|
||||||
IF(SDL2PP_WITH_MIXER)
|
FOREACH(EXAMPLE ${EXAMPLES})
|
||||||
ADD_EXECUTABLE(mixer mixer.cc)
|
ADD_EXECUTABLE(${EXAMPLE} ${EXAMPLE}.cc)
|
||||||
TARGET_LINK_LIBRARIES(mixer ${SDL2PP_LIBRARIES})
|
TARGET_LINK_LIBRARIES(${EXAMPLE} ${SDL2PP_LIBRARIES})
|
||||||
|
ENDFOREACH(EXAMPLE)
|
||||||
ADD_EXECUTABLE(mixer_music mixer_music.cc)
|
|
||||||
TARGET_LINK_LIBRARIES(mixer_music ${SDL2PP_LIBRARIES})
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(mixer_music_sine mixer_music_sine.cc)
|
|
||||||
TARGET_LINK_LIBRARIES(mixer_music_sine ${SDL2PP_LIBRARIES})
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(mixer_effects mixer_effects.cc)
|
|
||||||
TARGET_LINK_LIBRARIES(mixer_effects ${SDL2PP_LIBRARIES})
|
|
||||||
ENDIF(SDL2PP_WITH_MIXER)
|
|
||||||
|
@ -15,9 +15,23 @@ SET(LIVE_TESTS
|
|||||||
)
|
)
|
||||||
|
|
||||||
IF(SDL2PP_WITH_MIXER)
|
IF(SDL2PP_WITH_MIXER)
|
||||||
SET(LIVE_TESTS ${LIVE_TESTS} live_mixer)
|
SET(LIVE_TESTS ${LIVE_TESTS}
|
||||||
|
live_mixer
|
||||||
|
)
|
||||||
ENDIF(SDL2PP_WITH_MIXER)
|
ENDIF(SDL2PP_WITH_MIXER)
|
||||||
|
|
||||||
|
IF(SDL2PP_WITH_IMAGE)
|
||||||
|
SET(CLI_TESTS ${CLI_TESTS}
|
||||||
|
test_surface
|
||||||
|
)
|
||||||
|
ENDIF(SDL2PP_WITH_IMAGE)
|
||||||
|
|
||||||
|
IF(SDL2PP_WITH_TTF)
|
||||||
|
SET(CLI_TESTS ${CLI_TESTS}
|
||||||
|
test_font
|
||||||
|
)
|
||||||
|
ENDIF(SDL2PP_WITH_TTF)
|
||||||
|
|
||||||
# disable self-move warning: it's deliberately used in tests
|
# disable self-move warning: it's deliberately used in tests
|
||||||
INCLUDE(AppendCXXFlagIfSupported)
|
INCLUDE(AppendCXXFlagIfSupported)
|
||||||
APPEND_CXX_FLAG_IF_SUPPORTED(-Wno-self-move CMAKE_CXX_FLAGS)
|
APPEND_CXX_FLAG_IF_SUPPORTED(-Wno-self-move CMAKE_CXX_FLAGS)
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#include <SDL2pp/ContainerRWops.hh>
|
|
||||||
|
|
||||||
int main(int, char*[]) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
#include <SDL2pp/StreamRWops.hh>
|
|
||||||
|
|
||||||
int main(int, char*[]) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -57,7 +57,7 @@ BEGIN_TEST(int, char*[])
|
|||||||
PixelInspector pixels(320, 240, 4);
|
PixelInspector pixels(320, 240, 4);
|
||||||
|
|
||||||
{
|
{
|
||||||
// clear
|
// Clear
|
||||||
renderer.SetDrawColor(1, 2, 3);
|
renderer.SetDrawColor(1, 2, 3);
|
||||||
renderer.Clear();
|
renderer.Clear();
|
||||||
pixels.Retrieve(renderer);
|
pixels.Retrieve(renderer);
|
||||||
@ -69,7 +69,7 @@ BEGIN_TEST(int, char*[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// draw points
|
// Draw points
|
||||||
renderer.SetDrawColor(0,0,0);
|
renderer.SetDrawColor(0,0,0);
|
||||||
renderer.Clear();
|
renderer.Clear();
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ BEGIN_TEST(int, char*[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// draw lines
|
// Draw lines
|
||||||
renderer.SetDrawColor(0, 0, 0);
|
renderer.SetDrawColor(0, 0, 0);
|
||||||
renderer.Clear();
|
renderer.Clear();
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ BEGIN_TEST(int, char*[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// draw rects
|
// Draw rects
|
||||||
renderer.SetDrawColor(0, 0, 0);
|
renderer.SetDrawColor(0, 0, 0);
|
||||||
renderer.Clear();
|
renderer.Clear();
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ BEGIN_TEST(int, char*[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// fill rects
|
// Fill rects
|
||||||
renderer.SetDrawColor(0, 0, 0);
|
renderer.SetDrawColor(0, 0, 0);
|
||||||
renderer.Clear();
|
renderer.Clear();
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ BEGIN_TEST(int, char*[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// blend
|
// Blend
|
||||||
renderer.SetDrawColor(0, 0, 0);
|
renderer.SetDrawColor(0, 0, 0);
|
||||||
renderer.Clear();
|
renderer.Clear();
|
||||||
|
|
||||||
@ -224,4 +224,92 @@ BEGIN_TEST(int, char*[])
|
|||||||
renderer.Present();
|
renderer.Present();
|
||||||
SDL_Delay(1000);
|
SDL_Delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SDL2PP_WITH_IMAGE
|
||||||
|
{
|
||||||
|
// Texture
|
||||||
|
renderer.SetDrawColor(0, 0, 0);
|
||||||
|
renderer.Clear();
|
||||||
|
|
||||||
|
Texture texture(renderer, TESTDATA_DIR "/crate.png");
|
||||||
|
|
||||||
|
EXPECT_EQUAL(texture.GetWidth(), 32);
|
||||||
|
EXPECT_EQUAL(texture.GetHeight(), 32);
|
||||||
|
EXPECT_EQUAL(texture.GetSize(), Point(32, 32));
|
||||||
|
|
||||||
|
renderer.Copy(texture, NullOpt, Point(0, 0));
|
||||||
|
|
||||||
|
pixels.Retrieve(renderer);
|
||||||
|
|
||||||
|
EXPECT_TRUE(pixels.Test3x3(1, 1, 0x032, 238, 199, 0));
|
||||||
|
|
||||||
|
renderer.Present();
|
||||||
|
SDL_Delay(1000);
|
||||||
|
|
||||||
|
// Texture: fill copy
|
||||||
|
renderer.SetDrawColor(0, 0, 0);
|
||||||
|
renderer.Clear();
|
||||||
|
|
||||||
|
renderer.FillCopy(texture, NullOpt, Rect(0, 0, 48, 48), Point(16, 16), 0);
|
||||||
|
|
||||||
|
pixels.Retrieve(renderer);
|
||||||
|
|
||||||
|
EXPECT_TRUE(pixels.Test3x3(1+16, 1+16, 0x032, 238, 199, 0));
|
||||||
|
|
||||||
|
renderer.Present();
|
||||||
|
SDL_Delay(1000);
|
||||||
|
|
||||||
|
// Texture: alpha blending/modulation
|
||||||
|
renderer.SetDrawColor(0, 0, 0);
|
||||||
|
renderer.Clear();
|
||||||
|
|
||||||
|
EXPECT_EQUAL(texture.GetBlendMode(), SDL_BLENDMODE_NONE);
|
||||||
|
texture.SetBlendMode(SDL_BLENDMODE_BLEND);
|
||||||
|
EXPECT_EQUAL(texture.GetBlendMode(), SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
|
EXPECT_EQUAL((int)texture.GetAlphaMod(), 255);
|
||||||
|
texture.SetAlphaMod(127);
|
||||||
|
EXPECT_EQUAL((int)texture.GetAlphaMod(), 127);
|
||||||
|
|
||||||
|
renderer.Copy(texture, NullOpt, Point(0, 0));
|
||||||
|
|
||||||
|
pixels.Retrieve(renderer);
|
||||||
|
|
||||||
|
EXPECT_TRUE(pixels.Test3x3(1, 1, 0x032, 119, 99, 0));
|
||||||
|
|
||||||
|
renderer.Present();
|
||||||
|
SDL_Delay(1000);
|
||||||
|
|
||||||
|
texture.SetBlendMode();
|
||||||
|
EXPECT_EQUAL(texture.GetBlendMode(), SDL_BLENDMODE_NONE);
|
||||||
|
texture.SetAlphaMod();
|
||||||
|
EXPECT_EQUAL((int)texture.GetAlphaMod(), 255);
|
||||||
|
|
||||||
|
// Texture: color modulation
|
||||||
|
renderer.SetDrawColor(0, 0, 0);
|
||||||
|
renderer.Clear();
|
||||||
|
|
||||||
|
Uint8 r, g, b;
|
||||||
|
texture.GetColorMod(r, g, b);
|
||||||
|
EXPECT_EQUAL((int)r, 255);
|
||||||
|
EXPECT_EQUAL((int)g, 255);
|
||||||
|
EXPECT_EQUAL((int)b, 255);
|
||||||
|
texture.SetColorMod(89, 241, 50);
|
||||||
|
|
||||||
|
renderer.Copy(texture, NullOpt, Point(0, 0));
|
||||||
|
|
||||||
|
pixels.Retrieve(renderer);
|
||||||
|
|
||||||
|
EXPECT_TRUE(pixels.Test3x3(1, 1, 0x032, 83, 188, 0));
|
||||||
|
|
||||||
|
renderer.Present();
|
||||||
|
SDL_Delay(1000);
|
||||||
|
|
||||||
|
texture.SetColorMod();
|
||||||
|
texture.GetColorMod(r, g, b);
|
||||||
|
EXPECT_EQUAL((int)r, 255);
|
||||||
|
EXPECT_EQUAL((int)g, 255);
|
||||||
|
EXPECT_EQUAL((int)b, 255);
|
||||||
|
}
|
||||||
|
#endif // SDL2PP_WITH_IMAGE
|
||||||
END_TEST()
|
END_TEST()
|
||||||
|
151
tests/test_font.cc
Normal file
151
tests/test_font.cc
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
#include <SDL2/SDL_main.h>
|
||||||
|
|
||||||
|
#include <SDL2pp/SDLTTF.hh>
|
||||||
|
#include <SDL2pp/Font.hh>
|
||||||
|
#include <SDL2pp/Exception.hh>
|
||||||
|
|
||||||
|
#include "testing.h"
|
||||||
|
|
||||||
|
using namespace SDL2pp;
|
||||||
|
|
||||||
|
BEGIN_TEST(int, char*[])
|
||||||
|
SDLTTF ttf;
|
||||||
|
Font font(TESTDATA_DIR "/Vera.ttf", 30);
|
||||||
|
|
||||||
|
{
|
||||||
|
// Move tests
|
||||||
|
TTF_Font* ptr = font.Get();
|
||||||
|
|
||||||
|
EXPECT_TRUE(ptr != nullptr);
|
||||||
|
|
||||||
|
Font font1(std::move(font));
|
||||||
|
EXPECT_TRUE(font1.Get() == ptr);
|
||||||
|
EXPECT_TRUE(font.Get() == nullptr);
|
||||||
|
|
||||||
|
std::swap(font, font1);
|
||||||
|
EXPECT_TRUE(font.Get() == ptr);
|
||||||
|
EXPECT_TRUE(font1.Get() == nullptr);
|
||||||
|
|
||||||
|
font = std::move(font); // self-move
|
||||||
|
EXPECT_TRUE(font.Get() == ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Font style
|
||||||
|
EXPECT_EQUAL(font.GetStyle(), TTF_STYLE_NORMAL);
|
||||||
|
|
||||||
|
font.SetStyle(TTF_STYLE_BOLD | TTF_STYLE_ITALIC | TTF_STYLE_UNDERLINE | TTF_STYLE_STRIKETHROUGH);
|
||||||
|
EXPECT_EQUAL(font.GetStyle(), TTF_STYLE_BOLD | TTF_STYLE_ITALIC | TTF_STYLE_UNDERLINE | TTF_STYLE_STRIKETHROUGH);
|
||||||
|
|
||||||
|
font.SetStyle();
|
||||||
|
EXPECT_EQUAL(font.GetStyle(), TTF_STYLE_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Outline
|
||||||
|
EXPECT_EQUAL(font.GetOutline(), 0);
|
||||||
|
|
||||||
|
font.SetOutline(2);
|
||||||
|
EXPECT_EQUAL(font.GetOutline(), 2);
|
||||||
|
|
||||||
|
font.SetOutline();
|
||||||
|
EXPECT_EQUAL(font.GetOutline(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Hinting
|
||||||
|
EXPECT_EQUAL(font.GetHinting(), TTF_HINTING_NORMAL);
|
||||||
|
|
||||||
|
font.SetHinting(TTF_HINTING_LIGHT);
|
||||||
|
EXPECT_EQUAL(font.GetHinting(), TTF_HINTING_LIGHT);
|
||||||
|
|
||||||
|
font.SetHinting();
|
||||||
|
EXPECT_EQUAL(font.GetHinting(), TTF_HINTING_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Kerning
|
||||||
|
EXPECT_EQUAL(font.GetKerning(), true);
|
||||||
|
|
||||||
|
font.SetKerning(false);
|
||||||
|
EXPECT_EQUAL(font.GetKerning(), false);
|
||||||
|
|
||||||
|
font.SetKerning();
|
||||||
|
EXPECT_EQUAL(font.GetKerning(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Metrics
|
||||||
|
EXPECT_EQUAL(font.GetHeight(), 36);
|
||||||
|
EXPECT_EQUAL(font.GetAscent(), 28);
|
||||||
|
EXPECT_EQUAL(font.GetDescent(), -7);
|
||||||
|
EXPECT_EQUAL(font.GetLineSkip(), 35);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Faces
|
||||||
|
EXPECT_EQUAL(font.GetNumFaces(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Fixed width
|
||||||
|
EXPECT_EQUAL(font.IsFixedWidth(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Names
|
||||||
|
auto family = font.GetFamilyName();
|
||||||
|
auto style = font.GetStyleName();
|
||||||
|
|
||||||
|
EXPECT_TRUE(family && *family == "Bitstream Vera Sans");
|
||||||
|
EXPECT_TRUE(style && *style == "Roman");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Glyphs provided
|
||||||
|
EXPECT_TRUE(font.IsGlyphProvided(u'A'));
|
||||||
|
EXPECT_TRUE(font.IsGlyphProvided(u'¼'));
|
||||||
|
EXPECT_TRUE(!font.IsGlyphProvided(u'л'));
|
||||||
|
EXPECT_TRUE(!font.IsGlyphProvided(u'Ы'));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Glyph metrics
|
||||||
|
int minx, maxx, miny, maxy, advance;
|
||||||
|
|
||||||
|
// Why doesn't TTF_GlyphMetrics on non-existing glyph not return -1?!
|
||||||
|
//EXPECT_EXCEPTION(font.GetGlyphMetrics(u'л', minx, maxx, miny, maxy, advance), Exception);
|
||||||
|
|
||||||
|
EXPECT_NO_EXCEPTION(font.GetGlyphMetrics(u'A', minx, maxx, miny, maxy, advance));
|
||||||
|
|
||||||
|
EXPECT_EQUAL(minx, 0);
|
||||||
|
EXPECT_EQUAL(maxx, 20);
|
||||||
|
EXPECT_EQUAL(miny, 0);
|
||||||
|
EXPECT_EQUAL(maxy, 22);
|
||||||
|
EXPECT_EQUAL(advance, 21);
|
||||||
|
|
||||||
|
EXPECT_EQUAL(font.GetGlyphRect(u'A'), Rect(0, 0, 20, 22));
|
||||||
|
EXPECT_EQUAL(font.GetGlyphAdvance(u'A'), 21);
|
||||||
|
|
||||||
|
// Text size
|
||||||
|
EXPECT_EQUAL(font.GetSizeText("AA"), Point(43, 36));
|
||||||
|
EXPECT_EQUAL(font.GetSizeUTF8(u8"AA"), Point(43, 36));
|
||||||
|
EXPECT_EQUAL(font.GetSizeUNICODE(u"AA"), Point(43, 36));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Rendering
|
||||||
|
// XXX: add real pixel color tests
|
||||||
|
EXPECT_EQUAL(font.RenderText_Solid("AA", SDL_Color{255, 255, 255, 255}).GetSize(), Point(43, 36));
|
||||||
|
EXPECT_EQUAL(font.RenderUTF8_Solid(u8"AA", SDL_Color{255, 255, 255, 255}).GetSize(), Point(43, 36));
|
||||||
|
EXPECT_EQUAL(font.RenderUNICODE_Solid(u"AA", SDL_Color{255, 255, 255, 255}).GetSize(), Point(43, 36));
|
||||||
|
|
||||||
|
EXPECT_EQUAL(font.RenderText_Shaded("AA", SDL_Color{255, 255, 255, 255}, SDL_Color{0, 0, 0, 255}).GetSize(), Point(43, 36));
|
||||||
|
EXPECT_EQUAL(font.RenderUTF8_Shaded(u8"AA", SDL_Color{255, 255, 255, 255}, SDL_Color{0, 0, 0, 255}).GetSize(), Point(43, 36));
|
||||||
|
EXPECT_EQUAL(font.RenderUNICODE_Shaded(u"AA", SDL_Color{255, 255, 255, 255}, SDL_Color{0, 0, 0, 255}).GetSize(), Point(43, 36));
|
||||||
|
|
||||||
|
EXPECT_EQUAL(font.RenderText_Blended("AA", SDL_Color{255, 255, 255, 255}).GetSize(), Point(43, 36));
|
||||||
|
EXPECT_EQUAL(font.RenderUTF8_Blended(u8"AA", SDL_Color{255, 255, 255, 255}).GetSize(), Point(43, 36));
|
||||||
|
EXPECT_EQUAL(font.RenderUNICODE_Blended(u"AA", SDL_Color{255, 255, 255, 255}).GetSize(), Point(43, 36));
|
||||||
|
}
|
||||||
|
END_TEST()
|
17
tests/test_surface.cc
Normal file
17
tests/test_surface.cc
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include <SDL2/SDL_main.h>
|
||||||
|
|
||||||
|
#include <SDL2pp/Surface.hh>
|
||||||
|
|
||||||
|
#include "testing.h"
|
||||||
|
|
||||||
|
using namespace SDL2pp;
|
||||||
|
|
||||||
|
BEGIN_TEST(int, char*[])
|
||||||
|
Surface crate(TESTDATA_DIR "/crate.png");
|
||||||
|
|
||||||
|
{
|
||||||
|
EXPECT_EQUAL(crate.GetWidth(), 32);
|
||||||
|
EXPECT_EQUAL(crate.GetHeight(), 32);
|
||||||
|
EXPECT_EQUAL(crate.GetSize(), Point(32, 32));
|
||||||
|
}
|
||||||
|
END_TEST()
|
Loading…
x
Reference in New Issue
Block a user