MCPcopy Create free account
hub / github.com/defold/defold / TEST

Function TEST

engine/texc/src/test/test_texc.cpp:291–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289#undef ASSERT_RGBA
290
291TEST(Helpers, FlipY)
292{
293 const uint32_t width = 8;
294 const uint32_t height = 8;
295 uint32_t image[width*height];
296
297 for (uint32_t y = 0; y < height; ++y)
298 {
299 for (uint32_t x = 0; x < width; ++x)
300 {
301 image[x + width * y] = x + width * (height - y - 1);
302 }
303 }
304
305 dmTexc::FlipImageY_RGBA8888(image, width, height);
306
307 for (uint32_t y = 0; y < height; ++y)
308 {
309 for (uint32_t x = 0; x < width; ++x)
310 {
311 ASSERT_EQ(x + width * y, image[x + width * y]);
312 }
313 }
314
315
316 int w = 7;
317 int h = 7;
318
319 for (uint32_t y = 0; y < h; ++y)
320 {
321 for (uint32_t x = 0; x < w; ++x)
322 {
323 image[x + w * y] = x + w * (h - y - 1);
324 }
325 }
326
327 dmTexc::FlipImageY_RGBA8888(image, w, h);
328
329 for (uint32_t y = 0; y < h; ++y)
330 {
331 for (uint32_t x = 0; x < w; ++x)
332 {
333 ASSERT_EQ(x + w * y, image[x + w * y]);
334 }
335 }
336
337}
338
339TEST(Helpers, FlipX)
340{

Callers

nothing calls this directly

Calls 8

FlipImageY_RGBA8888Function · 0.85
FlipImageX_RGBA8888Function · 0.85
stbi_loadFunction · 0.85
ASTCEncodeFunction · 0.85
freeFunction · 0.85
CreateImageFunction · 0.50
DestroyImageFunction · 0.50

Tested by

no test coverage detected