--- /dev/null
+#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;
+}
+
+/** @} */
+/** @} */
+/** @} */
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);
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);
{"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},
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);
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);
{"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},
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);
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);
{"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},