The Battle for Wesnoth  1.19.0+dev
Macros | Functions | Variables
test_sdl.cpp File Reference
#include "sdl/surface.hpp"
#include "sdl/utils.hpp"
#include <algorithm>
#include <array>
#include <boost/test/unit_test.hpp>
Include dependency graph for test_sdl.cpp:

Go to the source code of this file.

Macros

#define GETTEXT_DOMAIN   "wesnoth-test"
 

Functions

template<size_t w, size_t h>
surface array_to_surface (const std::array< uint32_t, w *h > &arr)
 
std::vector< uint32_t > surface_to_vec (const surface &surf)
 
 BOOST_AUTO_TEST_CASE (test_scale_sharp_nullptr)
 
 BOOST_AUTO_TEST_CASE (test_scale_sharp_zero)
 
 BOOST_AUTO_TEST_CASE (test_scale_sharp_round)
 
 BOOST_AUTO_TEST_CASE (test_scale_sharp_fractional)
 

Variables

constexpr uint32_t red = 0xFF'FF'00'00
 
constexpr uint32_t green = 0xFF'00'FF'00
 
constexpr uint32_t blue = 0xFF'00'00'FF
 
constexpr uint32_t yellow = 0xFF'FF'FF'00
 
constexpr uint32_t white = 0xFF'FF'FF'FF
 
constexpr uint32_t black = 0xFF'00'00'00
 
constexpr std::array< uint32_t, 16 > img_4x4
 
constexpr std::array< uint32_t, 4 > img_4x4_to_2x2_result
 
constexpr std::array< uint32_t, 6 > img_4x4_to_3x2_result
 

Macro Definition Documentation

◆ GETTEXT_DOMAIN

#define GETTEXT_DOMAIN   "wesnoth-test"

Definition at line 15 of file test_sdl.cpp.

Function Documentation

◆ array_to_surface()

template<size_t w, size_t h>
surface array_to_surface ( const std::array< uint32_t, w *h > &  arr)

Definition at line 49 of file test_sdl.cpp.

References h, i, surface_locker< T >::pixels(), and w.

◆ BOOST_AUTO_TEST_CASE() [1/4]

BOOST_AUTO_TEST_CASE ( test_scale_sharp_fractional  )

Definition at line 99 of file test_sdl.cpp.

References img_4x4, img_4x4_to_3x2_result, scale_surface_sharp(), and surface_to_vec().

◆ BOOST_AUTO_TEST_CASE() [2/4]

BOOST_AUTO_TEST_CASE ( test_scale_sharp_nullptr  )

Definition at line 76 of file test_sdl.cpp.

References scale_surface_sharp().

◆ BOOST_AUTO_TEST_CASE() [3/4]

BOOST_AUTO_TEST_CASE ( test_scale_sharp_round  )

Definition at line 90 of file test_sdl.cpp.

References img_4x4, img_4x4_to_2x2_result, scale_surface_sharp(), and surface_to_vec().

◆ BOOST_AUTO_TEST_CASE() [4/4]

BOOST_AUTO_TEST_CASE ( test_scale_sharp_zero  )

Definition at line 82 of file test_sdl.cpp.

References img_4x4, and scale_surface_sharp().

◆ surface_to_vec()

std::vector<uint32_t> surface_to_vec ( const surface surf)

Definition at line 64 of file test_sdl.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

Variable Documentation

◆ black

constexpr uint32_t black = 0xFF'00'00'00
constexpr

Definition at line 29 of file test_sdl.cpp.

◆ blue

constexpr uint32_t blue = 0xFF'00'00'FF
constexpr

◆ green

constexpr uint32_t green = 0xFF'00'FF'00
constexpr

◆ img_4x4

constexpr std::array<uint32_t, 16> img_4x4
constexpr
Initial value:
{
}
constexpr uint32_t black
Definition: test_sdl.cpp:29
constexpr uint32_t red
Definition: test_sdl.cpp:24
constexpr uint32_t green
Definition: test_sdl.cpp:25
constexpr uint32_t yellow
Definition: test_sdl.cpp:27
constexpr uint32_t white
Definition: test_sdl.cpp:28
constexpr uint32_t blue
Definition: test_sdl.cpp:26

Definition at line 31 of file test_sdl.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ img_4x4_to_2x2_result

constexpr std::array<uint32_t, 4> img_4x4_to_2x2_result
constexpr
Initial value:
{
}

Definition at line 38 of file test_sdl.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ img_4x4_to_3x2_result

constexpr std::array<uint32_t, 6> img_4x4_to_3x2_result
constexpr
Initial value:

Definition at line 43 of file test_sdl.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ red

constexpr uint32_t red = 0xFF'FF'00'00
constexpr

◆ white

constexpr uint32_t white = 0xFF'FF'FF'FF
constexpr

Definition at line 28 of file test_sdl.cpp.

◆ yellow

constexpr uint32_t yellow = 0xFF'FF'FF'00
constexpr

Definition at line 27 of file test_sdl.cpp.