Updating code formatting
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-Image.cpp
index b4b88b6..6dff87b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
  * limitations under the License.
  */
 
-#include <iostream>
 #include <stdlib.h>
+#include <iostream>
+
 #include <dali-toolkit-test-suite-utils.h>
-#include <dali/public-api/rendering/texture.h>
+
+#include <dali-toolkit/public-api/image-loader/image-url.h>
+#include <dali-toolkit/public-api/image-loader/image.h>
+#include <dali/public-api/adaptor-framework/native-image-source.h>
 #include <dali/public-api/images/pixel-data.h>
 #include <dali/public-api/rendering/frame-buffer.h>
-#include <dali/public-api/adaptor-framework/native-image-source.h>
-#include <dali-toolkit/public-api/image-loader/image.h>
-#include <dali-toolkit/public-api/image-loader/image-url.h>
+#include <dali/public-api/rendering/texture.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -31,7 +33,6 @@ namespace
 {
 } // namespace
 
-
 void dali_image_startup(void)
 {
   test_return_value = TET_UNDEF;
@@ -45,78 +46,75 @@ void dali_image_cleanup(void)
 int UtcDaliImageConvertFrameBufferToUrl1(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( "UtcDaliImageConvertFrameBufferToUrl1" );
+  tet_infoline("UtcDaliImageConvertFrameBufferToUrl1");
 
   unsigned int width(64);
   unsigned int height(64);
-  FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+  FrameBuffer  frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
 
-  DALI_TEST_CHECK( frameBuffer );
-  ImageUrl url = Dali::Toolkit::Image::GenerateUrl( frameBuffer, Pixel::Format::RGBA8888, width, height );
+  DALI_TEST_CHECK(frameBuffer);
+  ImageUrl url = Dali::Toolkit::Image::GenerateUrl(frameBuffer, Pixel::Format::RGBA8888, width, height);
 
-  DALI_TEST_CHECK( url.GetUrl().size() > 0u );
+  DALI_TEST_CHECK(url.GetUrl().size() > 0u);
 
   END_TEST;
 }
 
-
 int UtcDaliImageConvertFrameBufferToUrl2(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( "UtcDaliImageConvertFrameBufferToUrl2" );
+  tet_infoline("UtcDaliImageConvertFrameBufferToUrl2");
 
   unsigned int width(64);
   unsigned int height(64);
-  FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+  FrameBuffer  frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
 
-  Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
-  frameBuffer.AttachColorTexture( texture );
+  Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+  frameBuffer.AttachColorTexture(texture);
 
-  DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( frameBuffer, 0 ).GetUrl().size() > 0u );
+  DALI_TEST_CHECK(Dali::Toolkit::Image::GenerateUrl(frameBuffer, 0).GetUrl().size() > 0u);
 
   END_TEST;
 }
 
-
 int UtcDaliImageConvertPixelDataToUrl(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( "UtcDaliImageConvertPixelDataToUrl" );
+  tet_infoline("UtcDaliImageConvertPixelDataToUrl");
 
   unsigned int width(64);
   unsigned int height(64);
-  unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::RGB888 );
+  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 );
+  unsigned char* buffer    = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+  PixelData      pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE);
 
-  DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( pixelData ).GetUrl().size() > 0u );
+  DALI_TEST_CHECK(Dali::Toolkit::Image::GenerateUrl(pixelData).GetUrl().size() > 0u);
 
   END_TEST;
 }
 
-
 int UtcDaliImageConvertNativeImageSourceToUrl(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( "UtcDaliImageConvertNativeImageSourceToUrl" );
+  tet_infoline("UtcDaliImageConvertNativeImageSourceToUrl");
 
   unsigned int width(64);
   unsigned int height(64);
   try
   {
-    NativeImageSourcePtr nativeImageSource = NativeImageSource::New(width, height, NativeImageSource::COLOR_DEPTH_DEFAULT );
+    NativeImageSourcePtr nativeImageSource = NativeImageSource::New(width, height, NativeImageSource::COLOR_DEPTH_DEFAULT);
 
-    DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( nativeImageSource ).GetUrl().size() > 0u );
+    DALI_TEST_CHECK(Dali::Toolkit::Image::GenerateUrl(nativeImageSource).GetUrl().size() > 0u);
   }
   catch(Dali::DaliException& e)
   {
-    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_PRINT_ASSERT(e);
     DALI_TEST_ASSERT(e, "Adaptor::IsAvailable()", TEST_LOCATION);
   }
   catch(...)
   {
-    tet_printf("Assertion test failed - wrong Exception\n" );
+    tet_printf("Assertion test failed - wrong Exception\n");
     tet_result(TET_FAIL);
   }
 
@@ -126,14 +124,14 @@ int UtcDaliImageConvertNativeImageSourceToUrl(void)
 int UtcDaliImageConvertEncodedImageBufferToUrl(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( "UtcDaliImageConvertEncodedImageBufferToUrl" );
+  tet_infoline("UtcDaliImageConvertEncodedImageBufferToUrl");
 
   Dali::Vector<uint8_t> buffer;
   buffer.PushBack(0x11);
   buffer.PushBack(0x22);
   buffer.PushBack(0x33);
 
-  DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( EncodedImageBuffer::New(buffer) ).GetUrl().size() > 0u );
+  DALI_TEST_CHECK(Dali::Toolkit::Image::GenerateUrl(EncodedImageBuffer::New(buffer)).GetUrl().size() > 0u);
 
   END_TEST;
 }