15 #define GETTEXT_DOMAIN "wesnoth-test"
22 #include <boost/test/unit_test.hpp>
24 constexpr uint32_t
red = 0xFF'FF'00'00;
25 constexpr uint32_t
green = 0xFF'00'FF'00;
26 constexpr uint32_t
blue = 0xFF'00'00'FF;
27 constexpr uint32_t
yellow = 0xFF'FF'FF'00;
28 constexpr uint32_t
white = 0xFF'FF'FF'FF;
29 constexpr uint32_t
black = 0xFF'00'00'00;
31 constexpr std::array<uint32_t, 16>
img_4x4 {
48 template<
size_t w,
size_t h>
55 uint32_t*
const pixels = surf_lock.pixels();
56 for(
size_t i = 0;
i <
w *
h; ++
i) {
67 const uint32_t*
const pixels = lock.pixels();
68 std::vector<uint32_t> pixel_vec;
69 const int surf_size =
surf->w *
surf->h;
70 std::copy(pixels, pixels + surf_size, std::back_inserter(pixel_vec));
79 BOOST_CHECK_EQUAL(result,
nullptr);
86 BOOST_CHECK_EQUAL(result->w, 0);
87 BOOST_CHECK_EQUAL(result->h, 0);
95 BOOST_CHECK_EQUAL_COLLECTIONS(
104 BOOST_CHECK_EQUAL_COLLECTIONS(
108 BOOST_AUTO_TEST_SUITE_END()
Helper class for pinning SDL surfaces into memory.
rect src
Non-transparent portion of the surface to compose.
BOOST_AUTO_TEST_SUITE(filesystem)
constexpr std::array< uint32_t, 6 > img_4x4_to_3x2_result
constexpr std::array< uint32_t, 16 > img_4x4
surface array_to_surface(const std::array< uint32_t, w *h > &arr)
static std::vector< uint32_t > surface_to_vec(const surface &surf)
constexpr std::array< uint32_t, 4 > img_4x4_to_2x2_result
constexpr uint32_t yellow
BOOST_AUTO_TEST_CASE(test_scale_sharp_nullptr)
surface scale_surface_sharp(const surface &surf, int w, int h)
Scale a surface using modified nearest neighbour algorithm.