X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ImageAtlas.cpp;h=9276f505b3de2c27abf000c4fece56bb9e646c5c;hp=cca026f4ac49a8be1b58c581b2ebd4033dc312c2;hb=5bc22f12881a16d7c5143c5e220fc0075aef6061;hpb=dfc52dd91d794065546f0d816703eed19cc8c32b diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ImageAtlas.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ImageAtlas.cpp index cca026f..9276f50 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ImageAtlas.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ImageAtlas.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +21,6 @@ #include #include #include -#include - -#include #include using namespace Dali; @@ -38,8 +35,8 @@ static const char* gImage_50_RGBA = TEST_RESOURCE_DIR "/icon-delete.png"; // resolution: 128*128, pixel format: RGB888 static const char* gImage_128_RGB = TEST_RESOURCE_DIR "/gallery-small-1.jpg"; -// this is image is not exist, for negative test -static const char* gImageNonExist = "non-exist.jpg"; +// Empty image, for testing broken image loading +static const char* gEmptyImage = TEST_RESOURCE_DIR "/empty.bmp"; const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS) @@ -194,26 +191,27 @@ int UtcDaliImageAtlasSetBrokenImage(void) unsigned int size = 200; ImageAtlas atlas = ImageAtlas::New( size, size ); - Vector4 textureRect; - atlas.Upload( textureRect, gImageNonExist ); - DALI_TEST_EQUALS( textureRect, Vector4::ZERO, TEST_LOCATION ); - // Set broken image TestPlatformAbstraction& platform = application.GetPlatform(); platform.SetClosestImageSize(Vector2( 34, 34)); atlas.SetBrokenImage( gImage_34_RGBA ); - // the non-exit image will be replaced with the broken image - platform.SetClosestImageSize(Vector2( 0, 0)); - atlas.Upload( textureRect, gImageNonExist ); + Vector4 textureRect; + + // the empty image will be replaced with the broken image + platform.SetClosestImageSize(Vector2( 20, 20)); + atlas.Upload( textureRect, gEmptyImage ); + DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION ); Rect pixelArea = TextureCoordinateToPixelArea(textureRect, size); - DALI_TEST_EQUALS( pixelArea.width, 34, TEST_LOCATION ); - DALI_TEST_EQUALS( pixelArea.height, 34, TEST_LOCATION ); + DALI_TEST_EQUALS( pixelArea.width, 20, TEST_LOCATION ); + DALI_TEST_EQUALS( pixelArea.height, 20, TEST_LOCATION ); END_TEST; } + + int UtcDaliImageAtlasUploadP(void) { ToolkitTestApplication application; @@ -243,30 +241,32 @@ int UtcDaliImageAtlasUploadP(void) DALI_TEST_EQUALS( pixelArea1.height, 34, TEST_LOCATION ); TraceCallStack::NamedParams params; - params["width"] = ToString(pixelArea1.width); - params["height"] = ToString(pixelArea1.height); - params["xoffset"] = ToString(pixelArea1.x); - params["yoffset"] = ToString(pixelArea1.y); + params["width"] < pixelArea2 = TextureCoordinateToPixelArea(textureRect2, size); DALI_TEST_EQUALS( pixelArea2.width, 50, TEST_LOCATION ); DALI_TEST_EQUALS( pixelArea2.height, 50, TEST_LOCATION ); - params["width"] = ToString(pixelArea2.width); - params["height"] = ToString(pixelArea2.height); - params["xoffset"] = ToString(pixelArea2.x); - params["yoffset"] = ToString(pixelArea2.y); + params.mParams.clear(); + params["width"] < pixelArea3 = TextureCoordinateToPixelArea(textureRect3, size); DALI_TEST_EQUALS( pixelArea3.width, 128, TEST_LOCATION ); DALI_TEST_EQUALS( pixelArea3.height, 128, TEST_LOCATION ); - params["width"] = ToString(pixelArea3.width); - params["height"] = ToString(pixelArea3.height); - params["xoffset"] = ToString(pixelArea3.x); - params["yoffset"] = ToString(pixelArea3.y); + params.mParams.clear(); + params["width"] <