[ITC][dali-toolkit][ACR-1566][Added Util functions that convert a kind of buffers... 09/238309/4
authorPriya Kohli <priya.kohli@samsung.com>
Fri, 10 Jul 2020 12:08:39 +0000 (17:38 +0530)
committershobhit verma <shobhit.v@samsung.com>
Tue, 14 Jul 2020 07:29:02 +0000 (07:29 +0000)
Change-Id: Ibd568eefc59b9cdbc4c1e92406674380c242ad9e
Signed-off-by: Priya Kohli <priya.kohli@samsung.com>
src/itc/dali-toolkit/CMakeLists.txt
src/itc/dali-toolkit/image-convert/ITs-image-convert-common.cpp [new file with mode: 0644]
src/itc/dali-toolkit/image-convert/ITs-image-convert-common.h [new file with mode: 0644]
src/itc/dali-toolkit/image-convert/ITs-image-convert.cpp [new file with mode: 0644]
src/itc/dali-toolkit/tct-dali-toolkit-native_mobile.h
src/itc/dali-toolkit/tct-dali-toolkit-native_tizeniot.h
src/itc/dali-toolkit/tct-dali-toolkit-native_wearable.h

index 328d175e2383e5dbbc6a9cc3a4da5bedbbc2afbd..74d7bd042cd68c8254f3c7212a489cf0d66e3b4f 100755 (executable)
@@ -23,6 +23,8 @@ flex-container/ITs-flex-container.cpp
 flex-container/ITs-flex-container-common.cpp
 image-view/ITs-image-view.cpp
 image-view/ITs-image-view-common.cpp
+image-convert/ITs-image-convert.cpp
+image-convert/ITs-image-convert-common.cpp
 item-factory/ITs-item-factory.cpp
 item-factory/ITs-item-factory-common.cpp
 item-layout/ITs-item-layout.cpp
diff --git a/src/itc/dali-toolkit/image-convert/ITs-image-convert-common.cpp b/src/itc/dali-toolkit/image-convert/ITs-image-convert-common.cpp
new file mode 100644 (file)
index 0000000..010d0ed
--- /dev/null
@@ -0,0 +1 @@
+#include "ITs-image-convert-common.h"
diff --git a/src/itc/dali-toolkit/image-convert/ITs-image-convert-common.h b/src/itc/dali-toolkit/image-convert/ITs-image-convert-common.h
new file mode 100644 (file)
index 0000000..a623e87
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _ITS_IMAGECONVERT_COMMON_H_
+#define _ITS_IMAGECONVERT_COMMON_H_
+
+#include <exception>
+#include "dali-common.h"
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/public-api/image-loader/image.h>
+
+using namespace std;
+using namespace Dali;
+using namespace Toolkit;
+
+/** @addtogroup itc-dali-toolkit
+*      @brief Integrated testsuites for module dali-toolkit
+*      @ingroup itc
+*      @{
+*/
+
+
+/** @addtogroup itc-image-convert
+*      @brief Integrated testcases and testcase helper function, callbacks for suite IMAGECONVERT
+*      @ingroup itc-dali-toolkit
+*      @{
+*/
+
+#define SUITE_NAME                     "IMAGE_CONVERT_ITC"
+
+#endif  //_ITS_IMAGECONVERT_COMMON_H_
diff --git a/src/itc/dali-toolkit/image-convert/ITs-image-convert.cpp b/src/itc/dali-toolkit/image-convert/ITs-image-convert.cpp
new file mode 100644 (file)
index 0000000..3def5aa
--- /dev/null
@@ -0,0 +1,274 @@
+#include "ITs-image-convert-common.h"
+
+/** @addtogroup itc-dali-toolkit
+*      @brief Integrated testsuites for module dali-toolkit
+*      @ingroup itc
+*      @{
+*/
+
+/** @addtogroup itc-image-convert
+*      @brief Integrated testcases and testcase helper function, callbacks for suite image-convert
+*      @ingroup itc-dali-toolkit
+*      @{
+*/
+
+extern int gArgc;
+extern char ** gArgv;
+extern int test_return_value;
+
+//& set: ImageConvert
+
+void ITs_ImageConvert_startup(void)
+{
+       test_return_value=0;
+}
+
+void ITs_ImageConvert_cleanup(void)
+{
+}
+
+/** @addtogroup itc-image-convert-testcases
+*      @brief Integrated testcases for suite image-convert
+*      @ingroup  itc-image-convert
+*      @{
+*/
+
+void ImageConvertFrameBufferToUrl();
+void ImageConvertFrameBufferToUrlExistingTexture();
+void ImageConvertPixelDataToUrl();
+void ImageConvertNativeImageSourceToUrl();
+
+namespace
+{
+       enum TEST_CASES_LIST_IMAGE_CONVERT
+       {
+               IMAGE_CONVERT_FRAME_BUFFER_TO_URL1,
+               IMAGE_CONVERT_FRAME_BUFFER_TO_URL2,
+               IMAGE_CONVERT_PIXEL_DATA_TO_URL,
+               IMAGE_CONVERT_NATIVE_IMAGE_SOURCE_TO_URL
+       };
+
+       struct ImageConvert_TestApp : public ConnectionTracker
+       {
+               ImageConvert_TestApp( Application& app, int test_case )
+               : mApplication( app ),
+               mTestCase( test_case )
+               {
+                       mApplication.InitSignal().Connect( this, &ImageConvert_TestApp::OnInit );
+               }
+
+               void OnInit(Application& app)
+               {
+                       ExcuteTest();
+                       mTimer = Timer::New( INTERVAL );
+                       mTimer.TickSignal().Connect( this, &ImageConvert_TestApp::Tick );
+                       mTimer.Start();
+                       }
+
+               bool Tick()
+               {
+                       mTimer.Stop();
+                       mApplication.Quit();
+                       return true;
+               }
+
+               void ExcuteTest()
+               {
+                       switch (mTestCase)
+                       {
+                               case IMAGE_CONVERT_FRAME_BUFFER_TO_URL1:
+                               ImageConvertFrameBufferToUrl();
+                               break;
+                               case IMAGE_CONVERT_FRAME_BUFFER_TO_URL2:
+                               ImageConvertFrameBufferToUrlExistingTexture();
+                               break;
+                               case IMAGE_CONVERT_PIXEL_DATA_TO_URL:
+                               ImageConvertPixelDataToUrl();
+                               break;
+                               case IMAGE_CONVERT_NATIVE_IMAGE_SOURCE_TO_URL:
+                               ImageConvertNativeImageSourceToUrl();
+                               break;
+                 }
+         }
+               // Data
+               Application& mApplication;
+               int mTestCase;
+               Timer mTimer;
+       };
+
+} // unnamed namespace
+
+/**
+ * ##############################
+ * TC Logic Implementation Area.
+ * ##############################
+ **/
+
+void ImageConvertFrameBufferToUrl()
+{
+       unsigned int width(64);
+       unsigned int height(64);
+       FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+
+       DALI_CHECK_FAIL( !frameBuffer, "FrameBuffer not created successfully" );
+       std::string url = Dali::Toolkit::Image::GenerateUrl( frameBuffer, Pixel::Format::RGBA8888, width, height );
+
+       DALI_CHECK_FAIL( url.size() <= 0, "Invalid url size" );
+
+       DaliLog::PrintPass();
+}
+
+void ImageConvertFrameBufferToUrlExistingTexture()
+{
+       unsigned int width(64);
+       unsigned int height(64);
+       FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+
+       Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+       frameBuffer.AttachColorTexture( texture );
+
+       DALI_CHECK_FAIL( Dali::Toolkit::Image::GenerateUrl( frameBuffer, 0 ).size() <= 0, "Invalid url size" );
+
+       DaliLog::PrintPass();
+}
+
+void ImageConvertPixelDataToUrl()
+{
+       unsigned int width(64);
+       unsigned int height(64);
+       unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::RGB888 );
+
+       unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
+       PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE );
+
+       DALI_CHECK_FAIL( Dali::Toolkit::Image::GenerateUrl( pixelData ).size() <= 0, "Invalid url size" );
+
+       DaliLog::PrintPass();
+}
+
+void ImageConvertNativeImageSourceToUrl()
+{
+       unsigned int width(64);
+       unsigned int height(64);
+
+       NativeImageSourcePtr nativeImageSource = NativeImageSource::New(width, height, NativeImageSource::COLOR_DEPTH_DEFAULT );
+       DALI_CHECK_FAIL( Dali::Toolkit::Image::GenerateUrl( nativeImageSource ).size() <= 0, "Invalid url size" );
+
+       DaliLog::PrintPass();
+}
+
+ /**
+ * End of TC Logic Implementation Area.
+ **/
+
+//& purpose: To        Check correct conversion from new texture in the frame buffer to url.
+//& type: auto
+
+/**
+* @testcase                    ITcImageConvertFrameBufferToUrl
+* @since_tizen                         6.0
+* @type                            Positive
+* @description                 Checks correct conversion from new texture in the frame buffer to url.
+* @scenario                        Generate a Url from frame buffer. \n
+*                       This Url can be used in visuals to render the frame buffer. \n
+*                       Any color textures already attached in this freme buffer are not converted to the Url by this method. \n
+*                                      This method does not check for duplicates, If same frame buffer is entered multiple times, a different URL is returned each time. \n
+* @apicovered                  GenerateUrl
+* @passcase                            Url generation is successfully.
+* @failcase                            Fail if url not generated properly.
+* @precondition                        NA
+* @postcondition               NA
+*/
+
+int ITcImageConvertFrameBufferToUrl(void)
+{
+       DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+       Application application = Application::New( &gArgc, &gArgv );
+       CHECK_OPEN_GL(SUITE_NAME,__LINE__)
+       ImageConvert_TestApp testApp( application, IMAGE_CONVERT_FRAME_BUFFER_TO_URL1);
+       application.MainLoop();
+       return test_return_value;
+}
+
+//& purpose: To Check correct conversion from already existed texture of the frame buffer to url.
+//& type: auto
+
+/**
+* @testcase                    ITcImageConvertFrameBufferToUrlExistingTexture
+* @since_tizen                         6.0
+* @type                                Positive
+* @description                 Checks correct conversion from already existed texture of the frame buffer to url.
+* @scenario                            Generate a Url from frame buffer. \n
+*                       Only an color texture already attached in this frame buffer can be convert to Url by this method. \n
+*                                              This method does not check for duplicates, If same frame buffer is entered multiple times, a different URL is returned each time. \n
+* @apicovered                  GenerateUrl
+* @passcase                            Url generation is successfully.
+* @failcase                            Fail if url not generated properly.
+* @precondition                        NA
+* @postcondition               NA
+*/
+int ITcImageConvertFrameBufferToUrlExistingTexture(void)
+{
+       DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+       Application application = Application::New( &gArgc, &gArgv );
+       CHECK_OPEN_GL(SUITE_NAME,__LINE__)
+       ImageConvert_TestApp testApp( application, IMAGE_CONVERT_FRAME_BUFFER_TO_URL2);
+       application.MainLoop();
+       return test_return_value;
+}
+
+//& purpose: To Check correct conversion from pixel data to url.
+//& type: auto
+/**
+* @testcase                    ITcImageConvertPixelDataToUrl
+* @since_tizen                         6.0
+* @type                                Positive
+* @description                 Checks correct conversion from pixel data to url.
+* @scenario                            Generate a Url from Pixel data. \n
+*                                              This Url can be used in visuals to render the pixel data. \n
+*                                              This method does not check for duplicates, If same pixel data is entered multiple times, a different URL is returned each time.
+* @apicovered                  GenerateUrl
+* @passcase                            Url generation is successfully.
+* @failcase                            Fail if url not generated properly.
+* @precondition                        NA
+* @postcondition               NA
+*/
+int ITcImageConvertPixelDataToUrl(void)
+{
+       DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+       Application application = Application::New( &gArgc, &gArgv );
+       CHECK_OPEN_GL(SUITE_NAME,__LINE__)
+       ImageConvert_TestApp testApp( application, IMAGE_CONVERT_PIXEL_DATA_TO_URL);
+       application.MainLoop();
+       return test_return_value;
+}
+
+//& purpose: To Check correct conversion from native image source to url.
+//& type: auto
+/**
+* @testcase                    ITcImageConvertNativeImageSourceToUrl
+* @since_tizen                         6.0
+* @type                                Positive
+* @description                 Checks correct conversion from native image source to url.
+* @scenario                            Generate a Url from native image source. \n
+*                                              This Url can be used in visuals to render the native image source. \n
+*                                              This method does not check for duplicates, If same native image source is entered multiple times, a different URL is returned each time.
+* @apicovered                  GenerateUrl
+* @passcase                            Url generation is successfully.
+* @failcase                            Fail if url not generated properly.
+* @precondition                        NA
+* @postcondition               NA
+*/
+int ITcImageConvertNativeImageSourceToUrl(void)
+{
+       DaliLog::PrintExecStarted(SUITE_NAME, __FUNCTION__);
+       Application application = Application::New( &gArgc, &gArgv );
+       CHECK_OPEN_GL(SUITE_NAME,__LINE__)
+       ImageConvert_TestApp testApp( application, IMAGE_CONVERT_NATIVE_IMAGE_SOURCE_TO_URL);
+       application.MainLoop();
+       return test_return_value;
+}
+
+/** @} */
+/** @} */
+/** @} */
index c3cab913cccdf2d4acb500cd5fd0d423019f630d..947e03ed7333c2c29d0a371d48d01c6b50b2d4f5 100755 (executable)
@@ -37,6 +37,8 @@ extern void ITs_flex_container_startup(void);
 extern void ITs_flex_container_cleanup(void);
 extern void ITs_ImageView_startup(void);
 extern void ITs_ImageView_cleanup(void);
+extern void ITs_ImageConvert_startup(void);
+extern void ITs_ImageConvert_cleanup(void);
 extern void ITs_item_factory_startup(void);
 extern void ITs_item_factory_cleanup(void);
 extern void ITs_item_layout_startup(void);
@@ -165,6 +167,10 @@ extern int ITcImageViewSetGetProperty(void);
 extern int ITcImageViewSetImage(void);
 extern int ITcImageViewResourceReadySignal(void);
 extern int ITcImageViewIsResourceReady(void);
+extern int ITcImageConvertFrameBufferToUrl(void);
+extern int ITcImageConvertFrameBufferToUrlExistingTexture(void);
+extern int ITcImageConvertPixelDataToUrl(void);
+extern int ITcImageConvertNativeImageSourceToUrl(void);
 extern int ITcItemFactoryGetNumberOfItems(void);
 extern int ITcItemFactoryNewItem(void);
 extern int ITcItemFactoryNew(void);
@@ -449,6 +455,10 @@ testcase tc_array[] = {
        {"ITcImageViewSetImage",ITcImageViewSetImage,ITs_ImageView_startup,ITs_ImageView_cleanup},
        {"ITcImageViewResourceReadySignal",ITcImageViewResourceReadySignal,ITs_ImageView_startup,ITs_ImageView_cleanup},
        {"ITcImageViewIsResourceReady",ITcImageViewIsResourceReady,ITs_ImageView_startup,ITs_ImageView_cleanup},
+       {"ITcImageConvertFrameBufferToUrl",ITcImageConvertFrameBufferToUrl,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
+       {"ITcImageConvertFrameBufferToUrlExistingTexture",ITcImageConvertFrameBufferToUrlExistingTexture,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
+       {"ITcImageConvertPixelDataToUrl",ITcImageConvertPixelDataToUrl,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
+       {"ITcImageConvertNativeImageSourceToUrl",ITcImageConvertNativeImageSourceToUrl,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
        {"ITcItemFactoryGetNumberOfItems",ITcItemFactoryGetNumberOfItems,ITs_item_factory_startup,ITs_item_factory_cleanup},
        {"ITcItemFactoryNewItem",ITcItemFactoryNewItem,ITs_item_factory_startup,ITs_item_factory_cleanup},
        {"ITcItemFactoryNew",ITcItemFactoryNew,ITs_item_factory_startup,ITs_item_factory_cleanup},
index d5bd78d94f72ec7d7015af75f13009ff35fc9786..8fbe47210219308c15f722845211c12e9e45ae44 100755 (executable)
@@ -37,6 +37,8 @@ extern void ITs_flex_container_startup(void);
 extern void ITs_flex_container_cleanup(void);
 extern void ITs_ImageView_startup(void);
 extern void ITs_ImageView_cleanup(void);
+extern void ITs_ImageConvert_startup(void);
+extern void ITs_ImageConvert_cleanup(void);
 extern void ITs_item_factory_startup(void);
 extern void ITs_item_factory_cleanup(void);
 extern void ITs_item_layout_startup(void);
@@ -164,6 +166,10 @@ extern int ITcImageViewSetGetProperty(void);
 extern int ITcImageViewSetImage(void);
 extern int ITcImageViewResourceReadySignal(void);
 extern int ITcImageViewIsResourceReady(void);
+extern int ITcImageConvertFrameBufferToUrl(void);
+extern int ITcImageConvertFrameBufferToUrlExistingTexture(void);
+extern int ITcImageConvertPixelDataToUrl(void);
+extern int ITcImageConvertNativeImageSourceToUrl(void);
 extern int ITcItemFactoryGetNumberOfItems(void);
 extern int ITcItemFactoryNewItem(void);
 extern int ITcItemFactoryNew(void);
@@ -440,6 +446,10 @@ testcase tc_array[] = {
        {"ITcImageViewSetImage",ITcImageViewSetImage,ITs_ImageView_startup,ITs_ImageView_cleanup},
        {"ITcImageViewResourceReadySignal",ITcImageViewResourceReadySignal,ITs_ImageView_startup,ITs_ImageView_cleanup},
        {"ITcImageViewIsResourceReady",ITcImageViewIsResourceReady,ITs_ImageView_startup,ITs_ImageView_cleanup},
+       {"ITcImageConvertFrameBufferToUrl",ITcImageConvertFrameBufferToUrl,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
+       {"ITcImageConvertFrameBufferToUrlExistingTexture",ITcImageConvertFrameBufferToUrlExistingTexture,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
+       {"ITcImageConvertPixelDataToUrl",ITcImageConvertPixelDataToUrl,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
+       {"ITcImageConvertNativeImageSourceToUrl",ITcImageConvertNativeImageSourceToUrl,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
        {"ITcItemFactoryGetNumberOfItems",ITcItemFactoryGetNumberOfItems,ITs_item_factory_startup,ITs_item_factory_cleanup},
        {"ITcItemFactoryNewItem",ITcItemFactoryNewItem,ITs_item_factory_startup,ITs_item_factory_cleanup},
        {"ITcItemFactoryNew",ITcItemFactoryNew,ITs_item_factory_startup,ITs_item_factory_cleanup},
index c98c818c44f972167f0fe113465094f10c5b62c7..a21486bdb467f5f8f48abe3d06f755dcf3cd1dd8 100755 (executable)
@@ -37,6 +37,8 @@ extern void ITs_flex_container_startup(void);
 extern void ITs_flex_container_cleanup(void);
 extern void ITs_ImageView_startup(void);
 extern void ITs_ImageView_cleanup(void);
+extern void ITs_ImageConvert_startup(void);
+extern void ITs_ImageConvert_cleanup(void);
 extern void ITs_item_factory_startup(void);
 extern void ITs_item_factory_cleanup(void);
 extern void ITs_item_layout_startup(void);
@@ -165,6 +167,10 @@ extern int ITcImageViewSetGetProperty(void);
 extern int ITcImageViewSetImage(void);
 extern int ITcImageViewResourceReadySignal(void);
 extern int ITcImageViewIsResourceReady(void);
+extern int ITcImageConvertFrameBufferToUrl(void);
+extern int ITcImageConvertFrameBufferToUrlExistingTexture(void);
+extern int ITcImageConvertPixelDataToUrl(void);
+extern int ITcImageConvertNativeImageSourceToUrl(void);
 extern int ITcItemFactoryGetNumberOfItems(void);
 extern int ITcItemFactoryNewItem(void);
 extern int ITcItemFactoryNew(void);
@@ -449,6 +455,10 @@ testcase tc_array[] = {
        {"ITcImageViewSetImage",ITcImageViewSetImage,ITs_ImageView_startup,ITs_ImageView_cleanup},
        {"ITcImageViewResourceReadySignal",ITcImageViewResourceReadySignal,ITs_ImageView_startup,ITs_ImageView_cleanup},
        {"ITcImageViewIsResourceReady",ITcImageViewIsResourceReady,ITs_ImageView_startup,ITs_ImageView_cleanup},
+       {"ITcImageConvertFrameBufferToUrl",ITcImageConvertFrameBufferToUrl,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
+       {"ITcImageConvertFrameBufferToUrlExistingTexture",ITcImageConvertFrameBufferToUrlExistingTexture,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
+       {"ITcImageConvertPixelDataToUrl",ITcImageConvertPixelDataToUrl,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
+       {"ITcImageConvertNativeImageSourceToUrl",ITcImageConvertNativeImageSourceToUrl,ITs_ImageConvert_startup,ITs_ImageConvert_startup},
        {"ITcItemFactoryGetNumberOfItems",ITcItemFactoryGetNumberOfItems,ITs_item_factory_startup,ITs_item_factory_cleanup},
        {"ITcItemFactoryNewItem",ITcItemFactoryNewItem,ITs_item_factory_startup,ITs_item_factory_cleanup},
        {"ITcItemFactoryNew",ITcItemFactoryNew,ITs_item_factory_startup,ITs_item_factory_cleanup},