Formatted autotests, fixed up issues with header sorting.
Change-Id: Id68298bb3e587431623415c3dfd402adb227493f
#include <stdio.h>
#include <stdlib.h>
-#define assert(exp) \
- if (!(exp)) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert(exp) \
+ if(!(exp)) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Following expression is not true:\n" \
- "%s\n", #exp); \
- return 1; \
- }
+ "%s\n", \
+ #exp); \
+ return 1; \
+ }
-#define assert_eq(var, ref) \
- if (var != ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_eq(var, ref) \
+ if(var != ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Values \"%s\" and \"%s\" are not equal:\n" \
- "%s == %d, %s == %d\n", \
- #var, #ref, #var, (int)var, #ref, (int)ref); \
- return 1; \
- }
+ "%s == %d, %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ (int)var, \
+ #ref, \
+ (int)ref); \
+ return 1; \
+ }
-#define assert_neq(var, ref) \
- if (var == ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_neq(var, ref) \
+ if(var == ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Values \"%s\" and \"%s\" are equal:\n" \
- "%s == %s == %d\n", \
- #var, #ref, #var, #ref, (int)ref); \
- return 1; \
- }
+ "%s == %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ #ref, \
+ (int)ref); \
+ return 1; \
+ }
-#define assert_gt(var, ref) \
- if (var <= ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_gt(var, ref) \
+ if(var <= ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Value \"%s\" is not greater than \"%s\":\n" \
- "%s == %d, %s == %d\n", \
- #var, #ref, #var, var, #ref, ref); \
- return 1; \
- }
+ "%s == %d, %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ var, \
+ #ref, \
+ ref); \
+ return 1; \
+ }
-#define assert_geq(var, ref) \
- if (var < ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_geq(var, ref) \
+ if(var < ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Value \"%s\" is not greater or equal to \"%s\":\n" \
- "%s == %d, %s == %d\n", \
- #var, #ref, #var, var, #ref, ref); \
- return 1; \
- }
+ "%s == %d, %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ var, \
+ #ref, \
+ ref); \
+ return 1; \
+ }
-#define assert_lt(var, ref) \
- if (var >= ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_lt(var, ref) \
+ if(var >= ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Value \"%s\" is not lower than \"%s\":\n" \
- "%s == %d, %s == %d\n", \
- #var, #ref, #var, var, #ref, ref); \
- return 1; \
- }
+ "%s == %d, %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ var, \
+ #ref, \
+ ref); \
+ return 1; \
+ }
-#define assert_leq(var, ref) \
- if (var > ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_leq(var, ref) \
+ if(var > ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Value \"%s\" is not lower or equal to \"%s\":\n" \
- "%s == %d, %s == %d\n", \
- #var, #ref, #var, var, #ref, ref); \
- return 1; \
- }
+ "%s == %d, %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ var, \
+ #ref, \
+ ref); \
+ return 1; \
+ }
#endif // _ASSERT_H_
typedef int (*tc_fun_ptr)(void);
/* struct describing specific testcase */
-typedef struct testcase_s {
- const char* name;
- tc_fun_ptr function;
- void_fun_ptr startup;
- void_fun_ptr cleanup;
+typedef struct testcase_s
+{
+ const char* name;
+ tc_fun_ptr function;
+ void_fun_ptr startup;
+ void_fun_ptr cleanup;
} testcase;
#endif // _TESTCASE_H_
*
*/
-#include <cstring>
-#include <dali/devel-api/addons/addon-base.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/addons/addon-base.h>
+#include <cstring>
namespace
{
bool gIsPaused = false;
}
-int StringLen( const char* str )
+int StringLen(const char* str)
{
- return strlen( str );
+ return strlen(str);
}
-int DoSum( int a, int b )
+int DoSum(int a, int b)
{
- return a+b;
+ return a + b;
}
bool GetLifecycleStatus()
return 42;
}
- static int GetValueWithInstance( AddOnDataInstance* instance )
+ static int GetValueWithInstance(AddOnDataInstance* instance)
{
return instance->GetValue();
}
class TestDummyAddOn : public Dali::AddOns::AddOnBase
{
public:
-
- void GetAddOnInfo( Dali::AddOnInfo& info ) override
+ void GetAddOnInfo(Dali::AddOnInfo& info) override
{
- info.type = Dali::AddOnType::GENERIC;
- info.name = "SampleAddOn";
- info.version = Dali::DALI_ADDON_VERSION( 1, 0, 0 );
- info.next = nullptr;
- tet_printf( "SampleAddOn: GetAddOnInfo() : name = %s\n", info.name.c_str());
+ info.type = Dali::AddOnType::GENERIC;
+ info.name = "SampleAddOn";
+ info.version = Dali::DALI_ADDON_VERSION(1, 0, 0);
+ info.next = nullptr;
+ tet_printf("SampleAddOn: GetAddOnInfo() : name = %s\n", info.name.c_str());
}
/**
Dali::AddOns::DispatchTable* GetGlobalDispatchTable() override
{
static Dali::AddOns::DispatchTable dispatchTable{};
- if( dispatchTable.Empty() )
+ if(dispatchTable.Empty())
{
- dispatchTable["DoSum"] = DoSum;
- dispatchTable["StringLen"] = StringLen;
- dispatchTable["GetLifecycleStatus"] = GetLifecycleStatus;
- dispatchTable["CreateInstance"] = CreateInstance;
-
+ dispatchTable["DoSum"] = DoSum;
+ dispatchTable["StringLen"] = StringLen;
+ dispatchTable["GetLifecycleStatus"] = GetLifecycleStatus;
+ dispatchTable["CreateInstance"] = CreateInstance;
}
return &dispatchTable;
}
Dali::AddOns::DispatchTable* GetInstanceDispatchTable() override
{
static Dali::AddOns::DispatchTable dispatchTable{};
- if( dispatchTable.Empty() )
+ if(dispatchTable.Empty())
{
dispatchTable["InstanceCall"] = AddOnDataInstance::GetValueWithInstance;
}
}
};
-REGISTER_ADDON_CLASS( TestDummyAddOn );
+REGISTER_ADDON_CLASS(TestDummyAddOn);
#include <dali-test-suite-utils.h>
#include <dali/internal/imaging/common/pixel-buffer-impl.h>
-AutoCloseFile::AutoCloseFile( FILE *fp )
-: filePtr( fp )
+AutoCloseFile::AutoCloseFile(FILE* fp)
+: filePtr(fp)
{
}
AutoCloseFile::~AutoCloseFile()
{
- if ( filePtr )
+ if(filePtr)
{
- fclose( filePtr );
+ fclose(filePtr);
}
}
-
-ImageDetails::ImageDetails( const char * const _name, unsigned int _width, unsigned int _height )
-: name( _name ),
- width( _width ),
- height( _height ),
- reportedWidth( _width ),
- reportedHeight( _height ),
- refBufferSize( 0u ),
- refBuffer( nullptr )
+ImageDetails::ImageDetails(const char* const _name, unsigned int _width, unsigned int _height)
+: name(_name),
+ width(_width),
+ height(_height),
+ reportedWidth(_width),
+ reportedHeight(_height),
+ refBufferSize(0u),
+ refBuffer(nullptr)
{
LoadBuffer();
}
-ImageDetails::ImageDetails( const char * const _name, unsigned int _width, unsigned int _height, unsigned int _reportedWidth, unsigned int _reportedHeight )
-: name( _name ),
- width( _width ),
- height( _height ),
- reportedWidth( _reportedWidth ),
- reportedHeight( _reportedHeight ),
- refBufferSize( 0u ),
- refBuffer( nullptr )
+ImageDetails::ImageDetails(const char* const _name, unsigned int _width, unsigned int _height, unsigned int _reportedWidth, unsigned int _reportedHeight)
+: name(_name),
+ width(_width),
+ height(_height),
+ reportedWidth(_reportedWidth),
+ reportedHeight(_reportedHeight),
+ refBufferSize(0u),
+ refBuffer(nullptr)
{
LoadBuffer();
}
ImageDetails::~ImageDetails()
{
- if( refBuffer )
+ if(refBuffer)
{
delete[] refBuffer;
}
void ImageDetails::LoadBuffer()
{
// Load the reference buffer from the buffer file
- std::string refBufferFilename( name + ".buffer" );
- FILE *fp = fopen ( refBufferFilename.c_str(), "rb" );
- AutoCloseFile autoCloseBufferFile( fp );
+ std::string refBufferFilename(name + ".buffer");
+ FILE* fp = fopen(refBufferFilename.c_str(), "rb");
+ AutoCloseFile autoCloseBufferFile(fp);
- if ( fp )
+ if(fp)
{
- fseek( fp, 0, SEEK_END );
- refBufferSize = ftell( fp );
- fseek( fp, 0, SEEK_SET );
- refBuffer = reinterpret_cast<Dali::Integration::PixelBuffer*>( malloc( refBufferSize ) );
- fread( refBuffer, sizeof( Dali::Integration::PixelBuffer ), refBufferSize, fp );
+ fseek(fp, 0, SEEK_END);
+ refBufferSize = ftell(fp);
+ fseek(fp, 0, SEEK_SET);
+ refBuffer = reinterpret_cast<Dali::Integration::PixelBuffer*>(malloc(refBufferSize));
+ fread(refBuffer, sizeof(Dali::Integration::PixelBuffer), refBufferSize, fp);
}
}
-
-LoadFunctions::LoadFunctions( LoadBitmapHeaderFunction _header, LoadBitmapFunction _loader )
-: header( _header ),
- loader( _loader )
+LoadFunctions::LoadFunctions(LoadBitmapHeaderFunction _header, LoadBitmapFunction _loader)
+: header(_header),
+ loader(_loader)
{
}
-void TestImageLoading( const ImageDetails& image, const LoadFunctions& functions, Dali::Integration::Bitmap::Profile bitmapProfile )
+void TestImageLoading(const ImageDetails& image, const LoadFunctions& functions, Dali::Integration::Bitmap::Profile bitmapProfile)
{
- FILE* fp = fopen( image.name.c_str() , "rb" );
- AutoCloseFile autoClose( fp );
- DALI_TEST_CHECK( fp != NULL );
+ FILE* fp = fopen(image.name.c_str(), "rb");
+ AutoCloseFile autoClose(fp);
+ DALI_TEST_CHECK(fp != NULL);
// Check the header file.
- unsigned int width(0), height(0);
- const Dali::ImageLoader::Input input( fp );
- DALI_TEST_CHECK( functions.header( input, width, height ) );
+ unsigned int width(0), height(0);
+ const Dali::ImageLoader::Input input(fp);
+ DALI_TEST_CHECK(functions.header(input, width, height));
- DALI_TEST_EQUALS( width, image.reportedWidth, TEST_LOCATION );
- DALI_TEST_EQUALS( height, image.reportedHeight, TEST_LOCATION );
+ DALI_TEST_EQUALS(width, image.reportedWidth, TEST_LOCATION);
+ DALI_TEST_EQUALS(height, image.reportedHeight, TEST_LOCATION);
// Loading the header moves the pointer within the file so reset to start of file.
- fseek( fp, 0, 0 );
+ fseek(fp, 0, 0);
Dali::Devel::PixelBuffer bitmap;
// Load Bitmap and check its return values.
- DALI_TEST_CHECK( functions.loader( input, bitmap ) );
- DALI_TEST_EQUALS( image.width, bitmap.GetWidth(), TEST_LOCATION );
- DALI_TEST_EQUALS( image.height, bitmap.GetHeight(), TEST_LOCATION );
+ DALI_TEST_CHECK(functions.loader(input, bitmap));
+ DALI_TEST_EQUALS(image.width, bitmap.GetWidth(), TEST_LOCATION);
+ DALI_TEST_EQUALS(image.height, bitmap.GetHeight(), TEST_LOCATION);
// Compare buffer generated with reference buffer.
- Dali::Integration::PixelBuffer* bufferPtr( bitmap.GetBuffer() );
- Dali::Integration::PixelBuffer* refBufferPtr( image.refBuffer );
- for ( unsigned int i = 0; i < image.refBufferSize; ++i, ++bufferPtr, ++refBufferPtr )
+ Dali::Integration::PixelBuffer* bufferPtr(bitmap.GetBuffer());
+ Dali::Integration::PixelBuffer* refBufferPtr(image.refBuffer);
+ for(unsigned int i = 0; i < image.refBufferSize; ++i, ++bufferPtr, ++refBufferPtr)
{
- if( *bufferPtr != *refBufferPtr )
+ if(*bufferPtr != *refBufferPtr)
{
- tet_result( TET_FAIL );
+ tet_result(TET_FAIL);
tet_printf("%s Failed in %s at line %d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__);
break;
}
}
}
-void CompareLoadedImageData( const ImageDetails& image, const LoadFunctions& functions, const uint32_t* master )
+void CompareLoadedImageData(const ImageDetails& image, const LoadFunctions& functions, const uint32_t* master)
{
- FILE* filePointer = fopen( image.name.c_str() , "rb" );
- AutoCloseFile autoClose( filePointer );
- DALI_TEST_CHECK( filePointer != NULL );
+ FILE* filePointer = fopen(image.name.c_str(), "rb");
+ AutoCloseFile autoClose(filePointer);
+ DALI_TEST_CHECK(filePointer != NULL);
// Check the header file.
- unsigned int width = 0, height = 0;
- const Dali::ImageLoader::Input input( filePointer );
- DALI_TEST_CHECK( functions.header( input, width, height ) );
+ unsigned int width = 0, height = 0;
+ const Dali::ImageLoader::Input input(filePointer);
+ DALI_TEST_CHECK(functions.header(input, width, height));
- DALI_TEST_EQUALS( width, image.reportedWidth, TEST_LOCATION );
- DALI_TEST_EQUALS( height, image.reportedHeight, TEST_LOCATION );
+ DALI_TEST_EQUALS(width, image.reportedWidth, TEST_LOCATION);
+ DALI_TEST_EQUALS(height, image.reportedHeight, TEST_LOCATION);
// Loading the header moves the pointer within the file so reset to start of file.
- fseek( filePointer, 0, SEEK_SET );
+ fseek(filePointer, 0, SEEK_SET);
Dali::Devel::PixelBuffer bitmap;
// Load Bitmap and check its return values.
- DALI_TEST_CHECK( functions.loader( input, bitmap ) );
- DALI_TEST_EQUALS( image.width, bitmap.GetWidth(), TEST_LOCATION );
- DALI_TEST_EQUALS( image.height, bitmap.GetHeight(), TEST_LOCATION );
+ DALI_TEST_CHECK(functions.loader(input, bitmap));
+ DALI_TEST_EQUALS(image.width, bitmap.GetWidth(), TEST_LOCATION);
+ DALI_TEST_EQUALS(image.height, bitmap.GetHeight(), TEST_LOCATION);
// Check the bytes per pixel.
- const Pixel::Format pixelFormat = bitmap.GetPixelFormat();
- const unsigned int bytesPerPixel = Pixel::GetBytesPerPixel( pixelFormat );
+ const Pixel::Format pixelFormat = bitmap.GetPixelFormat();
+ const unsigned int bytesPerPixel = Pixel::GetBytesPerPixel(pixelFormat);
// Compare buffer generated with reference buffer.
- Dali::Integration::PixelBuffer* pBitmapData( bitmap.GetBuffer() );
- const uint32_t* pMaster( master );
+ Dali::Integration::PixelBuffer* pBitmapData(bitmap.GetBuffer());
+ const uint32_t* pMaster(master);
// Loop through each pixel in the bitmap.
- for ( unsigned int i = 0; i < image.refBufferSize; ++i, ++pMaster )
+ for(unsigned int i = 0; i < image.refBufferSize; ++i, ++pMaster)
{
unsigned int color = 0;
// Loop through each byte per pixel, to build up a color value for that pixel.
- for( unsigned int j = 0; j < bytesPerPixel; ++j, ++pBitmapData )
+ for(unsigned int j = 0; j < bytesPerPixel; ++j, ++pBitmapData)
{
- color = ( color << 8 ) | *pBitmapData;
+ color = (color << 8) | *pBitmapData;
}
// Check the color value is what we expect.
- DALI_TEST_EQUALS( color, *pMaster, TEST_LOCATION );
+ DALI_TEST_EQUALS(color, *pMaster, TEST_LOCATION);
}
}
-void DumpImageBufferToTempFile( std::string filename, std::string targetFilename, const LoadFunctions& functions )
+void DumpImageBufferToTempFile(std::string filename, std::string targetFilename, const LoadFunctions& functions)
{
- FILE* fp = fopen( filename.c_str() , "rb" );
- AutoCloseFile autoClose( fp );
+ FILE* fp = fopen(filename.c_str(), "rb");
+ AutoCloseFile autoClose(fp);
- Dali::Devel::PixelBuffer bitmap;
- const Dali::ImageLoader::Input input( fp );
+ Dali::Devel::PixelBuffer bitmap;
+ const Dali::ImageLoader::Input input(fp);
- DALI_TEST_CHECK( functions.loader( input, bitmap ) );
+ DALI_TEST_CHECK(functions.loader(input, bitmap));
- Dali::Integration::PixelBuffer* bufferPtr( bitmap.GetBuffer() );
+ Dali::Integration::PixelBuffer* bufferPtr(bitmap.GetBuffer());
- FILE* writeFp = fopen( targetFilename.c_str(), "wb" );
- AutoCloseFile autoCloseWrite( writeFp );
- auto& impl = GetImplementation(bitmap);
- fwrite( bufferPtr, 1, impl.GetBufferSize(), writeFp );
+ FILE* writeFp = fopen(targetFilename.c_str(), "wb");
+ AutoCloseFile autoCloseWrite(writeFp);
+ auto& impl = GetImplementation(bitmap);
+ fwrite(bufferPtr, 1, impl.GetBufferSize(), writeFp);
}
#define DALI_ADAPTOR_TET_IMAGE_LOADERS_H
#include <dali/dali.h>
-#include <dali/integration-api/bitmap.h>
-#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
#include <dali/devel-api/adaptor-framework/image-loader-input.h>
+#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/integration-api/bitmap.h>
// Simple structure to close the file when finished with it.
struct AutoCloseFile
{
- AutoCloseFile( FILE *fp );
+ AutoCloseFile(FILE* fp);
~AutoCloseFile();
FILE* filePtr;
};
* @param[in] _width The width of the image.
* @param[in] _height The height of the image.
*/
- ImageDetails( const char * const _name, unsigned int _width, unsigned int _height );
+ ImageDetails(const char* const _name, unsigned int _width, unsigned int _height);
/**
* Sometimes an image reports an incorrect size in the header than what it actually is. In such a
* @param[in] _reportedWidth The reported width of the image by reading the header.
* @param[in] _reportedHeight The reported height of the image by reading the header.
*/
- ImageDetails( const char * const _name, unsigned int _width, unsigned int _height, unsigned int _reportedWidth, unsigned int _reportedHeight );
+ ImageDetails(const char* const _name, unsigned int _width, unsigned int _height, unsigned int _reportedWidth, unsigned int _reportedHeight);
/**
* Destructor
*/
~ImageDetails();
-
- std::string name;
- unsigned int width;
- unsigned int height;
- unsigned int reportedWidth;
- unsigned int reportedHeight;
- unsigned int refBufferSize;
+ std::string name;
+ unsigned int width;
+ unsigned int height;
+ unsigned int reportedWidth;
+ unsigned int reportedHeight;
+ unsigned int refBufferSize;
Dali::Integration::PixelBuffer* refBuffer;
private:
-
/**
* Loads the reference buffer file.
*/
*/
struct LoadFunctions
{
- typedef bool (*LoadBitmapFunction)( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& );
- typedef bool (*LoadBitmapHeaderFunction)( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height );
+ typedef bool (*LoadBitmapFunction)(const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer&);
+ typedef bool (*LoadBitmapHeaderFunction)(const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height);
- LoadFunctions( LoadBitmapHeaderFunction _header, LoadBitmapFunction _loader );
+ LoadFunctions(LoadBitmapHeaderFunction _header, LoadBitmapFunction _loader);
LoadBitmapHeaderFunction header;
- LoadBitmapFunction loader;
+ LoadBitmapFunction loader;
};
// Helper method to test each image file.
* @param[in] functions The loader functions that need to be called.
* @param[in] bitmapProfile Whether or not the bitmap is raw
*/
-void TestImageLoading( const ImageDetails& image, const LoadFunctions& functions, Dali::Integration::Bitmap::Profile bitmapProfile = Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS );
+void TestImageLoading(const ImageDetails& image, const LoadFunctions& functions, Dali::Integration::Bitmap::Profile bitmapProfile = Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS);
/**
* Helper method to compare the resultant loaded image data of the specified image with a golden master data.
* @param[in] functions The functions to use to load the image
* @param[in] master Golden master data to compare the resultant loaded image with
*/
-void CompareLoadedImageData( const ImageDetails& image, const LoadFunctions& functions, const uint32_t* master );
+void CompareLoadedImageData(const ImageDetails& image, const LoadFunctions& functions, const uint32_t* master);
/**
* Helper function which should be used when first creating a reference buffer file.
* @param[in] targetFilename The path of where the buffer should be written to. This should ideally be in the "/tmp" folder.
* @param[in] functions The loader functions to call.
*/
-void DumpImageBufferToTempFile( std::string filename, std::string targetFilename, const LoadFunctions& functions );
+void DumpImageBufferToTempFile(std::string filename, std::string targetFilename, const LoadFunctions& functions);
#endif // DALI_ADAPTOR_TET_IMAGE_LOADERS_H
-#include <string.h>
#include <getopt.h>
#include <stdlib.h>
+#include <string.h>
#include <test-harness.h>
+
#include "tct-dali-adaptor-internal-core.h"
-int main(int argc, char * const argv[])
+int main(int argc, char* const argv[])
{
int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT;
const char* optString = "sf";
- bool optRerunFailed(true);
- bool optRunSerially(false);
+ bool optRerunFailed(true);
+ bool optRunSerially(false);
int nextOpt = 0;
do
{
- nextOpt = getopt( argc, argv, optString );
+ nextOpt = getopt(argc, argv, optString);
switch(nextOpt)
{
case 'f':
exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT);
break;
}
- } while( nextOpt != -1 );
+ } while(nextOpt != -1);
- if( optind == argc ) // no testcase name in argument list
+ if(optind == argc) // no testcase name in argument list
{
- if( optRunSerially )
+ if(optRunSerially)
{
- result = TestHarness::RunAll( argv[0], tc_array );
+ result = TestHarness::RunAll(argv[0], tc_array);
}
else
{
- result = TestHarness::RunAllInParallel( argv[0], tc_array, optRerunFailed );
+ result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed);
}
}
else
* limitations under the License.
*
*/
-#include <dali/dali.h>
#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
+#include <dali/devel-api/common/addon-binder.h>
#include <dali/integration-api/addon-manager.h>
#include <dali/internal/addons/common/addon-manager-factory.h>
-#include <dali/devel-api/common/addon-binder.h>
std::unique_ptr<Dali::Integration::AddOnManager> CreateAddOnManager()
{
// Set env variables
- setenv( "DALI_ADDONS_PATH", ADDON_LIBS_PATH, 1 );
- setenv( "DALI_ADDONS_LIBS", "libSampleAddOn.so", 1);
+ setenv("DALI_ADDONS_PATH", ADDON_LIBS_PATH, 1);
+ setenv("DALI_ADDONS_LIBS", "libSampleAddOn.so", 1);
- return std::unique_ptr<Dali::Integration::AddOnManager>( Dali::Internal::AddOnManagerFactory::CreateAddOnManager() );
+ return std::unique_ptr<Dali::Integration::AddOnManager>(Dali::Internal::AddOnManagerFactory::CreateAddOnManager());
}
struct TestAddOn : public Dali::AddOn::AddOnBinder
{
- TestAddOn() : AddOnBinder( "SampleAddOn", 0u )
- {}
+ TestAddOn()
+ : AddOnBinder("SampleAddOn", 0u)
+ {
+ }
- ADDON_BIND_FUNCTION( GetLifecycleStatus, bool() );
+ ADDON_BIND_FUNCTION(GetLifecycleStatus, bool());
};
int UtcDaliTestAddOnInterface(void)
TestAddOn addon;
- DALI_TEST_EQUALS( addon.IsValid(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(addon.IsValid(), true, TEST_LOCATION);
const auto& info = addon.GetAddOnInfo();
// Test returned addon version and type
- DALI_TEST_EQUALS( info.version, Dali::DALI_ADDON_VERSION( 1, 0 , 0), TEST_LOCATION );
- DALI_TEST_EQUALS( info.type, Dali::AddOnType::GENERIC, TEST_LOCATION );
+ DALI_TEST_EQUALS(info.version, Dali::DALI_ADDON_VERSION(1, 0, 0), TEST_LOCATION);
+ DALI_TEST_EQUALS(info.type, Dali::AddOnType::GENERIC, TEST_LOCATION);
// Test lifecycle
addOnManager->Pause();
auto result1 = addon.GetLifecycleStatus();
- DALI_TEST_EQUALS( result1, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(result1, true, TEST_LOCATION);
addOnManager->Resume();
auto result2 = addon.GetLifecycleStatus();
- DALI_TEST_EQUALS( result2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(result2, false, TEST_LOCATION);
END_TEST;
}
bool result = addonManager != nullptr;
- DALI_TEST_EQUALS( result, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(result, true, TEST_LOCATION);
auto availableAddons = addonManager->EnumerateAddOns();
// must be 1 addon available
- DALI_TEST_EQUALS( availableAddons.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(availableAddons.size(), 1u, TEST_LOCATION);
Dali::AddOnInfo info{};
- addonManager->GetAddOnInfo( availableAddons[0], info );
+ addonManager->GetAddOnInfo(availableAddons[0], info);
// Test returned addon version and type
- DALI_TEST_EQUALS( info.version, Dali::DALI_ADDON_VERSION( 1, 0 , 0), TEST_LOCATION );
- DALI_TEST_EQUALS( info.type, Dali::AddOnType::GENERIC, TEST_LOCATION );
+ DALI_TEST_EQUALS(info.version, Dali::DALI_ADDON_VERSION(1, 0, 0), TEST_LOCATION);
+ DALI_TEST_EQUALS(info.type, Dali::AddOnType::GENERIC, TEST_LOCATION);
// Get addon handle
- auto testAddon = addonManager->GetAddOn( availableAddons[0] );
- result = testAddon != 0;
- DALI_TEST_EQUALS( result, true, TEST_LOCATION );
+ auto testAddon = addonManager->GetAddOn(availableAddons[0]);
+ result = testAddon != 0;
+ DALI_TEST_EQUALS(result, true, TEST_LOCATION);
// Get addon global function
- auto createInstance = addonManager->GetGlobalProc<void*()>( testAddon, "CreateInstance");
- result = createInstance != nullptr;
- DALI_TEST_EQUALS( result, true, TEST_LOCATION );
+ auto createInstance = addonManager->GetGlobalProc<void*()>(testAddon, "CreateInstance");
+ result = createInstance != nullptr;
+ DALI_TEST_EQUALS(result, true, TEST_LOCATION);
// Test for false positive (queried function must not be found)
- auto dummyfunction = addonManager->GetGlobalProc<void*()>( testAddon, "ThisFunctionDoesntExist");
- result = dummyfunction == nullptr;
- DALI_TEST_EQUALS( result, true, TEST_LOCATION );
+ auto dummyfunction = addonManager->GetGlobalProc<void*()>(testAddon, "ThisFunctionDoesntExist");
+ result = dummyfunction == nullptr;
+ DALI_TEST_EQUALS(result, true, TEST_LOCATION);
// Get Instance function and call it, expect answer 42
- auto instanceFunction = addonManager->GetInstanceProc<uint32_t(void*)>( testAddon, "InstanceCall" );
- auto* instance = createInstance();
- auto answer = instanceFunction( instance );
- DALI_TEST_EQUALS( answer, 42, TEST_LOCATION );
+ auto instanceFunction = addonManager->GetInstanceProc<uint32_t(void*)>(testAddon, "InstanceCall");
+ auto* instance = createInstance();
+ auto answer = instanceFunction(instance);
+ DALI_TEST_EQUALS(answer, 42, TEST_LOCATION);
// Test lifecycle
- auto GetLifecycleStatus = addonManager->GetGlobalProc<bool()>( testAddon, "GetLifecycleStatus");
+ auto GetLifecycleStatus = addonManager->GetGlobalProc<bool()>(testAddon, "GetLifecycleStatus");
addonManager->Pause();
- DALI_TEST_EQUALS( GetLifecycleStatus(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(GetLifecycleStatus(), true, TEST_LOCATION);
addonManager->Resume();
- DALI_TEST_EQUALS( GetLifecycleStatus(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(GetLifecycleStatus(), false, TEST_LOCATION);
END_TEST;
}
\ No newline at end of file
*
*/
-#include <iostream>
-#include <stdlib.h>
#include <dali-test-suite-utils.h>
+#include <stdlib.h>
+#include <iostream>
#include <dali/internal/imaging/common/loader-bmp.h>
#include "image-loaders.h"
namespace
{
-
-static const LoadFunctions BmpLoaders( TizenPlatform::LoadBmpHeader, TizenPlatform::LoadBitmapFromBmp );
+static const LoadFunctions BmpLoaders(TizenPlatform::LoadBmpHeader, TizenPlatform::LoadBitmapFromBmp);
} // Unnamed namespace.
int UtcDaliBmp24bpp(void)
{
- ImageDetails image( TEST_IMAGE_DIR "/flag-24bpp.bmp", 32u, 32u );
+ ImageDetails image(TEST_IMAGE_DIR "/flag-24bpp.bmp", 32u, 32u);
- TestImageLoading( image, BmpLoaders );
+ TestImageLoading(image, BmpLoaders);
END_TEST;
}
-
#include <iostream>
-#include <stdlib.h>
-#include <getopt.h>
+#include <dali-test-suite-utils.h>
#include <dali/dali.h>
#include <dali/internal/system/common/command-line-options.h>
-#include <dali-test-suite-utils.h>
+#include <getopt.h>
+#include <stdlib.h>
using namespace Dali;
using namespace Dali::Internal::Adaptor;
-
// Called only once before first test is run.
void command_line_options_startup(void)
{
test_return_value = TET_UNDEF;
- optind = 0; // Reset opt for test
+ optind = 0; // Reset opt for test
}
// Called only once after last test is run
int UtcDaliCommandLineOptionsNoArgs(void)
{
- optind=0;
+ optind = 0;
- int argc( 1 );
- const char* argList[1] = { "program" };
- char** argv = const_cast<char**>(argList);
+ int argc(1);
+ const char* argList[1] = {"program"};
+ char** argv = const_cast<char**>(argList);
- CommandLineOptions options( &argc, &argv );
+ CommandLineOptions options(&argc, &argv);
- DALI_TEST_EQUALS( argc, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(argc, 1, TEST_LOCATION);
// Check values
- DALI_TEST_EQUALS( options.stageWidth, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( options.stageHeight, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( options.stageDPI, "", TEST_LOCATION );
+ DALI_TEST_EQUALS(options.stageWidth, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(options.stageHeight, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(options.stageDPI, "", TEST_LOCATION);
END_TEST;
}
int UtcDaliCommandLineOptionsDaliShortArgs(void)
{
- optind=0;
+ optind = 0;
const char* argList[] =
- {
+ {
"program",
- "-w", "800",
- "-h", "1000",
- "-d", "4x5",
- };
- int argc( sizeof( argList ) / sizeof( argList[0] ) );
+ "-w",
+ "800",
+ "-h",
+ "1000",
+ "-d",
+ "4x5",
+ };
+ int argc(sizeof(argList) / sizeof(argList[0]));
char** argv = const_cast<char**>(argList);
- CommandLineOptions options( &argc, &argv );
+ CommandLineOptions options(&argc, &argv);
// Should strip out the height and width
- DALI_TEST_EQUALS( argc, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(argc, 1, TEST_LOCATION);
// Check values
- DALI_TEST_EQUALS( options.stageWidth, 800, TEST_LOCATION );
- DALI_TEST_EQUALS( options.stageHeight, 1000, TEST_LOCATION );
- DALI_TEST_EQUALS( options.stageDPI, "4x5", TEST_LOCATION );
+ DALI_TEST_EQUALS(options.stageWidth, 800, TEST_LOCATION);
+ DALI_TEST_EQUALS(options.stageHeight, 1000, TEST_LOCATION);
+ DALI_TEST_EQUALS(options.stageDPI, "4x5", TEST_LOCATION);
END_TEST;
}
int UtcDaliCommandLineOptionsDaliLongArgsEqualsSign(void)
{
- optind=0;
+ optind = 0;
const char* argList[] =
- {
+ {
"program",
"--width=800",
"--height=1000",
"--dpi=3x4",
- "--help"
- };
- int argc( sizeof( argList ) / sizeof( argList[0] ) );
+ "--help"};
+ int argc(sizeof(argList) / sizeof(argList[0]));
char** argv = const_cast<char**>(argList);
- CommandLineOptions options( &argc, &argv );
+ CommandLineOptions options(&argc, &argv);
// Should strip out the height and width
- DALI_TEST_EQUALS( argc, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(argc, 1, TEST_LOCATION);
// Check values
- DALI_TEST_EQUALS( options.stageWidth, 800, TEST_LOCATION );
- DALI_TEST_EQUALS( options.stageHeight, 1000, TEST_LOCATION );
- DALI_TEST_EQUALS( options.stageDPI, "3x4", TEST_LOCATION );
+ DALI_TEST_EQUALS(options.stageWidth, 800, TEST_LOCATION);
+ DALI_TEST_EQUALS(options.stageHeight, 1000, TEST_LOCATION);
+ DALI_TEST_EQUALS(options.stageDPI, "3x4", TEST_LOCATION);
END_TEST;
}
int UtcDaliCommandLineOptionsDaliLongArgsSpaces(void)
{
- optind=0;
+ optind = 0;
const char* argList[] =
- {
+ {
"program",
- "--width", "800",
- "--height", "1000",
- "--dpi", "3x4",
- "--help"
- };
- int argc( sizeof( argList ) / sizeof( argList[0] ) );
+ "--width",
+ "800",
+ "--height",
+ "1000",
+ "--dpi",
+ "3x4",
+ "--help"};
+ int argc(sizeof(argList) / sizeof(argList[0]));
char** argv = const_cast<char**>(argList);
- CommandLineOptions options( &argc, &argv );
+ CommandLineOptions options(&argc, &argv);
// Should strip out the height and width
- DALI_TEST_EQUALS( argc, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(argc, 1, TEST_LOCATION);
// Check values
- DALI_TEST_EQUALS( options.stageWidth, 800, TEST_LOCATION );
- DALI_TEST_EQUALS( options.stageHeight, 1000, TEST_LOCATION );
- DALI_TEST_EQUALS( options.stageDPI, "3x4", TEST_LOCATION );
+ DALI_TEST_EQUALS(options.stageWidth, 800, TEST_LOCATION);
+ DALI_TEST_EQUALS(options.stageHeight, 1000, TEST_LOCATION);
+ DALI_TEST_EQUALS(options.stageDPI, "3x4", TEST_LOCATION);
END_TEST;
}
int UtcDaliCommandLineOptionsNonDaliArgs(void)
{
- optind=0;
+ optind = 0;
const char* argList[] =
- {
+ {
"program",
"hello-world",
- "-y", "600",
- };
- int argc( sizeof( argList ) / sizeof( argList[0] ) );
+ "-y",
+ "600",
+ };
+ int argc(sizeof(argList) / sizeof(argList[0]));
char** argv = const_cast<char**>(argList);
- CommandLineOptions options( &argc, &argv );
+ CommandLineOptions options(&argc, &argv);
// Should still be the same
- DALI_TEST_EQUALS( argc, 4, TEST_LOCATION );
+ DALI_TEST_EQUALS(argc, 4, TEST_LOCATION);
// Ensure order has not changed
- DALI_TEST_EQUALS( argList[0], "program", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[1], "hello-world", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[2], "-y", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[3], "600", TEST_LOCATION );
+ DALI_TEST_EQUALS(argList[0], "program", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[1], "hello-world", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[2], "-y", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[3], "600", TEST_LOCATION);
END_TEST;
}
optind = 0; // Reset opt for test
const char* argList[] =
- {
- "program",
- "--width=800",
- "hello-world",
- "-y", "600",
- "--height", "1000",
- "-r",
- };
- int argc( sizeof( argList ) / sizeof( argList[0] ) );
- char** argv = const_cast<char**>( argList );
-
- CommandLineOptions options( &argc, &argv );
+ {
+ "program",
+ "--width=800",
+ "hello-world",
+ "-y",
+ "600",
+ "--height",
+ "1000",
+ "-r",
+ };
+ int argc(sizeof(argList) / sizeof(argList[0]));
+ char** argv = const_cast<char**>(argList);
+
+ CommandLineOptions options(&argc, &argv);
// Should still be the same
- DALI_TEST_EQUALS( argc, 5, TEST_LOCATION );
+ DALI_TEST_EQUALS(argc, 5, TEST_LOCATION);
// Ensure order of program name and unhandled options has not changed
- DALI_TEST_EQUALS( argList[0], "program", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[1], "hello-world", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[2], "-y", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[3], "600", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[4], "-r", TEST_LOCATION );
+ DALI_TEST_EQUALS(argList[0], "program", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[1], "hello-world", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[2], "-y", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[3], "600", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[4], "-r", TEST_LOCATION);
END_TEST;
}
int UtcDaliCommandLineOptionsMixtureDaliOpsAtStart(void)
{
- optind=0;
+ optind = 0;
const char* argList[] =
- {
+ {
"program",
"--width=800",
- "--height", "1000",
+ "--height",
+ "1000",
"-r",
"hello-world",
- "-y", "600",
- };
- int argc( sizeof( argList ) / sizeof( argList[0] ) );
- char** argv = const_cast<char**>( argList );
+ "-y",
+ "600",
+ };
+ int argc(sizeof(argList) / sizeof(argList[0]));
+ char** argv = const_cast<char**>(argList);
- CommandLineOptions options( &argc, &argv );
+ CommandLineOptions options(&argc, &argv);
// Should still be the same
- DALI_TEST_EQUALS( argc, 5, TEST_LOCATION );
+ DALI_TEST_EQUALS(argc, 5, TEST_LOCATION);
// Ensure order of program name and unhandled options has not changed
- DALI_TEST_EQUALS( argList[0], "program", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[1], "-r", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[2], "hello-world", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[3], "-y", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[4], "600", TEST_LOCATION );
+ DALI_TEST_EQUALS(argList[0], "program", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[1], "-r", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[2], "hello-world", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[3], "-y", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[4], "600", TEST_LOCATION);
END_TEST;
}
int UtcDaliCommandLineOptionsMixtureDaliOpsAtEnd(void)
{
- optind=0;
+ optind = 0;
const char* argList[] =
- {
+ {
"program",
"hello-world",
- "-y", "600",
+ "-y",
+ "600",
"-r",
"--width=800",
- "--height", "1000",
- };
- int argc( sizeof( argList ) / sizeof( argList[0] ) );
- char** argv = const_cast<char**>( argList );
+ "--height",
+ "1000",
+ };
+ int argc(sizeof(argList) / sizeof(argList[0]));
+ char** argv = const_cast<char**>(argList);
- CommandLineOptions options( &argc, &argv );
+ CommandLineOptions options(&argc, &argv);
// Should still be the same
- DALI_TEST_EQUALS( argc, 5, TEST_LOCATION );
+ DALI_TEST_EQUALS(argc, 5, TEST_LOCATION);
// Ensure order of program name and unhandled options has not changed
- DALI_TEST_EQUALS( argList[0], "program", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[1], "hello-world", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[2], "-y", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[3], "600", TEST_LOCATION );
- DALI_TEST_EQUALS( argList[4], "-r", TEST_LOCATION );
+ DALI_TEST_EQUALS(argList[0], "program", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[1], "hello-world", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[2], "-y", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[3], "600", TEST_LOCATION);
+ DALI_TEST_EQUALS(argList[4], "-r", TEST_LOCATION);
END_TEST;
}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// EXTERNAL INCLUDES
-#include <iostream>
-#include <stdlib.h>
-#include <vector>
#include <dali-test-suite-utils.h>
-#include <dali/internal/imaging/common/loader-ktx.h>
#include <dali/internal/imaging/common/loader-astc.h>
+#include <dali/internal/imaging/common/loader-ktx.h>
+#include <stdlib.h>
+#include <iostream>
+#include <vector>
// INTERNAL INCLUDES
#include "image-loaders.h"
using namespace Dali;
// Pre-define loader functions for each image type being tested (as they are reused in different tests).
-static const LoadFunctions KtxLoaders( TizenPlatform::LoadKtxHeader, TizenPlatform::LoadBitmapFromKtx );
-static const LoadFunctions AstcLoaders( TizenPlatform::LoadAstcHeader, TizenPlatform::LoadBitmapFromAstc );
+static const LoadFunctions KtxLoaders(TizenPlatform::LoadKtxHeader, TizenPlatform::LoadBitmapFromKtx);
+static const LoadFunctions AstcLoaders(TizenPlatform::LoadAstcHeader, TizenPlatform::LoadBitmapFromAstc);
/**
* This class encapsulates knowledge of testing compressed files.
*/
class KtxTestFixture
{
- public:
-
- /**
+public:
+ /**
* Constructor.
* Sets up the fixture.
*/
- KtxTestFixture( void )
- {
- }
+ KtxTestFixture(void)
+ {
+ }
- /**
+ /**
* Destructor.
*/
- ~KtxTestFixture()
- {
- }
+ ~KtxTestFixture()
+ {
+ }
- /**
+ /**
* This struct contains any per-test parameters.
* This should be added to if more properties of a file/format should be tested.
*/
- struct TestEntry
+ struct TestEntry
+ {
+ LoadFunctions loadFunctions; ///< Used to parse the header of a given type of image.
+ std::string filename; ///< Name of the compressed texture KTX file to load.
+ int expectedWidth; ///< The width the texture should be.
+ int expectedHeight; ///< The height the KTX texture should be.
+
+ TestEntry(const LoadFunctions& newLoadFunctions, std::string newFilename, int newExpectedWidth, int newExpectedHeight)
+ : loadFunctions(newLoadFunctions),
+ filename(newFilename),
+ expectedWidth(newExpectedWidth),
+ expectedHeight(newExpectedHeight)
{
- LoadFunctions loadFunctions; ///< Used to parse the header of a given type of image.
- std::string filename; ///< Name of the compressed texture KTX file to load.
- int expectedWidth; ///< The width the texture should be.
- int expectedHeight; ///< The height the KTX texture should be.
-
- TestEntry( const LoadFunctions& newLoadFunctions, std::string newFilename, int newExpectedWidth, int newExpectedHeight )
- : loadFunctions( newLoadFunctions ),
- filename( newFilename ),
- expectedWidth( newExpectedWidth ),
- expectedHeight( newExpectedHeight )
- {
- }
- };
-
- private:
-
- typedef std::vector< TestEntry > TestContainer;
+ }
+ };
- public:
+private:
+ typedef std::vector<TestEntry> TestContainer;
- /**
+public:
+ /**
* Adds a test to be performed.
* @param[in] testEntry A TestEntry struct containing all the details to perform one test.
*/
- void AddTest( TestEntry testEntry )
- {
- mTests.push_back( testEntry );
- }
+ void AddTest(TestEntry testEntry)
+ {
+ mTests.push_back(testEntry);
+ }
- /**
+ /**
* Runs all tests created with "AddTest".
* This will create failures upon failing tests.
*/
- void RunTests()
+ void RunTests()
+ {
+ for(TestContainer::iterator testIterator = mTests.begin(); testIterator != mTests.end(); ++testIterator)
{
- for( TestContainer::iterator testIterator = mTests.begin(); testIterator != mTests.end(); ++testIterator )
- {
- const TestEntry& currentTest = *testIterator;
+ const TestEntry& currentTest = *testIterator;
- RunTest( currentTest );
- }
+ RunTest(currentTest);
}
+ }
- private:
-
- /**
+private:
+ /**
* Sets up, Runs and Closes-down an individual test.
* @param[in] testEntry A TestEntry struct containing all the details to perform one test.
*/
- void RunTest( const TestEntry& testEntry )
- {
- FILE* fileDescriptor = fopen( testEntry.filename.c_str(), "rb" );
- AutoCloseFile autoClose( fileDescriptor );
- DALI_TEST_CHECK( fileDescriptor != NULL );
-
- // Check the header file.
- unsigned int width( 0 ), height( 0 );
- const Dali::ImageLoader::Input input( fileDescriptor );
-
- // Use the given loader to parse the image header.
- DALI_TEST_CHECK( testEntry.loadFunctions.header( input, width, height ) );
+ void RunTest(const TestEntry& testEntry)
+ {
+ FILE* fileDescriptor = fopen(testEntry.filename.c_str(), "rb");
+ AutoCloseFile autoClose(fileDescriptor);
+ DALI_TEST_CHECK(fileDescriptor != NULL);
- DALI_TEST_EQUALS( width, testEntry.expectedWidth, TEST_LOCATION );
- DALI_TEST_EQUALS( height, testEntry.expectedHeight, TEST_LOCATION );
- }
+ // Check the header file.
+ unsigned int width(0), height(0);
+ const Dali::ImageLoader::Input input(fileDescriptor);
- private:
+ // Use the given loader to parse the image header.
+ DALI_TEST_CHECK(testEntry.loadFunctions.header(input, width, height));
- TestContainer mTests; ///< Holds all tests to be run.
+ DALI_TEST_EQUALS(width, testEntry.expectedWidth, TEST_LOCATION);
+ DALI_TEST_EQUALS(height, testEntry.expectedHeight, TEST_LOCATION);
+ }
+private:
+ TestContainer mTests; ///< Holds all tests to be run.
};
// KTX files (KTX is a wrapper, so can contain different compressed texture types):
{
KtxTestFixture fixture;
- fixture.AddTest( KtxTestFixture::TestEntry( KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-ETC1_RGB8_OES-45x80.ktx", 45u, 80u ) );
- fixture.AddTest( KtxTestFixture::TestEntry( KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-RGB8_ETC2-45x80.ktx", 45u, 80u ) );
+ fixture.AddTest(KtxTestFixture::TestEntry(KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-ETC1_RGB8_OES-45x80.ktx", 45u, 80u));
+ fixture.AddTest(KtxTestFixture::TestEntry(KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-RGB8_ETC2-45x80.ktx", 45u, 80u));
fixture.RunTests();
{
KtxTestFixture fixture;
- fixture.AddTest( KtxTestFixture::TestEntry( KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-RGB_PVRTC_4BPPV1_IMG-32x64.ktx", 32u, 64u ) );
+ fixture.AddTest(KtxTestFixture::TestEntry(KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-RGB_PVRTC_4BPPV1_IMG-32x64.ktx", 32u, 64u));
fixture.RunTests();
{
KtxTestFixture fixture;
- fixture.AddTest( KtxTestFixture::TestEntry( KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-R11_EAC-45x80.ktx", 45u, 80u ) );
+ fixture.AddTest(KtxTestFixture::TestEntry(KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-R11_EAC-45x80.ktx", 45u, 80u));
fixture.RunTests();
{
KtxTestFixture fixture;
- fixture.AddTest( KtxTestFixture::TestEntry( KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-RGBA_ASTC_4x4_KHR-32x64.ktx", 32u, 64u ) );
- fixture.AddTest( KtxTestFixture::TestEntry( KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-SRBG8_ALPHA8_ASTC_4x4_KHR-32x64.ktx", 32u, 64u ) );
+ fixture.AddTest(KtxTestFixture::TestEntry(KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-RGBA_ASTC_4x4_KHR-32x64.ktx", 32u, 64u));
+ fixture.AddTest(KtxTestFixture::TestEntry(KtxLoaders, TEST_IMAGE_DIR "/fractal-compressed-SRBG8_ALPHA8_ASTC_4x4_KHR-32x64.ktx", 32u, 64u));
fixture.RunTests();
END_TEST;
}
-
// ASTC (Native) files:
int UtcDaliAstcLoader(void)
{
KtxTestFixture fixture;
- fixture.AddTest( KtxTestFixture::TestEntry( AstcLoaders, TEST_IMAGE_DIR "/fractal-compressed-RGBA_ASTC_4x4_KHR-32x64.astc", 32u, 64u ) );
+ fixture.AddTest(KtxTestFixture::TestEntry(AstcLoaders, TEST_IMAGE_DIR "/fractal-compressed-RGBA_ASTC_4x4_KHR-32x64.astc", 32u, 64u));
fixture.RunTests();
END_TEST;
}
-
#include <iostream>
-#include <stdlib.h>
-#include <stdint.h>
-#include <dali/dali.h>
#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
#include <dali/internal/text/text-abstraction/font-client-helper.h>
+#include <stdint.h>
+#include <stdlib.h>
using namespace Dali;
int UtcDaliFontClient(void)
{
- const int ORDERED_VALUES[] = { -1, 50, 63, 75, 87, 100, 113, 125, 150, 200 };
+ const int ORDERED_VALUES[] = {-1, 50, 63, 75, 87, 100, 113, 125, 150, 200};
- const unsigned int NUM_OF_ORDERED_VALUES = sizeof( ORDERED_VALUES ) / sizeof( int );
+ const unsigned int NUM_OF_ORDERED_VALUES = sizeof(ORDERED_VALUES) / sizeof(int);
TestApplication application;
- int result=0;
+ int result = 0;
tet_infoline("UtcDaliFontClient No table");
- result = TextAbstraction::Internal::ValueToIndex( 100, NULL, 0u );
- DALI_TEST_EQUALS( -1, result, TEST_LOCATION );
+ result = TextAbstraction::Internal::ValueToIndex(100, NULL, 0u);
+ DALI_TEST_EQUALS(-1, result, TEST_LOCATION);
tet_infoline("UtcDaliFontClient Non defined values");
- result = TextAbstraction::Internal::ValueToIndex( -1, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 0, result, TEST_LOCATION );
- result = TextAbstraction::Internal::ValueToIndex( -3, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 0, result, TEST_LOCATION );
+ result = TextAbstraction::Internal::ValueToIndex(-1, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(0, result, TEST_LOCATION);
+ result = TextAbstraction::Internal::ValueToIndex(-3, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(0, result, TEST_LOCATION);
tet_infoline("UtcDaliFontClient Between non defined and first of range.");
- result = TextAbstraction::Internal::ValueToIndex( 0, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 1, result, TEST_LOCATION );
- result = TextAbstraction::Internal::ValueToIndex( 30, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 1, result, TEST_LOCATION );
- result = TextAbstraction::Internal::ValueToIndex( 49, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 1, result, TEST_LOCATION );
+ result = TextAbstraction::Internal::ValueToIndex(0, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(1, result, TEST_LOCATION);
+ result = TextAbstraction::Internal::ValueToIndex(30, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(1, result, TEST_LOCATION);
+ result = TextAbstraction::Internal::ValueToIndex(49, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(1, result, TEST_LOCATION);
tet_infoline("UtcDaliFontClient Defined in range");
- for( unsigned int index = 1u; index < NUM_OF_ORDERED_VALUES; ++index )
+ for(unsigned int index = 1u; index < NUM_OF_ORDERED_VALUES; ++index)
{
- result = TextAbstraction::Internal::ValueToIndex( ORDERED_VALUES[index], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( index, result, TEST_LOCATION );
+ result = TextAbstraction::Internal::ValueToIndex(ORDERED_VALUES[index], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(index, result, TEST_LOCATION);
}
tet_infoline("UtcDaliFontClient Non defined in range");
- result = TextAbstraction::Internal::ValueToIndex( 51, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 1, result, TEST_LOCATION );
- result = TextAbstraction::Internal::ValueToIndex( 55, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 1, result, TEST_LOCATION );
- result = TextAbstraction::Internal::ValueToIndex( 62, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 2, result, TEST_LOCATION );
- result = TextAbstraction::Internal::ValueToIndex( 64, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 2, result, TEST_LOCATION );
- result = TextAbstraction::Internal::ValueToIndex( 151, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 8, result, TEST_LOCATION );
- result = TextAbstraction::Internal::ValueToIndex( 175, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 9, result, TEST_LOCATION );
- result = TextAbstraction::Internal::ValueToIndex( 176, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 9, result, TEST_LOCATION );
- result = TextAbstraction::Internal::ValueToIndex( 199, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 9, result, TEST_LOCATION );
+ result = TextAbstraction::Internal::ValueToIndex(51, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(1, result, TEST_LOCATION);
+ result = TextAbstraction::Internal::ValueToIndex(55, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(1, result, TEST_LOCATION);
+ result = TextAbstraction::Internal::ValueToIndex(62, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(2, result, TEST_LOCATION);
+ result = TextAbstraction::Internal::ValueToIndex(64, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(2, result, TEST_LOCATION);
+ result = TextAbstraction::Internal::ValueToIndex(151, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(8, result, TEST_LOCATION);
+ result = TextAbstraction::Internal::ValueToIndex(175, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(9, result, TEST_LOCATION);
+ result = TextAbstraction::Internal::ValueToIndex(176, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(9, result, TEST_LOCATION);
+ result = TextAbstraction::Internal::ValueToIndex(199, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(9, result, TEST_LOCATION);
tet_infoline("UtcDaliFontClient above of range");
- result = TextAbstraction::Internal::ValueToIndex( 220, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 9, result, TEST_LOCATION );
- result = TextAbstraction::Internal::ValueToIndex( 500, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u );
- DALI_TEST_EQUALS( 9, result, TEST_LOCATION );
+ result = TextAbstraction::Internal::ValueToIndex(220, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(9, result, TEST_LOCATION);
+ result = TextAbstraction::Internal::ValueToIndex(500, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u);
+ DALI_TEST_EQUALS(9, result, TEST_LOCATION);
END_TEST;
}
-
-
*
*/
-#include <iostream>
-#include <stdlib.h>
#include <dali-test-suite-utils.h>
+#include <stdlib.h>
+#include <iostream>
#include <dali/internal/imaging/common/loader-gif.h>
#include "image-loaders.h"
using namespace Dali;
-namespace {
-static const LoadFunctions GifLoaders( TizenPlatform::LoadGifHeader, TizenPlatform::LoadBitmapFromGif );
+namespace
+{
+static const LoadFunctions GifLoaders(TizenPlatform::LoadGifHeader, TizenPlatform::LoadBitmapFromGif);
}
-
void gif_loader_startup(void)
{
}
int UtcDaliGifLoaderInterlaced(void)
{
- ImageDetails interlaced( TEST_IMAGE_DIR "/interlaced.gif", 365u, 227u );
- TestImageLoading( interlaced, GifLoaders );
+ ImageDetails interlaced(TEST_IMAGE_DIR "/interlaced.gif", 365u, 227u);
+ TestImageLoading(interlaced, GifLoaders);
END_TEST;
}
int UtcDaliGifLoaderErrorBits(void)
{
- ImageDetails errorBits( TEST_IMAGE_DIR "/error-bits.gif", 534u, 749u, 1280u, 1024u );
- TestImageLoading( errorBits, GifLoaders );
+ ImageDetails errorBits(TEST_IMAGE_DIR "/error-bits.gif", 534u, 749u, 1280u, 1024u);
+ TestImageLoading(errorBits, GifLoaders);
END_TEST;
}
int UtcDaliGifLoaderPattern(void)
{
- ImageDetails pattern( TEST_IMAGE_DIR "/pattern.gif", 600u, 600u );
- TestImageLoading( pattern, GifLoaders );
+ ImageDetails pattern(TEST_IMAGE_DIR "/pattern.gif", 600u, 600u);
+ TestImageLoading(pattern, GifLoaders);
END_TEST;
}
int UtcDaliGifLoaderTransparency(void)
{
- ImageDetails transparency( TEST_IMAGE_DIR "/transparency.gif", 320u, 280u );
- TestImageLoading( transparency, GifLoaders );
+ ImageDetails transparency(TEST_IMAGE_DIR "/transparency.gif", 320u, 280u);
+ TestImageLoading(transparency, GifLoaders);
END_TEST;
}
*
*/
-#include <iostream>
-#include <stdlib.h>
#include <dali-test-suite-utils.h>
+#include <stdlib.h>
+#include <iostream>
#include <dali/internal/imaging/common/loader-ico.h>
#include "image-loaders.h"
namespace
{
-
-static const LoadFunctions IcoLoaders( TizenPlatform::LoadIcoHeader, TizenPlatform::LoadBitmapFromIco );
-
+static const LoadFunctions IcoLoaders(TizenPlatform::LoadIcoHeader, TizenPlatform::LoadBitmapFromIco);
// Golden master image data for each icon type:
// Note: The bottom right corner of each image is fully transparent.
// Causing no image degradation.
uint32_t ImageCheckData_Ico4x4_32bpp_8alpha[] = {
- 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff,
- 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff,
- 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff,
- 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000
-};
+ 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff, 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff, 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff, 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000};
uint32_t ImageCheckData_Ico4x4_24bpp[] = {
- 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff,
- 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff,
- 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff,
- 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000
-};
+ 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff, 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff, 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff, 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000};
uint32_t ImageCheckData_Ico4x4_8bpp[] = {
- 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff,
- 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff,
- 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff,
- 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000
-};
+ 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff, 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff, 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff, 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000};
uint32_t ImageCheckData_Ico4x4_4bpp[] = {
- 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff,
- 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff,
- 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff,
- 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000
-};
+ 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff, 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff, 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff, 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000};
uint32_t ImageCheckData_Ico4x4_1bpp[] = {
- 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff,
- 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff,
- 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff,
- 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA1878300
-};
-
+ 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA1878300};
} // Unnamed namespace.
-
int UtcDaliIco32bpp8alpha(void)
{
- ImageDetails image( TEST_IMAGE_DIR "/test-image-4x4-32bpp.ico", 4u, 4u );
+ ImageDetails image(TEST_IMAGE_DIR "/test-image-4x4-32bpp.ico", 4u, 4u);
- CompareLoadedImageData( image, IcoLoaders, ImageCheckData_Ico4x4_32bpp_8alpha );
+ CompareLoadedImageData(image, IcoLoaders, ImageCheckData_Ico4x4_32bpp_8alpha);
END_TEST;
}
-
int UtcDaliIco24bpp1alpha(void)
{
- ImageDetails image( TEST_IMAGE_DIR "/test-image-4x4-24bpp.ico", 4u, 4u );
+ ImageDetails image(TEST_IMAGE_DIR "/test-image-4x4-24bpp.ico", 4u, 4u);
- CompareLoadedImageData( image, IcoLoaders, ImageCheckData_Ico4x4_24bpp );
+ CompareLoadedImageData(image, IcoLoaders, ImageCheckData_Ico4x4_24bpp);
END_TEST;
}
-
int UtcDaliIco8bpp1alpha(void)
{
- ImageDetails image( TEST_IMAGE_DIR "/test-image-4x4-8bpp.ico", 4u, 4u );
+ ImageDetails image(TEST_IMAGE_DIR "/test-image-4x4-8bpp.ico", 4u, 4u);
- CompareLoadedImageData( image, IcoLoaders, ImageCheckData_Ico4x4_8bpp );
+ CompareLoadedImageData(image, IcoLoaders, ImageCheckData_Ico4x4_8bpp);
END_TEST;
}
-
int UtcDaliIco4bpp1alpha(void)
{
- ImageDetails image( TEST_IMAGE_DIR "/test-image-4x4-4bpp.ico", 4u, 4u );
+ ImageDetails image(TEST_IMAGE_DIR "/test-image-4x4-4bpp.ico", 4u, 4u);
- CompareLoadedImageData( image, IcoLoaders, ImageCheckData_Ico4x4_4bpp );
+ CompareLoadedImageData(image, IcoLoaders, ImageCheckData_Ico4x4_4bpp);
END_TEST;
}
-
int UtcDaliIco1bpp1alpha(void)
{
- ImageDetails image( TEST_IMAGE_DIR "/test-image-4x4-1bpp.ico", 4u, 4u );
+ ImageDetails image(TEST_IMAGE_DIR "/test-image-4x4-1bpp.ico", 4u, 4u);
- CompareLoadedImageData( image, IcoLoaders, ImageCheckData_Ico4x4_1bpp );
+ CompareLoadedImageData(image, IcoLoaders, ImageCheckData_Ico4x4_1bpp);
END_TEST;
}
-
-
-
*/
#include <dali-test-suite-utils.h>
-#include <dali/internal/imaging/common/image-operations.h>
#include <dali/devel-api/common/ref-counted-dali-vector.h>
+#include <dali/internal/imaging/common/image-operations.h>
#include <sys/mman.h>
#include <unistd.h>
namespace
{
-
/**
* @brief Generate a random integer between zero and the parameter passed in.
**/
-uint32_t RandomInRange( uint32_t max )
+uint32_t RandomInRange(uint32_t max)
{
const uint32_t randToMax = lrand48() % (max + 1);
return randToMax;
*/
inline uint32_t RandomComponent8()
{
- return RandomInRange( 255u );
+ return RandomInRange(255u);
}
/**
*/
inline uint32_t RandomComponent5()
{
- return RandomInRange( 31u );
+ return RandomInRange(31u);
}
/**
*/
inline uint32_t RandomComponent6()
{
- return RandomInRange( 63u );
+ return RandomInRange(63u);
}
/**
* @brief RGBA8888 Pixels from separate color components.
*/
-inline uint32_t PixelRGBA8888( uint32_t r, uint32_t g, uint32_t b, uint32_t a )
+inline uint32_t PixelRGBA8888(uint32_t r, uint32_t g, uint32_t b, uint32_t a)
{
return (r << 24) + (g << 16) + (b << 8) + a;
}
/**
* @brief RGB565 Pixels from color components in the low bits of passed-in words.
*/
-inline uint16_t PixelRGB565( uint32_t r, uint32_t g, uint32_t b )
+inline uint16_t PixelRGB565(uint32_t r, uint32_t g, uint32_t b)
{
return (r << 11) + (g << 5) + b;
}
/**
* @brief RGBA8888 Pixels with random color components.
*/
-inline uint32_t RandomPixelRGBA8888( )
+inline uint32_t RandomPixelRGBA8888()
{
- const uint32_t randomPixel = PixelRGBA8888( RandomComponent8(), RandomComponent8(), RandomComponent8(), RandomComponent8() );
+ const uint32_t randomPixel = PixelRGBA8888(RandomComponent8(), RandomComponent8(), RandomComponent8(), RandomComponent8());
return randomPixel;
}
* Used to check a buffer of pixels is unmodified by an operation given inputs
* that should mean that it is not changed.
*/
-inline uint32_t HashPixels( const uint32_t* const pixels, unsigned int numPixels )
+inline uint32_t HashPixels(const uint32_t* const pixels, unsigned int numPixels)
{
uint32_t hash = 5381;
- for( unsigned int i = 0; i < numPixels; ++i )
+ for(unsigned int i = 0; i < numPixels; ++i)
{
hash = hash * 33 + pixels[i];
}
/**
* @brief Build some dummy scanlines to exercise scanline averaging code on.
*/
-void SetupScanlineForHalvingTestsRGBA8888( size_t scanlineLength, Dali::Vector<uint32_t>& scanline, Dali::Vector<uint32_t>& reference )
+void SetupScanlineForHalvingTestsRGBA8888(size_t scanlineLength, Dali::Vector<uint32_t>& scanline, Dali::Vector<uint32_t>& reference)
{
- scanline.Resize( scanlineLength );
- reference.Reserve( scanlineLength / 2 + 32 );
+ scanline.Resize(scanlineLength);
+ reference.Reserve(scanlineLength / 2 + 32);
// Prepare some random pixels:
- srand( 19 * 23 * 47 * 53 );
- for( size_t i = 0; i < scanlineLength / 2; ++i )
+ srand(19 * 23 * 47 * 53);
+ for(size_t i = 0; i < scanlineLength / 2; ++i)
{
// Generate random colors:
const uint32_t red1 = RandomComponent8();
const uint32_t alpha2 = RandomComponent8();
// The average of these pixels should equal the reference:
- scanline[i * 2] = PixelRGBA8888( red1, green1, blue1, alpha1 );
- scanline[i * 2 + 1] = PixelRGBA8888( red2, green2, blue2, alpha2 );
+ scanline[i * 2] = PixelRGBA8888(red1, green1, blue1, alpha1);
+ scanline[i * 2 + 1] = PixelRGBA8888(red2, green2, blue2, alpha2);
// Average the two pixels manually as a reference:
- reference.PushBack( PixelRGBA8888( (red1 + red2) >> 1u, (green1 + green2) >> 1u, (blue1 + blue2) >> 1u, (alpha1 + alpha2) >> 1u ) );
+ reference.PushBack(PixelRGBA8888((red1 + red2) >> 1u, (green1 + green2) >> 1u, (blue1 + blue2) >> 1u, (alpha1 + alpha2) >> 1u));
}
- for( size_t i = scanlineLength / 2; i < reference.Capacity(); ++i )
+ for(size_t i = scanlineLength / 2; i < reference.Capacity(); ++i)
{
reference[i] = 0xEEEEEEEE;
}
/**
* @brief Build some dummy scanlines to exercise scanline averaging code on.
*/
-void SetupScanlineForHalvingTestsRGB565( size_t scanlineLength, Dali::Vector<uint16_t>& scanline, Dali::Vector<uint16_t>& reference )
+void SetupScanlineForHalvingTestsRGB565(size_t scanlineLength, Dali::Vector<uint16_t>& scanline, Dali::Vector<uint16_t>& reference)
{
- scanline.Resize( scanlineLength );
- reference.Reserve( scanlineLength / 2 + 32 );
+ scanline.Resize(scanlineLength);
+ reference.Reserve(scanlineLength / 2 + 32);
// Prepare some random pixels:
- srand48( 19 * 23 * 47 * 53 );
- for( size_t i = 0; i < scanlineLength / 2; ++i )
+ srand48(19 * 23 * 47 * 53);
+ for(size_t i = 0; i < scanlineLength / 2; ++i)
{
// Generate random colors:
const uint32_t red1 = RandomComponent5();
const uint32_t blue2 = RandomComponent5();
// The average of these pixels should equal the reference:
- scanline[i * 2] = PixelRGB565( red1, green1, blue1 );
- scanline[i * 2 + 1] = PixelRGB565( red2, green2, blue2 );
+ scanline[i * 2] = PixelRGB565(red1, green1, blue1);
+ scanline[i * 2 + 1] = PixelRGB565(red2, green2, blue2);
// Average the two pixels manually as a reference:
- reference.PushBack( PixelRGB565( (red1 + red2) >> 1u, (green1 + green2) >> 1u, (blue1 + blue2) >> 1u ) );
+ reference.PushBack(PixelRGB565((red1 + red2) >> 1u, (green1 + green2) >> 1u, (blue1 + blue2) >> 1u));
}
- for( size_t i = scanlineLength / 2; i < reference.Capacity(); ++i )
+ for(size_t i = scanlineLength / 2; i < reference.Capacity(); ++i)
{
reference[i] = 0xEEEE;
}
/**
* @brief Build some dummy scanlines to exercise scanline averaging code on.
*/
-void SetupScanlineForHalvingTests2Bytes( size_t scanlineLength, Dali::Vector<uint8_t>& scanline, Dali::Vector<uint8_t>& reference )
+void SetupScanlineForHalvingTests2Bytes(size_t scanlineLength, Dali::Vector<uint8_t>& scanline, Dali::Vector<uint8_t>& reference)
{
- scanline.Resize( scanlineLength * 2 );
- reference.Reserve( scanlineLength + 32 );
+ scanline.Resize(scanlineLength * 2);
+ reference.Reserve(scanlineLength + 32);
// Prepare some random pixels:
- srand48( 19 * 23 * 47 * 53 * 59 );
- for( size_t i = 0; i < scanlineLength / 2; ++i )
+ srand48(19 * 23 * 47 * 53 * 59);
+ for(size_t i = 0; i < scanlineLength / 2; ++i)
{
// Generate random colors:
- const uint32_t c11 = RandomComponent8();
- const uint32_t c12 = RandomComponent8();
- const uint32_t c21 = RandomComponent8();
- const uint32_t c22 = RandomComponent8();
+ const uint32_t c11 = RandomComponent8();
+ const uint32_t c12 = RandomComponent8();
+ const uint32_t c21 = RandomComponent8();
+ const uint32_t c22 = RandomComponent8();
// The average of these pixels should equal the reference:
scanline[i * 4] = c11;
scanline[i * 4 + 3] = c22;
// Average the two pixels manually as a reference:
- reference.PushBack( (c11 + c21) >> 1u );
- reference.PushBack( (c12 + c22) >> 1u );
+ reference.PushBack((c11 + c21) >> 1u);
+ reference.PushBack((c12 + c22) >> 1u);
}
- for( size_t i = scanlineLength; i < reference.Capacity(); ++i )
+ for(size_t i = scanlineLength; i < reference.Capacity(); ++i)
{
reference[i] = 0xEE;
}
/**
* @brief Build some dummy 1 byte per pixel scanlines to exercise scanline averaging code on.
*/
-void SetupScanlineForHalvingTests1Byte( size_t scanlineLength, Dali::Vector<uint8_t>& scanline, Dali::Vector<uint8_t>& reference )
+void SetupScanlineForHalvingTests1Byte(size_t scanlineLength, Dali::Vector<uint8_t>& scanline, Dali::Vector<uint8_t>& reference)
{
- scanline.Resize( scanlineLength * 2 );
- reference.Reserve( scanlineLength + 32 );
+ scanline.Resize(scanlineLength * 2);
+ reference.Reserve(scanlineLength + 32);
// Prepare some random pixels:
- srand48( 19 * 23 * 47 * 53 * 63 );
- for( size_t i = 0; i < scanlineLength / 2; ++i )
+ srand48(19 * 23 * 47 * 53 * 63);
+ for(size_t i = 0; i < scanlineLength / 2; ++i)
{
// Generate random colors:
const uint32_t c1 = RandomComponent8();
scanline[i * 2 + 1] = c2;
// Average the two pixels manually as a reference:
- reference.PushBack( (c1 + c2) >> 1u );
-
+ reference.PushBack((c1 + c2) >> 1u);
}
- for( size_t i = scanlineLength; i < reference.Capacity(); ++i )
+ for(size_t i = scanlineLength; i < reference.Capacity(); ++i)
{
reference[i] = 0xEE;
}
*
* All tested formats bar RGB565 can share this setup.
*/
-void SetupScanlinesRGBA8888( size_t scanlineLength, Dali::Vector<uint32_t>& scanline1, Dali::Vector<uint32_t>& scanline2, Dali::Vector<uint32_t>& reference, Dali::Vector<uint32_t>& output )
+void SetupScanlinesRGBA8888(size_t scanlineLength, Dali::Vector<uint32_t>& scanline1, Dali::Vector<uint32_t>& scanline2, Dali::Vector<uint32_t>& reference, Dali::Vector<uint32_t>& output)
{
- scanline1.Reserve( scanlineLength );
- scanline2.Reserve( scanlineLength );
- reference.Reserve( scanlineLength + 32 );
- output.Reserve( scanlineLength + 32 );
+ scanline1.Reserve(scanlineLength);
+ scanline2.Reserve(scanlineLength);
+ reference.Reserve(scanlineLength + 32);
+ output.Reserve(scanlineLength + 32);
- for( size_t i = scanlineLength; i < output.Capacity(); ++i )
+ for(size_t i = scanlineLength; i < output.Capacity(); ++i)
{
output[i] = 0xDEADBEEF;
reference[i] = 0xDEADBEEF;
}
// Prepare some random pixels:
- srand48( 19 * 23 * 47 );
- for( size_t i = 0; i < scanlineLength; ++i )
+ srand48(19 * 23 * 47);
+ for(size_t i = 0; i < scanlineLength; ++i)
{
// Generate random colors:
const uint32_t red1 = RandomComponent8();
const uint32_t alpha2 = RandomComponent8();
// The average of these pixels should equal the reference:
- scanline1.PushBack( PixelRGBA8888( red1, green1, blue1, alpha1 ) );
- scanline2.PushBack( PixelRGBA8888( red2, green2, blue2, alpha2 ) );
+ scanline1.PushBack(PixelRGBA8888(red1, green1, blue1, alpha1));
+ scanline2.PushBack(PixelRGBA8888(red2, green2, blue2, alpha2));
// Average the two pixels manually as a reference:
- reference.PushBack( PixelRGBA8888( (red1 + red2) >> 1u, (green1 + green2) >> 1u, (blue1 + blue2) >> 1u, (alpha1 + alpha2) >> 1u ) );
+ reference.PushBack(PixelRGBA8888((red1 + red2) >> 1u, (green1 + green2) >> 1u, (blue1 + blue2) >> 1u, (alpha1 + alpha2) >> 1u));
}
}
/**
* @brief Compares a scanline of interest to a reference, testing each pixel is the same.
*/
-void MatchScanlinesRGBA8888( Dali::Vector<uint32_t>& reference, Dali::Vector<uint32_t>& output, size_t& numMatches, const char * const location )
+void MatchScanlinesRGBA8888(Dali::Vector<uint32_t>& reference, Dali::Vector<uint32_t>& output, size_t& numMatches, const char* const location)
{
numMatches = 0;
- for( size_t i = 0, length = reference.Capacity(); i < length; ++i )
+ for(size_t i = 0, length = reference.Capacity(); i < length; ++i)
{
- DALI_TEST_EQUALS( output[i], reference[i], location );
+ DALI_TEST_EQUALS(output[i], reference[i], location);
numMatches += output[i] == reference[i];
}
}
-} //< namespace unnamed
+} // namespace
/**
* @brief Test component averaging code.
*/
int UtcDaliImageOperationsAverageComponent(void)
{
- DALI_TEST_EQUALS( Dali::Internal::Platform::AverageComponent( 0u, 0u ), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AverageComponent( 1u, 1u ), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AverageComponent( 0xffffffffu >> 1u, 0xffffffffu >> 1u ), 0xffffffffu >> 1u, TEST_LOCATION );
- const unsigned int avg3 = Dali::Internal::Platform::AverageComponent( 0xfffffffeu, 1u );
- DALI_TEST_EQUALS( avg3, 0x7fffffffu, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AverageComponent( 255u, 255u ), 255u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AverageComponent( 512u, 0u ), 256u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AverageComponent( 511u, 0u ), 255u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AverageComponent( 510u, 0u ), 255u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AverageComponent( 509u, 0u ), 254u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AverageComponent( 0u, 509u ), 254u, TEST_LOCATION );
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AverageComponent(0u, 0u), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AverageComponent(1u, 1u), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AverageComponent(0xffffffffu >> 1u, 0xffffffffu >> 1u), 0xffffffffu >> 1u, TEST_LOCATION);
+ const unsigned int avg3 = Dali::Internal::Platform::AverageComponent(0xfffffffeu, 1u);
+ DALI_TEST_EQUALS(avg3, 0x7fffffffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AverageComponent(255u, 255u), 255u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AverageComponent(512u, 0u), 256u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AverageComponent(511u, 0u), 255u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AverageComponent(510u, 0u), 255u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AverageComponent(509u, 0u), 254u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AverageComponent(0u, 509u), 254u, TEST_LOCATION);
END_TEST;
}
*/
int UtcDaliImageOperationsAveragePixelRGBA8888(void)
{
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGBA8888( 0u, 0u ), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGBA8888( 0x01010101, 0x01010101 ), 0x01010101u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGBA8888( 0x01010101, 0x03030303 ), 0x02020202u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGBA8888( 0xffffffff, 0xffffffff ), 0xffffffffu, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGBA8888( 0xffffffff, 0u ), 0x7f7f7f7fu, TEST_LOCATION );
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGBA8888(0u, 0u), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGBA8888(0x01010101, 0x01010101), 0x01010101u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGBA8888(0x01010101, 0x03030303), 0x02020202u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGBA8888(0xffffffff, 0xffffffff), 0xffffffffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGBA8888(0xffffffff, 0u), 0x7f7f7f7fu, TEST_LOCATION);
END_TEST;
}
*/
int UtcDaliImageOperationsAveragePixelRGB565(void)
{
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGB565( 0u, 0u ), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGB565( 0xf800u, 0xf800u ), 0xf800u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGB565( 0xf800u, 0x800u ), 1u << 15, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGB565( 0x7e0u, 0x7e0u ), 0x7e0u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGB565( 0x7e0u, 0x20u ), 1u << 10, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGB565( 0x1f, 0x1f ), 0x1fu, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGB565( 0x1f, 0x1 ), 1u << 4, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGB565( 0xf800u, 0x7e0u ), 0x7800u + 0x3e0u, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Platform::AveragePixelRGB565( 0xffff, 0xffff ), 0xffffu, TEST_LOCATION );
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGB565(0u, 0u), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGB565(0xf800u, 0xf800u), 0xf800u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGB565(0xf800u, 0x800u), 1u << 15, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGB565(0x7e0u, 0x7e0u), 0x7e0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGB565(0x7e0u, 0x20u), 1u << 10, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGB565(0x1f, 0x1f), 0x1fu, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGB565(0x1f, 0x1), 1u << 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGB565(0xf800u, 0x7e0u), 0x7800u + 0x3e0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Platform::AveragePixelRGB565(0xffff, 0xffff), 0xffffu, TEST_LOCATION);
END_TEST;
}
* @brief Build a square bitmap, downscale it and assert the resulting bitmap has the right dimensions.
*/
void TestDownscaledBitmapHasRightDimensionsAndFormat(
- Pixel::Format format,
- uint32_t sourceDimension,
- uint32_t targetDimension,
- uint32_t expectedDimension,
- const char * const location )
+ Pixel::Format format,
+ uint32_t sourceDimension,
+ uint32_t targetDimension,
+ uint32_t expectedDimension,
+ const char* const location)
{
- ImageDimensions desired( targetDimension, targetDimension );
- FittingMode::Type fittingMode( FittingMode::SHRINK_TO_FIT );
- SamplingMode::Type samplingMode( SamplingMode::BOX );
+ ImageDimensions desired(targetDimension, targetDimension);
+ FittingMode::Type fittingMode(FittingMode::SHRINK_TO_FIT);
+ SamplingMode::Type samplingMode(SamplingMode::BOX);
- Dali::Devel::PixelBuffer sourceBitmap = Dali::Devel::PixelBuffer::New( sourceDimension, sourceDimension, format );
+ Dali::Devel::PixelBuffer sourceBitmap = Dali::Devel::PixelBuffer::New(sourceDimension, sourceDimension, format);
- Dali::Devel::PixelBuffer downScaled = DownscaleBitmap( sourceBitmap, desired, fittingMode, samplingMode );
+ Dali::Devel::PixelBuffer downScaled = DownscaleBitmap(sourceBitmap, desired, fittingMode, samplingMode);
- DALI_TEST_EQUALS( downScaled.GetWidth(), expectedDimension, location );
- DALI_TEST_EQUALS( downScaled.GetHeight(), expectedDimension, location );
- DALI_TEST_EQUALS( downScaled.GetPixelFormat(), format, location );
+ DALI_TEST_EQUALS(downScaled.GetWidth(), expectedDimension, location);
+ DALI_TEST_EQUALS(downScaled.GetHeight(), expectedDimension, location);
+ DALI_TEST_EQUALS(downScaled.GetPixelFormat(), format, location);
}
/**
{
// Do Scalings that are expected to work for all pixels modes and assert the resulting bitmap dimensions:
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::RGBA8888, 1024, 8, 8, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::RGB888, 1024, 8, 8, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::RGB565, 1024, 8, 8, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::LA88, 1024, 8, 8, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::L8, 1024, 8, 8, TEST_LOCATION );
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::RGBA8888, 1024, 8, 8, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::RGB888, 1024, 8, 8, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::RGB565, 1024, 8, 8, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::LA88, 1024, 8, 8, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::L8, 1024, 8, 8, TEST_LOCATION);
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::RGBA8888, 773, 1, 1, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::RGB888, 787, 1, 1, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::RGB565, 797, 1, 1, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::LA88, 809, 1, 1, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::L8, 811, 1, 1, TEST_LOCATION );
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::RGBA8888, 773, 1, 1, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::RGB888, 787, 1, 1, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::RGB565, 797, 1, 1, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::LA88, 809, 1, 1, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::L8, 811, 1, 1, TEST_LOCATION);
// Do Scalings that are expected to produce a slightly larger than requested image:
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::RGBA8888, 47, 7, 11, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::RGB888, 73, 17, 18, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::RGB565, 61, 8, 15, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::LA88, 19, 5, 9, TEST_LOCATION );
- TestDownscaledBitmapHasRightDimensionsAndFormat( Pixel::L8, 353, 23, 44, TEST_LOCATION );
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::RGBA8888, 47, 7, 11, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::RGB888, 73, 17, 18, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::RGB565, 61, 8, 15, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::LA88, 19, 5, 9, TEST_LOCATION);
+ TestDownscaledBitmapHasRightDimensionsAndFormat(Pixel::L8, 353, 23, 44, TEST_LOCATION);
END_TEST;
}
// Do downscaling to 1 x 1 so we can easily assert the value of the single pixel produced:
// Scale down a black/white checkerboard to mid-grey:
- unsigned char check_4x4 [16 * 3] = {
- 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff
- };
-
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888(check_4x4, 4, 4, 1, 1, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_EQUALS( outWidth, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( outHeight, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( check_4x4[0], (unsigned char)0x7f, TEST_LOCATION );
+ unsigned char check_4x4[16 * 3] = {
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff};
+
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(check_4x4, 4, 4, 1, 1, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_EQUALS(outWidth, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(outHeight, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(check_4x4[0], (unsigned char)0x7f, TEST_LOCATION);
// Scale down a 16 pixel black image with a single white pixel to a 1/16th grey single pixel:
- unsigned char single_4x4 [16 * 3] = {
- 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888(single_4x4, 4, 4, 1, 1, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_EQUALS( outWidth, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( outHeight, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( single_4x4[0], (unsigned char)0xf, TEST_LOCATION );
+ unsigned char single_4x4[16 * 3] = {
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(single_4x4, 4, 4, 1, 1, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_EQUALS(outWidth, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(outHeight, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(single_4x4[0], (unsigned char)0xf, TEST_LOCATION);
// Scale down a 16 pixel black image with a single white pixel to a 1/16th grey single pixel:
// (white pixel at bottom-right of image)
- unsigned char single_4x4_2 [16 * 3] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff
- };
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888(single_4x4_2, 4, 4, 1, 1, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_EQUALS( outWidth, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( outHeight, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( single_4x4_2[0], (unsigned char)0xf, TEST_LOCATION );
+ unsigned char single_4x4_2[16 * 3] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff};
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(single_4x4_2, 4, 4, 1, 1, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_EQUALS(outWidth, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(outHeight, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(single_4x4_2[0], (unsigned char)0xf, TEST_LOCATION);
// Build a larger ~600 x ~600 uniform magenta image for tests which only test output dimensions:
- unsigned char magenta_600_x_600[608*608 * 3];
- for( unsigned int i = 0; i < sizeof(magenta_600_x_600); i += 3 )
+ unsigned char magenta_600_x_600[608 * 608 * 3];
+ for(unsigned int i = 0; i < sizeof(magenta_600_x_600); i += 3)
{
- magenta_600_x_600[i] = 0xff;
+ magenta_600_x_600[i] = 0xff;
magenta_600_x_600[i + 1] = 0;
magenta_600_x_600[i + 2] = 0xff;
}
// Scaling to 0 x 0 should stop at 1 x 1:
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888( magenta_600_x_600, 352, 352, 0, 0, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_EQUALS( outWidth, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( outHeight, 1u, TEST_LOCATION );
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(magenta_600_x_600, 352, 352, 0, 0, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_EQUALS(outWidth, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(outHeight, 1u, TEST_LOCATION);
// Scaling to 1 x 1 should hit 1 x 1:
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888( magenta_600_x_600, 608, 608, 1, 1, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_EQUALS( outWidth, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( outHeight, 1u, TEST_LOCATION );
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(magenta_600_x_600, 608, 608, 1, 1, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_EQUALS(outWidth, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(outHeight, 1u, TEST_LOCATION);
// Scaling to original dimensions should NOP:
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888( magenta_600_x_600, 384, 384, 384, 384, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_EQUALS( outWidth, 384u, TEST_LOCATION );
- DALI_TEST_EQUALS( outHeight, 384u, TEST_LOCATION );
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(magenta_600_x_600, 384, 384, 384, 384, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_EQUALS(outWidth, 384u, TEST_LOCATION);
+ DALI_TEST_EQUALS(outHeight, 384u, TEST_LOCATION);
// More dimension tests:
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888( magenta_600_x_600, 352, 352, 44, 11, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_EQUALS( outWidth, 44u, TEST_LOCATION );
- DALI_TEST_EQUALS( outHeight, 44u, TEST_LOCATION );
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(magenta_600_x_600, 352, 352, 44, 11, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_EQUALS(outWidth, 44u, TEST_LOCATION);
+ DALI_TEST_EQUALS(outHeight, 44u, TEST_LOCATION);
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888( magenta_600_x_600, 384, 384, 3, 48, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_EQUALS( outWidth, 48u, TEST_LOCATION );
- DALI_TEST_EQUALS( outHeight, 48u, TEST_LOCATION );
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(magenta_600_x_600, 384, 384, 3, 48, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_EQUALS(outWidth, 48u, TEST_LOCATION);
+ DALI_TEST_EQUALS(outHeight, 48u, TEST_LOCATION);
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888( magenta_600_x_600, 384, 384, 3, 3, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_CHECK( outWidth == 3u && outHeight == 3u );
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(magenta_600_x_600, 384, 384, 3, 3, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_CHECK(outWidth == 3u && outHeight == 3u);
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888( magenta_600_x_600, 320, 320, 5, 5, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_CHECK( outWidth == 5u && outHeight == 5u );
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(magenta_600_x_600, 320, 320, 5, 5, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_CHECK(outWidth == 5u && outHeight == 5u);
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888( magenta_600_x_600, 448, 448, 7, 7, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_CHECK( outWidth == 7u && outHeight == 7u );
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(magenta_600_x_600, 448, 448, 7, 7, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_CHECK(outWidth == 7u && outHeight == 7u);
- Dali::Internal::Platform::DownscaleInPlacePow2RGB888( magenta_600_x_600, 352, 352, 11, 11, BoxDimensionTestBoth, outWidth, outHeight );
- DALI_TEST_CHECK( outWidth == 11u && outHeight == 11u );
+ Dali::Internal::Platform::DownscaleInPlacePow2RGB888(magenta_600_x_600, 352, 352, 11, 11, BoxDimensionTestBoth, outWidth, outHeight);
+ DALI_TEST_CHECK(outWidth == 11u && outHeight == 11u);
// Check that no pixel values were modified by the repeated averaging of identical pixels in tests above:
unsigned int numNonMagenta = 0u;
- for( unsigned i = 0; i < sizeof(magenta_600_x_600); i += 3 )
+ for(unsigned i = 0; i < sizeof(magenta_600_x_600); i += 3)
{
numNonMagenta += magenta_600_x_600[i] == 0xff && magenta_600_x_600[i + 1] == 0x00 && magenta_600_x_600[i + 2] == 0xff ? 0 : 1;
}
- DALI_TEST_EQUALS( numNonMagenta, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(numNonMagenta, 0u, TEST_LOCATION);
END_TEST;
}
/**
* @brief Test that resizing RGBA8888 images as raw pixel arrays produces a result of the correct dimensions.
*/
-void TestDownscaleOutputsExpectedDimensionsRGBA8888( uint32_t pixels[], unsigned inputWidth, unsigned inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, unsigned int expectedWidth, unsigned int expectedHeight, const char * const location )
+void TestDownscaleOutputsExpectedDimensionsRGBA8888(uint32_t pixels[], unsigned inputWidth, unsigned inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, unsigned int expectedWidth, unsigned int expectedHeight, const char* const location)
{
unsigned int resultingWidth = -1, resultingHeight = -1;
Dali::Internal::Platform::DownscaleInPlacePow2RGBA8888(
- reinterpret_cast<unsigned char *> (pixels),
- inputWidth, inputHeight,
- desiredWidth, desiredHeight, BoxDimensionTestBoth,
- resultingWidth, resultingHeight );
-
- DALI_TEST_EQUALS( resultingWidth, expectedWidth, location );
- DALI_TEST_EQUALS( resultingHeight, expectedHeight, location );
+ reinterpret_cast<unsigned char*>(pixels),
+ inputWidth,
+ inputHeight,
+ desiredWidth,
+ desiredHeight,
+ BoxDimensionTestBoth,
+ resultingWidth,
+ resultingHeight);
+
+ DALI_TEST_EQUALS(resultingWidth, expectedWidth, location);
+ DALI_TEST_EQUALS(resultingHeight, expectedHeight, location);
}
/**
* @brief Test that resizing RGB565 images as raw pixel arrays produces a result of the correct dimensions.
*/
-void TestDownscaleOutputsExpectedDimensionsRGB565( uint16_t pixels[], unsigned inputWidth, unsigned inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, unsigned int expectedWidth, unsigned int expectedHeight, const char * const location )
+void TestDownscaleOutputsExpectedDimensionsRGB565(uint16_t pixels[], unsigned inputWidth, unsigned inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, unsigned int expectedWidth, unsigned int expectedHeight, const char* const location)
{
unsigned int resultingWidth = -1, resultingHeight = -1;
Dali::Internal::Platform::DownscaleInPlacePow2RGB565(
- reinterpret_cast<unsigned char *> (pixels),
- inputWidth, inputHeight,
- desiredWidth, desiredHeight, BoxDimensionTestBoth,
- resultingWidth, resultingHeight );
-
- DALI_TEST_EQUALS( resultingWidth, expectedWidth, location );
- DALI_TEST_EQUALS( resultingHeight, expectedHeight, location );
+ reinterpret_cast<unsigned char*>(pixels),
+ inputWidth,
+ inputHeight,
+ desiredWidth,
+ desiredHeight,
+ BoxDimensionTestBoth,
+ resultingWidth,
+ resultingHeight);
+
+ DALI_TEST_EQUALS(resultingWidth, expectedWidth, location);
+ DALI_TEST_EQUALS(resultingHeight, expectedHeight, location);
}
/**
* @brief Test that resizing 2-byte-per-pixel images as raw pixel arrays produces a result of the correct dimensions.
*/
-void TestDownscaleOutputsExpectedDimensions2ComponentPair( uint8_t pixels[], unsigned inputWidth, unsigned inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, unsigned int expectedWidth, unsigned int expectedHeight, const char * const location )
+void TestDownscaleOutputsExpectedDimensions2ComponentPair(uint8_t pixels[], unsigned inputWidth, unsigned inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, unsigned int expectedWidth, unsigned int expectedHeight, const char* const location)
{
unsigned int resultingWidth = -1, resultingHeight = -1;
Dali::Internal::Platform::DownscaleInPlacePow2ComponentPair(
- pixels,
- inputWidth, inputHeight,
- desiredWidth, desiredHeight, BoxDimensionTestBoth,
- resultingWidth, resultingHeight );
-
- DALI_TEST_EQUALS( resultingWidth, expectedWidth, location );
- DALI_TEST_EQUALS( resultingHeight, expectedHeight, location );
+ pixels,
+ inputWidth,
+ inputHeight,
+ desiredWidth,
+ desiredHeight,
+ BoxDimensionTestBoth,
+ resultingWidth,
+ resultingHeight);
+
+ DALI_TEST_EQUALS(resultingWidth, expectedWidth, location);
+ DALI_TEST_EQUALS(resultingHeight, expectedHeight, location);
}
/**
* @brief Test that resizing single-byte-per-pixel images as raw pixel arrays produces a result of the correct dimensions.
*/
-void TestDownscaleOutputsExpectedDimensionsSingleComponent( uint8_t pixels[], unsigned inputWidth, unsigned inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, unsigned int expectedWidth, unsigned int expectedHeight, const char * const location )
+void TestDownscaleOutputsExpectedDimensionsSingleComponent(uint8_t pixels[], unsigned inputWidth, unsigned inputHeight, unsigned int desiredWidth, unsigned int desiredHeight, unsigned int expectedWidth, unsigned int expectedHeight, const char* const location)
{
unsigned int resultingWidth = -1, resultingHeight = -1;
Dali::Internal::Platform::DownscaleInPlacePow2SingleBytePerPixel(
- pixels,
- inputWidth, inputHeight,
- desiredWidth, desiredHeight, BoxDimensionTestBoth,
- resultingWidth, resultingHeight );
-
- DALI_TEST_EQUALS( resultingWidth, expectedWidth, location );
- DALI_TEST_EQUALS( resultingHeight, expectedHeight, location );
+ pixels,
+ inputWidth,
+ inputHeight,
+ desiredWidth,
+ desiredHeight,
+ BoxDimensionTestBoth,
+ resultingWidth,
+ resultingHeight);
+
+ DALI_TEST_EQUALS(resultingWidth, expectedWidth, location);
+ DALI_TEST_EQUALS(resultingHeight, expectedHeight, location);
}
/**
*/
int UtcDaliImageOperationsDownscaleInPlacePow2RGBA8888(void)
{
- uint32_t image[608*608];
- for( unsigned i = 0; i < sizeof(image) / sizeof(image[0]); ++i )
+ uint32_t image[608 * 608];
+ for(unsigned i = 0; i < sizeof(image) / sizeof(image[0]); ++i)
{
image[i] = 0xffffffff;
}
- unsigned char* const pixels = reinterpret_cast<unsigned char *> (image);
- unsigned int resultingWidth = -1, resultingHeight = -1;
+ unsigned char* const pixels = reinterpret_cast<unsigned char*>(image);
+ unsigned int resultingWidth = -1, resultingHeight = -1;
// Test downscaling where the input size is an exact multiple of the desired size:
// (We expect a perfect result here)
- DownscaleInPlacePow2RGBA8888( pixels, 600, 600, 75, 75, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 75u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 75u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 600, 600, 75, 75, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 75u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 75u, TEST_LOCATION);
- DownscaleInPlacePow2RGBA8888( pixels, 512, 512, 16, 16, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 16u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 16u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 512, 512, 16, 16, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 16u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 16u, TEST_LOCATION);
- DownscaleInPlacePow2RGBA8888( pixels, 512, 64, 16, 2, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 16u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 2u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 512, 64, 16, 2, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 16u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 2u, TEST_LOCATION);
- DownscaleInPlacePow2RGBA8888( pixels, 64, 1024, 4, 64, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 4u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 64u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 64, 1024, 4, 64, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 4u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 64u, TEST_LOCATION);
// Test downscaling where the input size is slightly off being an exact multiple of the desired size:
// (We expect a perfect match at the end because of rounding-down to an even width and height at each step)
- DownscaleInPlacePow2RGBA8888( pixels, 601, 603, 75, 75, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 75u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 75u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 601, 603, 75, 75, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 75u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 75u, TEST_LOCATION);
- DownscaleInPlacePow2RGBA8888( pixels, 736 + 1, 352 + 3, 23, 11, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 23u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 11u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 736 + 1, 352 + 3, 23, 11, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 23u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 11u, TEST_LOCATION);
- DownscaleInPlacePow2RGBA8888( pixels, 384 + 3, 896 + 1, 3, 7, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 3u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 7u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 384 + 3, 896 + 1, 3, 7, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 3u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 7u, TEST_LOCATION);
// Test downscales with source dimensions which are under a nice power of two by one:
// The target is hit exactly due to losing spare columns or rows at each iteration:
- DownscaleInPlacePow2RGBA8888( pixels, 63, 31, 7, 3, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 7u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 3u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 63, 31, 7, 3, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 7u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 3u, TEST_LOCATION);
// Asking to downscale a bit smaller should stop at the dimensions of the last test as one more halving would go down to 3 x 1, which is too small.
- DownscaleInPlacePow2RGBA8888( pixels, 63, 31, 4, 2, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 7u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 3u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 63, 31, 4, 2, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 7u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 3u, TEST_LOCATION);
// Should stop at almost twice the requested dimensions:
- DownscaleInPlacePow2RGBA8888( pixels, 15, 127, 4, 32, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 7u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 63u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 15, 127, 4, 32, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 7u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 63u, TEST_LOCATION);
// Test downscales to 1 in one or both dimensions:
// Parameters: input-x input-y, desired-x, desired-y, expected-x, expected-y
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 512, 512, 1, 1, 1, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 512, 32, 16, 1, 16, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 512, 32, 7, 1, 16, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 512, 32, 7, 1, 16, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 512, 32, 5, 1, 16, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 512, 32, 3, 1, 16, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 32, 512, 1, 1, 1, 16, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 32, 512, 1, 16, 1, 16, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 32, 512, 1, 3, 1, 16, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 33, 33, 1, 1, 1, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 17*19, 17*19, 1, 1, 1, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 33, 33, 3, 1, 4, 4, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 33, 9, 3, 1, 4, 1, TEST_LOCATION );
-
-
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 512, 512, 1, 1, 1, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 512, 32, 16, 1, 16, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 512, 32, 7, 1, 16, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 512, 32, 7, 1, 16, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 512, 32, 5, 1, 16, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 512, 32, 3, 1, 16, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 32, 512, 1, 1, 1, 16, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 32, 512, 1, 16, 1, 16, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 32, 512, 1, 3, 1, 16, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 33, 33, 1, 1, 1, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 17 * 19, 17 * 19, 1, 1, 1, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 33, 33, 3, 1, 4, 4, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 33, 9, 3, 1, 4, 1, TEST_LOCATION);
// Test downscales to zero in one or both dimensions:
// Scaling should stop when one or both dimensions reach 1.
// Parameters: input-x input-y, desired-x, desired-y, expected-x, expected-y
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 512, 512, 0, 0, 1, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 512, 256, 0, 0, 2, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 512, 128, 0, 0, 4, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 512, 16, 0, 0, 32, 1, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 128, 512, 0, 0, 1, 4, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 32, 512, 0, 0, 1, 16, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 8, 512, 0, 0, 1, 64, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 2, 512, 0, 0, 1, 256, TEST_LOCATION );
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 512, 512, 0, 0, 1, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 512, 256, 0, 0, 2, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 512, 128, 0, 0, 4, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 512, 16, 0, 0, 32, 1, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 128, 512, 0, 0, 1, 4, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 32, 512, 0, 0, 1, 16, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 8, 512, 0, 0, 1, 64, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 2, 512, 0, 0, 1, 256, TEST_LOCATION);
END_TEST;
}
*/
int UtcDaliImageOperationsDownscaleInPlacePow2RGBA8888Nops(void)
{
- uint32_t image[608*608];
+ uint32_t image[608 * 608];
const uint32_t numPixels = sizeof(image) / sizeof(image[0]);
- for( unsigned i = 0; i < numPixels; ++i )
+ for(unsigned i = 0; i < numPixels; ++i)
{
image[i] = RandomPixelRGBA8888();
}
- const uint32_t imageHash = HashPixels( image, numPixels );
- unsigned char* const pixels = reinterpret_cast<unsigned char *> (image);
- unsigned int resultingWidth = -1, resultingHeight = -1;
+ const uint32_t imageHash = HashPixels(image, numPixels);
+ unsigned char* const pixels = reinterpret_cast<unsigned char*>(image);
+ unsigned int resultingWidth = -1, resultingHeight = -1;
// Test downscales to the same size:
// The point is just to be sure the downscale is a NOP in this case:
- DownscaleInPlacePow2RGBA8888( pixels, 600, 600, 600, 600, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 600u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 600u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 600, 600, 600, 600, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 600u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 600u, TEST_LOCATION);
- DownscaleInPlacePow2RGBA8888( pixels, 512, 128, 512, 128, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 512u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 128u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 512, 128, 512, 128, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 512u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 128u, TEST_LOCATION);
- DownscaleInPlacePow2RGBA8888( pixels, 17, 1001, 17, 1001, BoxDimensionTestBoth, resultingWidth, resultingHeight );
- DALI_TEST_EQUALS( resultingWidth, 17u, TEST_LOCATION );
- DALI_TEST_EQUALS( resultingHeight, 1001u, TEST_LOCATION );
+ DownscaleInPlacePow2RGBA8888(pixels, 17, 1001, 17, 1001, BoxDimensionTestBoth, resultingWidth, resultingHeight);
+ DALI_TEST_EQUALS(resultingWidth, 17u, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultingHeight, 1001u, TEST_LOCATION);
// Test downscales that request a larger size (we never upscale so these are NOPs too):
// Parameters: input-x input-y, desired-x, desired-y, expected-x, expected-y
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 300, 300, 600, 600, 300, 300, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 3, 127, 99, 599, 3, 127, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGBA8888( image, 600, 600, 999, 999, 600, 600, TEST_LOCATION ); //< checks no out of bounds mem access in this case
-
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 300, 300, 600, 600, 300, 300, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 3, 127, 99, 599, 3, 127, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGBA8888(image, 600, 600, 999, 999, 600, 600, TEST_LOCATION); //< checks no out of bounds mem access in this case
// Make sure that none of these NOP downscalings has affected the pixels of the image:
- DALI_TEST_EQUALS( HashPixels( image, numPixels ), imageHash, TEST_LOCATION );
+ DALI_TEST_EQUALS(HashPixels(image, numPixels), imageHash, TEST_LOCATION);
END_TEST;
}
{
// Test that calling with null and zero parameters doesn't blow up:
unsigned int outWidth, outHeight;
- DownscaleInPlacePow2RGB565( 0, 0, 0, 0, 0, BoxDimensionTestBoth, outWidth, outHeight );
+ DownscaleInPlacePow2RGB565(0, 0, 0, 0, 0, BoxDimensionTestBoth, outWidth, outHeight);
- uint16_t image[608*608];
- for( unsigned i = 0; i < sizeof(image) / sizeof(image[0]); ++i )
+ uint16_t image[608 * 608];
+ for(unsigned i = 0; i < sizeof(image) / sizeof(image[0]); ++i)
{
image[i] = 0xffff;
}
// Do a straightforward test using an exact divisor target size:
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 600, 600, 75, 75, 75, 75, TEST_LOCATION );
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 600, 600, 75, 75, 75, 75, TEST_LOCATION);
// Test that a slightly smaller than possible to achieve target results in the
// next-higher exact divisor output image dimensions:
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 600, 600, 71, 69, 75, 75, TEST_LOCATION );
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 600, 600, 71, 69, 75, 75, TEST_LOCATION);
// Test that resizing from a starting size that is slightly larger than an exact
// multiple of the desired dimensions still results in the desired ones being
// reached:
// Parameters: input-x input-y, desired-x, desired-y, expected-x, expected-y
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 600 + 1, 600 + 1, 75, 75, 75, 75, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 256 + 1, 512 + 1, 2, 4, 2, 4, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 512 + 1, 128 + 1, 16, 4, 16, 4, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 512 + 1, 64 + 1, 16, 2, 16, 2, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 512 + 3, 512 + 3, 16, 16, 16, 16, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 512 + 3, 256 + 3, 16, 8, 16, 8, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 256 + 3, 512 + 3, 4, 8, 4, 8, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 256 + 7, 512 + 7, 4, 8, 4, 8, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 256 + 7, 512 + 7, 2, 4, 2, 4, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 512 + 7, 128 + 7, 16, 4, 16, 4, TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsRGB565( image, 512 + 7, 64 + 7, 16, 2, 16, 2, TEST_LOCATION );
-
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 600 + 1, 600 + 1, 75, 75, 75, 75, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 256 + 1, 512 + 1, 2, 4, 2, 4, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 512 + 1, 128 + 1, 16, 4, 16, 4, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 512 + 1, 64 + 1, 16, 2, 16, 2, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 512 + 3, 512 + 3, 16, 16, 16, 16, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 512 + 3, 256 + 3, 16, 8, 16, 8, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 256 + 3, 512 + 3, 4, 8, 4, 8, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 256 + 7, 512 + 7, 4, 8, 4, 8, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 256 + 7, 512 + 7, 2, 4, 2, 4, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 512 + 7, 128 + 7, 16, 4, 16, 4, TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsRGB565(image, 512 + 7, 64 + 7, 16, 2, 16, 2, TEST_LOCATION);
END_TEST;
}
{
// Simple test that a null pointer does not get dereferenced in the function:
unsigned int outWidth, outHeight;
- DownscaleInPlacePow2ComponentPair( 0, 0, 0, 0, 0, BoxDimensionTestBoth, outWidth, outHeight );
+ DownscaleInPlacePow2ComponentPair(0, 0, 0, 0, 0, BoxDimensionTestBoth, outWidth, outHeight);
// Simple tests of dimensions output:
- uint8_t image[608*608*2];
- for( unsigned i = 0; i < sizeof(image) / sizeof(image[0]); ++i )
+ uint8_t image[608 * 608 * 2];
+ for(unsigned i = 0; i < sizeof(image) / sizeof(image[0]); ++i)
{
image[i] = 0xff;
}
- TestDownscaleOutputsExpectedDimensions2ComponentPair( image,
- 600, 600, //< Input dimensions
- 37, 37, //< Requested dimensions
- 37, 37, //< Expected output dimensions
- TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensions2ComponentPair( image,
- 600, 600, //< Input dimensions
- 34, 35, //< Requested dimensions to scale-down to
- 37, 37, //< Expected output dimensions achieved
- TEST_LOCATION );
+ TestDownscaleOutputsExpectedDimensions2ComponentPair(image,
+ 600,
+ 600, //< Input dimensions
+ 37,
+ 37, //< Requested dimensions
+ 37,
+ 37, //< Expected output dimensions
+ TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensions2ComponentPair(image,
+ 600,
+ 600, //< Input dimensions
+ 34,
+ 35, //< Requested dimensions to scale-down to
+ 37,
+ 37, //< Expected output dimensions achieved
+ TEST_LOCATION);
///@note: No need to be as comprehensive as with RGB888 and RGBA8888 as the logic is shared.
END_TEST;
{
// Simple test that a null pointer does not get dereferenced in the function:
unsigned int outWidth, outHeight;
- DownscaleInPlacePow2SingleBytePerPixel( 0, 0, 0, 0, 0, BoxDimensionTestBoth, outWidth, outHeight );
+ DownscaleInPlacePow2SingleBytePerPixel(0, 0, 0, 0, 0, BoxDimensionTestBoth, outWidth, outHeight);
// Tests of output dimensions from downscaling:
- uint8_t image[608*608];
- for( unsigned i = 0; i < sizeof(image) / sizeof(image[0]); ++i )
+ uint8_t image[608 * 608];
+ for(unsigned i = 0; i < sizeof(image) / sizeof(image[0]); ++i)
{
image[i] = 0xff;
}
- TestDownscaleOutputsExpectedDimensionsSingleComponent( image,
- 600, 300, //< Input dimensions
- 150, 75, //< Requested dimensions to scale-down to
- 150, 75, //< Expected output dimensions achieved
- TEST_LOCATION );
- TestDownscaleOutputsExpectedDimensionsSingleComponent( image, 577, 411, 142, 99, 144, 102, TEST_LOCATION );
+ TestDownscaleOutputsExpectedDimensionsSingleComponent(image,
+ 600,
+ 300, //< Input dimensions
+ 150,
+ 75, //< Requested dimensions to scale-down to
+ 150,
+ 75, //< Expected output dimensions achieved
+ TEST_LOCATION);
+ TestDownscaleOutputsExpectedDimensionsSingleComponent(image, 577, 411, 142, 99, 144, 102, TEST_LOCATION);
END_TEST;
}
int UtcDaliImageOperationsHalveScanlineInPlaceRGB888(void)
{
// Red and cyan, averaging to grey:
- unsigned char shortEven[] = { 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff };
- unsigned char shortOdd[] = { 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff, 0xC, 0xC, 0xC };
+ unsigned char shortEven[] = {0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff};
+ unsigned char shortOdd[] = {0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff, 0xC, 0xC, 0xC};
+
+ Dali::Internal::Platform::HalveScanlineInPlaceRGB888(shortEven, 4u);
+ Dali::Internal::Platform::HalveScanlineInPlaceRGB888(shortOdd, 4u);
- Dali::Internal::Platform::HalveScanlineInPlaceRGB888( shortEven, 4u );
- Dali::Internal::Platform::HalveScanlineInPlaceRGB888( shortOdd, 4u );
- for( unsigned i = 0; i < sizeof(shortEven) >> 1u ; ++i )
+ for(unsigned i = 0; i < (sizeof(shortEven) >> 1u); ++i)
{
- DALI_TEST_EQUALS( unsigned(shortEven[i]), 0x7fu, TEST_LOCATION );
- DALI_TEST_EQUALS( unsigned(shortOdd[i]), 0x7fu, TEST_LOCATION );
+ DALI_TEST_EQUALS(unsigned(shortEven[i]), 0x7fu, TEST_LOCATION);
+ DALI_TEST_EQUALS(unsigned(shortOdd[i]), 0x7fu, TEST_LOCATION);
}
END_TEST;
*/
int UtcDaliImageOperationsHalveScanlineInPlaceRGBA8888(void)
{
- const size_t scanlineLength = 4096u;
+ const size_t scanlineLength = 4096u;
Dali::Vector<uint32_t> scanline;
Dali::Vector<uint32_t> reference;
- SetupScanlineForHalvingTestsRGBA8888( scanlineLength, scanline, reference );
+ SetupScanlineForHalvingTestsRGBA8888(scanlineLength, scanline, reference);
- HalveScanlineInPlaceRGBA8888( (uint8_t *) &scanline[0], scanlineLength );
+ HalveScanlineInPlaceRGBA8888((uint8_t*)&scanline[0], scanlineLength);
// Check that the halving matches the independently calculated reference:
size_t numMatches = 0;
- for( int i = 0, length = reference.Size(); i < length; ++i )
+ for(int i = 0, length = reference.Size(); i < length; ++i)
{
- DALI_TEST_EQUALS( scanline[i], reference[i], TEST_LOCATION );
+ DALI_TEST_EQUALS(scanline[i], reference[i], TEST_LOCATION);
numMatches += scanline[i] == reference[i];
}
- DALI_TEST_EQUALS( numMatches, scanlineLength / 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(numMatches, scanlineLength / 2, TEST_LOCATION);
// Test for no beyond-bounds writes:
- for( size_t i = scanlineLength / 2; i < reference.Capacity(); ++i )
+ for(size_t i = scanlineLength / 2; i < reference.Capacity(); ++i)
{
- DALI_TEST_EQUALS( reference[i], (uint32_t)0xEEEEEEEE, TEST_LOCATION );
+ DALI_TEST_EQUALS(reference[i], (uint32_t)0xEEEEEEEE, TEST_LOCATION);
}
END_TEST;
*/
int UtcDaliImageOperationsHalveScanlineInPlaceRGB565(void)
{
- const size_t scanlineLength = 4096u;
+ const size_t scanlineLength = 4096u;
Dali::Vector<uint16_t> scanline;
Dali::Vector<uint16_t> reference;
- SetupScanlineForHalvingTestsRGB565( scanlineLength, scanline, reference );
+ SetupScanlineForHalvingTestsRGB565(scanlineLength, scanline, reference);
- HalveScanlineInPlaceRGB565( (unsigned char *) (&scanline[0]), scanlineLength );
+ HalveScanlineInPlaceRGB565((unsigned char*)(&scanline[0]), scanlineLength);
// Check output against reference:
size_t numMatches = 0;
- for( int i = 0, length = reference.Size(); i < length; ++i )
+ for(int i = 0, length = reference.Size(); i < length; ++i)
{
- DALI_TEST_EQUALS( scanline[i], reference[i], TEST_LOCATION );
+ DALI_TEST_EQUALS(scanline[i], reference[i], TEST_LOCATION);
numMatches += scanline[i] == reference[i];
}
- DALI_TEST_EQUALS( numMatches, scanlineLength / 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(numMatches, scanlineLength / 2, TEST_LOCATION);
// Test for no beyond-bounds writes:
- for( size_t i = scanlineLength / 2; i < reference.Capacity(); ++i )
+ for(size_t i = scanlineLength / 2; i < reference.Capacity(); ++i)
{
- DALI_TEST_EQUALS( reference[i], (uint16_t)0xEEEE, TEST_LOCATION );
+ DALI_TEST_EQUALS(reference[i], (uint16_t)0xEEEE, TEST_LOCATION);
}
END_TEST;
*/
int UtcDaliImageOperationsHalveScanlineInPlace2Bytes(void)
{
- const size_t scanlineLength = 4096u;
+ const size_t scanlineLength = 4096u;
Dali::Vector<uint8_t> scanline;
Dali::Vector<uint8_t> reference;
- SetupScanlineForHalvingTests2Bytes( scanlineLength, scanline, reference );
+ SetupScanlineForHalvingTests2Bytes(scanlineLength, scanline, reference);
- HalveScanlineInPlace2Bytes( &scanline[0], scanlineLength );
+ HalveScanlineInPlace2Bytes(&scanline[0], scanlineLength);
// Test the output against the reference (no differences):
size_t numMatches = 0;
- for( int i = 0, length = reference.Size(); i < length; ++i )
+ for(int i = 0, length = reference.Size(); i < length; ++i)
{
- DALI_TEST_EQUALS( 1u * scanline[i], 1u * reference[i], TEST_LOCATION );
+ DALI_TEST_EQUALS(1u * scanline[i], 1u * reference[i], TEST_LOCATION);
numMatches += scanline[i] == reference[i];
}
// The number of matching bytes should be double the number of pixels, which happens to be the original scanline length in pixels:
- DALI_TEST_EQUALS( numMatches, scanlineLength, TEST_LOCATION );
+ DALI_TEST_EQUALS(numMatches, scanlineLength, TEST_LOCATION);
END_TEST;
}
*/
int UtcDaliImageOperationsHalveScanlineInPlace1Byte(void)
{
- const size_t scanlineLength = 4096u;
+ const size_t scanlineLength = 4096u;
Dali::Vector<uint8_t> scanline;
Dali::Vector<uint8_t> reference;
- SetupScanlineForHalvingTests1Byte( scanlineLength, scanline, reference );
+ SetupScanlineForHalvingTests1Byte(scanlineLength, scanline, reference);
- HalveScanlineInPlace1Byte( &scanline[0], scanlineLength );
+ HalveScanlineInPlace1Byte(&scanline[0], scanlineLength);
// Test the reference matches the output:
size_t numMatches = 0;
- for( int i = 0, length = reference.Size(); i < length; ++i )
+ for(int i = 0, length = reference.Size(); i < length; ++i)
{
- DALI_TEST_EQUALS( 1u * scanline[i], 1u * reference[i], TEST_LOCATION );
+ DALI_TEST_EQUALS(1u * scanline[i], 1u * reference[i], TEST_LOCATION);
numMatches += scanline[i] == reference[i];
}
- DALI_TEST_EQUALS( numMatches, scanlineLength / 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(numMatches, scanlineLength / 2, TEST_LOCATION);
END_TEST;
}
int UtcDaliImageOperationsAverageScanlines1(void)
{
// Red and cyan, averaging to grey:
- unsigned char shortEven1[] = { 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff };
- unsigned char shortEven2[] = { 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0 };
+ unsigned char shortEven1[] = {0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff};
+ unsigned char shortEven2[] = {0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0};
unsigned char outputBuffer[sizeof(shortEven1)];
- AverageScanlines1( shortEven1, shortEven2, outputBuffer, sizeof(shortEven1) );
- for( unsigned i = 0; i < sizeof(shortEven1) ; ++i )
+ AverageScanlines1(shortEven1, shortEven2, outputBuffer, sizeof(shortEven1));
+ for(unsigned i = 0; i < sizeof(shortEven1); ++i)
{
- DALI_TEST_EQUALS( unsigned(outputBuffer[i]), 0x7fu, TEST_LOCATION );
+ DALI_TEST_EQUALS(unsigned(outputBuffer[i]), 0x7fu, TEST_LOCATION);
}
// Longer test reusing RGBA setup/test logic:
- const size_t scanlineLength = 4096u;
+ const size_t scanlineLength = 4096u;
Dali::Vector<uint32_t> scanline1;
Dali::Vector<uint32_t> scanline2;
Dali::Vector<uint32_t> reference;
Dali::Vector<uint32_t> output;
- SetupScanlinesRGBA8888( scanlineLength, scanline1, scanline2, reference, output );
+ SetupScanlinesRGBA8888(scanlineLength, scanline1, scanline2, reference, output);
- AverageScanlines1( (const unsigned char*) &scanline1[0], (const unsigned char*) &scanline2[0], (unsigned char*) &output[0], scanlineLength * 4 );
+ AverageScanlines1((const unsigned char*)&scanline1[0], (const unsigned char*)&scanline2[0], (unsigned char*)&output[0], scanlineLength * 4);
// Check the output matches the independently generated reference:
size_t numMatches = 0;
- MatchScanlinesRGBA8888( reference, output, numMatches, TEST_LOCATION );
- DALI_TEST_EQUALS( numMatches, reference.Capacity(), TEST_LOCATION );
+ MatchScanlinesRGBA8888(reference, output, numMatches, TEST_LOCATION);
+ DALI_TEST_EQUALS(numMatches, reference.Capacity(), TEST_LOCATION);
END_TEST;
}
int UtcDaliImageOperationsAverageScanlines2(void)
{
// Red and cyan, averaging to grey:
- unsigned char shortEven1[] = { 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff };
- unsigned char shortEven2[] = { 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0 };
+ unsigned char shortEven1[] = {0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff};
+ unsigned char shortEven2[] = {0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0};
unsigned char outputBuffer[sizeof(shortEven1)];
- AverageScanlines2( shortEven1, shortEven2, outputBuffer, sizeof(shortEven1) / 2 );
+ AverageScanlines2(shortEven1, shortEven2, outputBuffer, sizeof(shortEven1) / 2);
- for( unsigned i = 0; i < sizeof(shortEven1); ++i )
+ for(unsigned i = 0; i < sizeof(shortEven1); ++i)
{
- DALI_TEST_EQUALS( unsigned(outputBuffer[i]), 0x7fu, TEST_LOCATION );
+ DALI_TEST_EQUALS(unsigned(outputBuffer[i]), 0x7fu, TEST_LOCATION);
}
// Longer test reusing RGBA setup/test logic:
- const size_t scanlineLength = 4096u;
+ const size_t scanlineLength = 4096u;
Dali::Vector<uint32_t> scanline1;
Dali::Vector<uint32_t> scanline2;
Dali::Vector<uint32_t> reference;
Dali::Vector<uint32_t> output;
- SetupScanlinesRGBA8888( scanlineLength, scanline1, scanline2, reference, output );
+ SetupScanlinesRGBA8888(scanlineLength, scanline1, scanline2, reference, output);
- AverageScanlines2( (const unsigned char*) &scanline1[0], (const unsigned char*) &scanline2[0], (unsigned char*) &output[0], scanlineLength * 2 );
+ AverageScanlines2((const unsigned char*)&scanline1[0], (const unsigned char*)&scanline2[0], (unsigned char*)&output[0], scanlineLength * 2);
// Check the output matches the independently generated reference:
size_t numMatches = 0;
- MatchScanlinesRGBA8888( reference, output, numMatches, TEST_LOCATION );
- DALI_TEST_EQUALS( numMatches, reference.Capacity(), TEST_LOCATION );
+ MatchScanlinesRGBA8888(reference, output, numMatches, TEST_LOCATION);
+ DALI_TEST_EQUALS(numMatches, reference.Capacity(), TEST_LOCATION);
END_TEST;
}
int UtcDaliImageOperationsAverageScanlines3(void)
{
// Red and cyan, averaging to grey:
- unsigned char shortEven1[] = { 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff };
- unsigned char shortEven2[] = { 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0 };
+ unsigned char shortEven1[] = {0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff};
+ unsigned char shortEven2[] = {0, 0xff, 0xff, 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0};
unsigned char outputBuffer[sizeof(shortEven1)];
- AverageScanlines3( shortEven1, shortEven2, outputBuffer, sizeof(shortEven1) / 3 );
- for( unsigned i = 0; i < sizeof(shortEven1) ; ++i )
+ AverageScanlines3(shortEven1, shortEven2, outputBuffer, sizeof(shortEven1) / 3);
+ for(unsigned i = 0; i < sizeof(shortEven1); ++i)
{
- DALI_TEST_EQUALS( unsigned(outputBuffer[i]), 0x7fu, TEST_LOCATION );
+ DALI_TEST_EQUALS(unsigned(outputBuffer[i]), 0x7fu, TEST_LOCATION);
}
// Longer test reusing RGBA setup/test logic:
- const size_t scanlineLength = 3 * 4 * 90u;
+ const size_t scanlineLength = 3 * 4 * 90u;
Dali::Vector<uint32_t> scanline1;
Dali::Vector<uint32_t> scanline2;
Dali::Vector<uint32_t> reference;
Dali::Vector<uint32_t> output;
- SetupScanlinesRGBA8888( scanlineLength, scanline1, scanline2, reference, output );
+ SetupScanlinesRGBA8888(scanlineLength, scanline1, scanline2, reference, output);
- AverageScanlines3( (const unsigned char*) &scanline1[0], (const unsigned char*) &scanline2[0], (unsigned char*) &output[0], scanlineLength * 4 / 3 );
+ AverageScanlines3((const unsigned char*)&scanline1[0], (const unsigned char*)&scanline2[0], (unsigned char*)&output[0], scanlineLength * 4 / 3);
// Check the output matches the independently generated reference:
size_t numMatches = 0;
- MatchScanlinesRGBA8888( reference, output, numMatches, TEST_LOCATION );
- DALI_TEST_EQUALS( numMatches, reference.Capacity(), TEST_LOCATION );
+ MatchScanlinesRGBA8888(reference, output, numMatches, TEST_LOCATION);
+ DALI_TEST_EQUALS(numMatches, reference.Capacity(), TEST_LOCATION);
END_TEST;
}
*/
int UtcDaliImageOperationsAverageScanlinesRGBA8888(void)
{
- const size_t scanlineLength = 4096u;
+ const size_t scanlineLength = 4096u;
Dali::Vector<uint32_t> scanline1;
Dali::Vector<uint32_t> scanline2;
Dali::Vector<uint32_t> reference;
Dali::Vector<uint32_t> output;
- SetupScanlinesRGBA8888( scanlineLength, scanline1, scanline2, reference, output );
+ SetupScanlinesRGBA8888(scanlineLength, scanline1, scanline2, reference, output);
- AverageScanlinesRGBA8888( (const unsigned char*) &scanline1[0], (const unsigned char*) &scanline2[0], (unsigned char*) &output[0], scanlineLength );
+ AverageScanlinesRGBA8888((const unsigned char*)&scanline1[0], (const unsigned char*)&scanline2[0], (unsigned char*)&output[0], scanlineLength);
// Check the output matches the independently generated reference:
size_t numMatches = 0;
- MatchScanlinesRGBA8888( reference, output, numMatches, TEST_LOCATION );
- DALI_TEST_EQUALS( numMatches, reference.Capacity(), TEST_LOCATION );
+ MatchScanlinesRGBA8888(reference, output, numMatches, TEST_LOCATION);
+ DALI_TEST_EQUALS(numMatches, reference.Capacity(), TEST_LOCATION);
END_TEST;
}
int UtcDaliImageOperationsAverageScanlinesRGB565(void)
{
// Red and cyan, averaging to grey:
- const uint16_t shortEven1[] = { 0xf800, 0xf800, 0xf800, 0xf800, 0xf800, 0xf800, 0xBEEF, 0xBEEF };
- const uint16_t shortEven2[] = { 0x7ff, 0x7ff, 0x7ff, 0x7ff, 0x7ff, 0x7ff, 0xBEEF, 0xBEEF };
- const size_t arrayLength = sizeof(shortEven1) / sizeof(shortEven1[0]) - 2;
- uint16_t outputBuffer[arrayLength + 2];
- outputBuffer[arrayLength] = 0xDEAD;
- outputBuffer[arrayLength+1] = 0xDEAD;
-
- Dali::Internal::Platform::AverageScanlinesRGB565( (const unsigned char*) shortEven1, (const unsigned char*) shortEven2, (unsigned char*) outputBuffer, arrayLength );
- for( unsigned i = 0; i < arrayLength ; ++i )
+ const uint16_t shortEven1[] = {0xf800, 0xf800, 0xf800, 0xf800, 0xf800, 0xf800, 0xBEEF, 0xBEEF};
+ const uint16_t shortEven2[] = {0x7ff, 0x7ff, 0x7ff, 0x7ff, 0x7ff, 0x7ff, 0xBEEF, 0xBEEF};
+ const size_t arrayLength = sizeof(shortEven1) / sizeof(shortEven1[0]) - 2;
+ uint16_t outputBuffer[arrayLength + 2];
+ outputBuffer[arrayLength] = 0xDEAD;
+ outputBuffer[arrayLength + 1] = 0xDEAD;
+
+ Dali::Internal::Platform::AverageScanlinesRGB565((const unsigned char*)shortEven1, (const unsigned char*)shortEven2, (unsigned char*)outputBuffer, arrayLength);
+ for(unsigned i = 0; i < arrayLength; ++i)
{
- DALI_TEST_EQUALS( unsigned(outputBuffer[i]), 0xffff - (1u << 15) - (1u << 10) - (1u << 4), TEST_LOCATION );
+ DALI_TEST_EQUALS(unsigned(outputBuffer[i]), 0xffff - (1u << 15) - (1u << 10) - (1u << 4), TEST_LOCATION);
}
// Check for buffer overrun:
- DALI_TEST_EQUALS( outputBuffer[arrayLength], (uint16_t)0xDEAD, TEST_LOCATION );
- DALI_TEST_EQUALS( outputBuffer[arrayLength+1], (uint16_t)0xDEAD, TEST_LOCATION );
+ DALI_TEST_EQUALS(outputBuffer[arrayLength], (uint16_t)0xDEAD, TEST_LOCATION);
+ DALI_TEST_EQUALS(outputBuffer[arrayLength + 1], (uint16_t)0xDEAD, TEST_LOCATION);
END_TEST;
}
namespace
{
-
-void MakeSingleColorImageRGBA8888( unsigned int width, unsigned int height, uint32_t *inputImage )
+void MakeSingleColorImageRGBA8888(unsigned int width, unsigned int height, uint32_t* inputImage)
{
- const uint32_t inPixel = PixelRGBA8888( 255, 192, 128, 64 );
- for( unsigned int i = 0; i < width * height; ++i )
+ const uint32_t inPixel = PixelRGBA8888(255, 192, 128, 64);
+ for(unsigned int i = 0; i < width * height; ++i)
{
inputImage[i] = inPixel;
}
* @brief Make an image with a checkerboard pattern.
* @note This is an easy pattern to scan for correctness after a downscaling test.
*/
-Dali::IntrusivePtr<Dali::RefCountedVector<uint32_t> > MakeCheckerboardImageRGBA8888( unsigned int width, unsigned int height, unsigned int checkerSize )
+Dali::IntrusivePtr<Dali::RefCountedVector<uint32_t> > MakeCheckerboardImageRGBA8888(unsigned int width, unsigned int height, unsigned int checkerSize)
{
- const unsigned int imageWidth = width * checkerSize;
- const unsigned int imageHeight = height * checkerSize;
- Dali::IntrusivePtr<Dali::RefCountedVector<uint32_t> > image = new Dali::RefCountedVector<uint32_t>;
- image->GetVector().Resize( imageWidth * imageHeight );
+ const unsigned int imageWidth = width * checkerSize;
+ const unsigned int imageHeight = height * checkerSize;
+ Dali::IntrusivePtr<Dali::RefCountedVector<uint32_t> > image = new Dali::RefCountedVector<uint32_t>;
+ image->GetVector().Resize(imageWidth * imageHeight);
uint32_t rowColor = 0xffffffff;
- for( unsigned int cy = 0; cy < height; ++cy )
+ for(unsigned int cy = 0; cy < height; ++cy)
{
- rowColor = rowColor == 0xffffffff ? 0xff000000 : 0xffffffff;
+ rowColor = rowColor == 0xffffffff ? 0xff000000 : 0xffffffff;
uint32_t checkColor = rowColor;
- for( unsigned int cx = 0; cx < width; ++cx )
+ for(unsigned int cx = 0; cx < width; ++cx)
{
- checkColor = checkColor == 0xffffffff ? 0xff000000 : 0xffffffff;
+ checkColor = checkColor == 0xffffffff ? 0xff000000 : 0xffffffff;
uint32_t paintedColor = checkColor;
// Draw 3 special case checks as r,g,b:
if(cx == 0 && cy == 0)
{
- paintedColor = 0xff0000ff;// Red
+ paintedColor = 0xff0000ff; // Red
}
else if(cx == 7 && cy == 0)
{
- paintedColor = 0xff00ff00;// Green
+ paintedColor = 0xff00ff00; // Green
}
else if(cx == 7 && cy == 7)
{
- paintedColor = 0xffff0000;// blue
+ paintedColor = 0xffff0000; // blue
}
- uint32_t * check = &image->GetVector()[ (cy * checkerSize * imageWidth) + (cx * checkerSize)];
- for( unsigned int py = 0; py < checkerSize; ++py )
+ uint32_t* check = &image->GetVector()[(cy * checkerSize * imageWidth) + (cx * checkerSize)];
+ for(unsigned int py = 0; py < checkerSize; ++py)
{
- uint32_t * checkLine = check + py * imageWidth;
- for( unsigned int px = 0; px < checkerSize; ++px )
+ uint32_t* checkLine = check + py * imageWidth;
+ for(unsigned int px = 0; px < checkerSize; ++px)
{
checkLine[px] = paintedColor;
}
return image;
}
-}
+} // namespace
/**
* @brief Test the right pixels are generated when downsampling a checkerboard into a small image.
*/
int UtcDaliImageOperationsPointSampleCheckerboardRGBA888(void)
{
- Dali::IntrusivePtr<Dali::RefCountedVector<uint32_t> > image = MakeCheckerboardImageRGBA8888( 8, 8, 32 );
- const unsigned int desiredWidth = 8;
- const unsigned int desiredHeight = 8;
+ Dali::IntrusivePtr<Dali::RefCountedVector<uint32_t> > image = MakeCheckerboardImageRGBA8888(8, 8, 32);
+ const unsigned int desiredWidth = 8;
+ const unsigned int desiredHeight = 8;
- uint32_t outputImage[ desiredWidth * desiredHeight ];
+ uint32_t outputImage[desiredWidth * desiredHeight];
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) &image->GetVector()[0], 256, 256, (unsigned char*) outputImage, desiredWidth, desiredHeight );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)&image->GetVector()[0], 256, 256, (unsigned char*)outputImage, desiredWidth, desiredHeight);
- DALI_TEST_EQUALS( outputImage[0], (uint32_t)0xff0000ff, TEST_LOCATION ); // < Red corner pixel
- DALI_TEST_EQUALS( outputImage[7], (uint32_t)0xff00ff00, TEST_LOCATION ); // < Green corner pixel
- DALI_TEST_EQUALS( outputImage[8*8-1], (uint32_t)0xffff0000, TEST_LOCATION ); // < Blue corner pixel
+ DALI_TEST_EQUALS(outputImage[0], (uint32_t)0xff0000ff, TEST_LOCATION); // < Red corner pixel
+ DALI_TEST_EQUALS(outputImage[7], (uint32_t)0xff00ff00, TEST_LOCATION); // < Green corner pixel
+ DALI_TEST_EQUALS(outputImage[8 * 8 - 1], (uint32_t)0xffff0000, TEST_LOCATION); // < Blue corner pixel
- DALI_TEST_EQUALS( outputImage[1], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[2], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[3], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[4], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[5], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[6], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
+ DALI_TEST_EQUALS(outputImage[1], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[2], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[3], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[4], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[5], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[6], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
// Second scanline:
- DALI_TEST_EQUALS( outputImage[8+0], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[8+1], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[8+2], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[8+3], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[8+4], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[8+5], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[8+6], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[8+7], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
+ DALI_TEST_EQUALS(outputImage[8 + 0], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[8 + 1], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[8 + 2], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[8 + 3], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[8 + 4], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[8 + 5], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[8 + 6], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[8 + 7], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
// Third scanline:
- DALI_TEST_EQUALS( outputImage[16+0], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[16+1], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[16+2], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[16+3], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[16+4], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[16+5], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[16+6], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[16+7], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
+ DALI_TEST_EQUALS(outputImage[16 + 0], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[16 + 1], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[16 + 2], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[16 + 3], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[16 + 4], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[16 + 5], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[16 + 6], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[16 + 7], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
// ... could do more scanlines (there are 8)
// Sample a few more pixels:
// Diagonals:
- DALI_TEST_EQUALS( outputImage[24+3], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[32+4], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[40+5], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[48+6], (uint32_t)0xffffffff, TEST_LOCATION ); // < white pixel
- DALI_TEST_EQUALS( outputImage[24+4], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[32+3], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[40+2], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[48+1], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
- DALI_TEST_EQUALS( outputImage[56+0], (uint32_t)0xff000000, TEST_LOCATION ); // < black pixel
+ DALI_TEST_EQUALS(outputImage[24 + 3], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[32 + 4], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[40 + 5], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[48 + 6], (uint32_t)0xffffffff, TEST_LOCATION); // < white pixel
+ DALI_TEST_EQUALS(outputImage[24 + 4], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[32 + 3], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[40 + 2], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[48 + 1], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
+ DALI_TEST_EQUALS(outputImage[56 + 0], (uint32_t)0xff000000, TEST_LOCATION); // < black pixel
END_TEST;
}
*/
int UtcDaliImageOperationsPointSampleRGBA888PixelsCorrectColor(void)
{
- const unsigned int inputWidth = 137;
- const unsigned int inputHeight = 571;
- const unsigned int desiredWidth = 59;
+ const unsigned int inputWidth = 137;
+ const unsigned int inputHeight = 571;
+ const unsigned int desiredWidth = 59;
const unsigned int desiredHeight = 257;
- uint32_t inputImage[ inputWidth * inputHeight ];
- MakeSingleColorImageRGBA8888( inputWidth, inputHeight, inputImage );
+ uint32_t inputImage[inputWidth * inputHeight];
+ MakeSingleColorImageRGBA8888(inputWidth, inputHeight, inputImage);
- const size_t outputBufferSize = desiredWidth * desiredHeight;
- std::vector< uint32_t > buffer;
- buffer.resize( outputBufferSize );
+ const size_t outputBufferSize = desiredWidth * desiredHeight;
+ std::vector<uint32_t> buffer;
+ buffer.resize(outputBufferSize);
uint32_t* outputImage = &buffer[0];
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, inputWidth, inputHeight, (unsigned char*) outputImage, desiredWidth, desiredHeight );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, inputWidth, inputHeight, (unsigned char*)outputImage, desiredWidth, desiredHeight);
// Check that all the output pixels are the right color:
- const uint32_t reference = inputImage[ inputWidth * inputHeight / 2];
- unsigned int differentColorCount = 0;
- for( unsigned int i = 0; i < desiredWidth * desiredHeight; ++i )
+ const uint32_t reference = inputImage[inputWidth * inputHeight / 2];
+ unsigned int differentColorCount = 0;
+ for(unsigned int i = 0; i < desiredWidth * desiredHeight; ++i)
{
- if( outputImage[i] != reference )
+ if(outputImage[i] != reference)
{
++differentColorCount;
}
}
- DALI_TEST_EQUALS( 0U, differentColorCount, TEST_LOCATION );
+ DALI_TEST_EQUALS(0U, differentColorCount, TEST_LOCATION);
END_TEST;
}
*/
int UtcDaliImageOperationsPointSampleRGBA888ScaleToSinglePixel(void)
{
- const unsigned int desiredWidth = 1;
+ const unsigned int desiredWidth = 1;
const unsigned int desiredHeight = 1;
- uint32_t inputImage[ 1024 * 1024 ];
- MakeSingleColorImageRGBA8888( 1024, 1024, inputImage );
+ uint32_t inputImage[1024 * 1024];
+ MakeSingleColorImageRGBA8888(1024, 1024, inputImage);
uint32_t outputImage = 0;
// Try several different starting image sizes:
// 1x1 -> 1x1:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 1, 1, (unsigned char*) &outputImage, desiredWidth, desiredHeight );
- DALI_TEST_EQUALS( outputImage, inputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 1, 1, (unsigned char*)&outputImage, desiredWidth, desiredHeight);
+ DALI_TEST_EQUALS(outputImage, inputImage[0], TEST_LOCATION);
outputImage = 0;
// Single-pixel wide tall stripe:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 1, 1024, (unsigned char*) &outputImage, desiredWidth, desiredHeight );
- DALI_TEST_EQUALS( outputImage, inputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 1, 1024, (unsigned char*)&outputImage, desiredWidth, desiredHeight);
+ DALI_TEST_EQUALS(outputImage, inputImage[0], TEST_LOCATION);
outputImage = 0;
// Single-pixel tall, wide strip:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 1024, 1, (unsigned char*) &outputImage, desiredWidth, desiredHeight );
- DALI_TEST_EQUALS( outputImage, inputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 1024, 1, (unsigned char*)&outputImage, desiredWidth, desiredHeight);
+ DALI_TEST_EQUALS(outputImage, inputImage[0], TEST_LOCATION);
outputImage = 0;
// Square mid-size image:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 103, 103, (unsigned char*) &outputImage, desiredWidth, desiredHeight );
- DALI_TEST_EQUALS( outputImage, inputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 103, 103, (unsigned char*)&outputImage, desiredWidth, desiredHeight);
+ DALI_TEST_EQUALS(outputImage, inputImage[0], TEST_LOCATION);
outputImage = 0;
// Wide mid-size image:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 313, 79, (unsigned char*) &outputImage, desiredWidth, desiredHeight );
- DALI_TEST_EQUALS( outputImage, inputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 313, 79, (unsigned char*)&outputImage, desiredWidth, desiredHeight);
+ DALI_TEST_EQUALS(outputImage, inputImage[0], TEST_LOCATION);
outputImage = 0;
// Tall mid-size image:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 53, 467, (unsigned char*) &outputImage, desiredWidth, desiredHeight );
- DALI_TEST_EQUALS( outputImage, inputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 53, 467, (unsigned char*)&outputImage, desiredWidth, desiredHeight);
+ DALI_TEST_EQUALS(outputImage, inputImage[0], TEST_LOCATION);
outputImage = 0;
// 0 x 0 input image (make sure output not written to):
outputImage = 0xDEADBEEF;
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 0, 0, (unsigned char*) &outputImage, desiredWidth, desiredHeight );
- DALI_TEST_EQUALS( outputImage, (uint32_t)0xDEADBEEF, TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 0, 0, (unsigned char*)&outputImage, desiredWidth, desiredHeight);
+ DALI_TEST_EQUALS(outputImage, (uint32_t)0xDEADBEEF, TEST_LOCATION);
outputImage = 0;
END_TEST;
*/
int UtcDaliImageOperationsPointSampleRGBA888N(void)
{
- uint32_t inputImage[ 128 * 128 ];
- MakeSingleColorImageRGBA8888( 128, 128, inputImage );
- uint32_t outputImage[ 128 * 128 ];
- memset( outputImage, 0xaa, 128 * 128 * sizeof(uint32_t) );
+ uint32_t inputImage[128 * 128];
+ MakeSingleColorImageRGBA8888(128, 128, inputImage);
+ uint32_t outputImage[128 * 128];
+ memset(outputImage, 0xaa, 128 * 128 * sizeof(uint32_t));
// Try several different starting image sizes:
// 1x1 -> 1x1:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 1, 1, (unsigned char*) outputImage, 0, 0 );
- DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 1, 1, (unsigned char*)outputImage, 0, 0);
+ DALI_TEST_EQUALS(0xaaaaaaaa, outputImage[0], TEST_LOCATION);
// Single-pixel wide tall stripe:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 1, 102, (unsigned char*) outputImage, 0, 33 );
- DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 1, 102, (unsigned char*)outputImage, 0, 33);
+ DALI_TEST_EQUALS(0xaaaaaaaa, outputImage[0], TEST_LOCATION);
// Single-pixel tall, wide strip:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 102, 1, (unsigned char*) outputImage, 0, 67 );
- DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 102, 1, (unsigned char*)outputImage, 0, 67);
+ DALI_TEST_EQUALS(0xaaaaaaaa, outputImage[0], TEST_LOCATION);
// Square mid-size image:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 103, 103, (unsigned char*) outputImage, 21, 0 );
- DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 103, 103, (unsigned char*)outputImage, 21, 0);
+ DALI_TEST_EQUALS(0xaaaaaaaa, outputImage[0], TEST_LOCATION);
// Wide mid-size image to 0 height
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 313, 79, (unsigned char*) outputImage, 99, 0 );
- DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 313, 79, (unsigned char*)outputImage, 99, 0);
+ DALI_TEST_EQUALS(0xaaaaaaaa, outputImage[0], TEST_LOCATION);
// Tall mid-size image to 0 height, over width
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 53, 46, (unsigned char*) outputImage, 9999, 0 );
- DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 53, 46, (unsigned char*)outputImage, 9999, 0);
+ DALI_TEST_EQUALS(0xaaaaaaaa, outputImage[0], TEST_LOCATION);
// 0 x 0 input image:
- Dali::Internal::Platform::PointSample4BPP( (const unsigned char *) inputImage, 0, 0, (unsigned char*) outputImage, 200, 99 );
- DALI_TEST_EQUALS( 0xaaaaaaaa, outputImage[0], TEST_LOCATION );
+ Dali::Internal::Platform::PointSample4BPP((const unsigned char*)inputImage, 0, 0, (unsigned char*)outputImage, 200, 99);
+ DALI_TEST_EQUALS(0xaaaaaaaa, outputImage[0], TEST_LOCATION);
END_TEST;
}
*/
int UtcDaliImageOperationsUint16Pair(void)
{
- Uint16Pair vec1( 2, 3 );
+ Uint16Pair vec1(2, 3);
- DALI_TEST_EQUALS( vec1.GetWidth(), (uint16_t)2, TEST_LOCATION );
- DALI_TEST_EQUALS( vec1.GetX(), (uint16_t)2, TEST_LOCATION );
+ DALI_TEST_EQUALS(vec1.GetWidth(), (uint16_t)2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec1.GetX(), (uint16_t)2, TEST_LOCATION);
- DALI_TEST_EQUALS( vec1.GetHeight(), (uint16_t)3, TEST_LOCATION );
- DALI_TEST_EQUALS( vec1.GetY(), (uint16_t)3, TEST_LOCATION );
+ DALI_TEST_EQUALS(vec1.GetHeight(), (uint16_t)3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec1.GetY(), (uint16_t)3, TEST_LOCATION);
Uint16Pair vec1Copy = vec1;
- DALI_TEST_EQUALS( vec1Copy.GetWidth(), (uint16_t)2, TEST_LOCATION );
- DALI_TEST_EQUALS( vec1Copy.GetX(), (uint16_t)2, TEST_LOCATION );
+ DALI_TEST_EQUALS(vec1Copy.GetWidth(), (uint16_t)2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec1Copy.GetX(), (uint16_t)2, TEST_LOCATION);
- DALI_TEST_EQUALS( vec1Copy.GetHeight(), (uint16_t)3, TEST_LOCATION );
- DALI_TEST_EQUALS( vec1Copy.GetY(), (uint16_t)3, TEST_LOCATION );
+ DALI_TEST_EQUALS(vec1Copy.GetHeight(), (uint16_t)3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec1Copy.GetY(), (uint16_t)3, TEST_LOCATION);
- Uint16Pair vec2( 65535u, 65535u );
+ Uint16Pair vec2(65535u, 65535u);
- DALI_TEST_EQUALS( vec2.GetX(), (uint16_t)65535u, TEST_LOCATION );
- DALI_TEST_EQUALS( vec2.GetY(), (uint16_t)65535u, TEST_LOCATION );
+ DALI_TEST_EQUALS(vec2.GetX(), (uint16_t)65535u, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec2.GetY(), (uint16_t)65535u, TEST_LOCATION);
END_TEST;
}
int UtcDaliImageOperationsBilinearFilter1BPP(void)
{
// Zeros blend to zero:
- DALI_TEST_EQUALS( 0u, BilinearFilter1Component( 0, 0, 0, 0, 0, 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, BilinearFilter1Component( 0, 0, 0, 0, 32768, 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, BilinearFilter1Component( 0, 0, 0, 0, 65535, 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, BilinearFilter1Component( 0, 0, 0, 0, 0, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, BilinearFilter1Component( 0, 0, 0, 0, 0, 65535 ), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, BilinearFilter1Component(0, 0, 0, 0, 0, 0), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, BilinearFilter1Component(0, 0, 0, 0, 32768, 0), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, BilinearFilter1Component(0, 0, 0, 0, 65535, 0), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, BilinearFilter1Component(0, 0, 0, 0, 0, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, BilinearFilter1Component(0, 0, 0, 0, 0, 65535), TEST_LOCATION);
// Ones and zeros average to 0.5:
- DALI_TEST_EQUALS( 127u, BilinearFilter1Component( 255, 0, 0, 255, 32768, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 127u, BilinearFilter1Component( 0, 255, 0, 255, 32768, 32768 ), TEST_LOCATION );
+ DALI_TEST_EQUALS(127u, BilinearFilter1Component(255, 0, 0, 255, 32768, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(127u, BilinearFilter1Component(0, 255, 0, 255, 32768, 32768), TEST_LOCATION);
// Quarters ones average to 0.25:
- DALI_TEST_EQUALS( 64u, BilinearFilter1Component( 255, 0, 0, 0, 32768, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 64u, BilinearFilter1Component( 0, 255, 0, 0, 32768, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 64u, BilinearFilter1Component( 0, 0, 255, 0, 32768, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 64u, BilinearFilter1Component( 0, 0, 0, 255, 32768, 32768 ), TEST_LOCATION );
+ DALI_TEST_EQUALS(64u, BilinearFilter1Component(255, 0, 0, 0, 32768, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(64u, BilinearFilter1Component(0, 255, 0, 0, 32768, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(64u, BilinearFilter1Component(0, 0, 255, 0, 32768, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(64u, BilinearFilter1Component(0, 0, 0, 255, 32768, 32768), TEST_LOCATION);
// Horizontal blends:
- DALI_TEST_EQUALS( 0u, BilinearFilter1Component( 0, 255, 0, 255, 0, 32768 ), TEST_LOCATION );
- for( unsigned y = 0; y < 65536u; y += 256 )
+ DALI_TEST_EQUALS(0u, BilinearFilter1Component(0, 255, 0, 255, 0, 32768), TEST_LOCATION);
+ for(unsigned y = 0; y < 65536u; y += 256)
{
// Vertical blends don't change result in this case as there is no vertical gradient in inputs:
- DALI_TEST_EQUALS( 0u, BilinearFilter1Component( 0, 255, 0, 255, 0, y ), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, BilinearFilter1Component(0, 255, 0, 255, 0, y), TEST_LOCATION);
}
- DALI_TEST_EQUALS( 5u, BilinearFilter1Component( 0, 255, 0, 255, 1233, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 29u, BilinearFilter1Component( 0, 255, 0, 255, 7539, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 29u, BilinearFilter1Component( 0, 255, 0, 255, 7539, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 67u, BilinearFilter1Component( 0, 255, 0, 255, 17291, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 123u, BilinearFilter1Component( 0, 255, 0, 255, 31671, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 184u, BilinearFilter1Component( 0, 255, 0, 255, 47231, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 207u, BilinearFilter1Component( 0, 255, 0, 255, 53129, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 239u, BilinearFilter1Component( 0, 255, 0, 255, 61392, 32768 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 255u, BilinearFilter1Component( 0, 255, 0, 255, 65535, 32768 ), TEST_LOCATION );
+ DALI_TEST_EQUALS(5u, BilinearFilter1Component(0, 255, 0, 255, 1233, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(29u, BilinearFilter1Component(0, 255, 0, 255, 7539, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(29u, BilinearFilter1Component(0, 255, 0, 255, 7539, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(67u, BilinearFilter1Component(0, 255, 0, 255, 17291, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(123u, BilinearFilter1Component(0, 255, 0, 255, 31671, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(184u, BilinearFilter1Component(0, 255, 0, 255, 47231, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(207u, BilinearFilter1Component(0, 255, 0, 255, 53129, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(239u, BilinearFilter1Component(0, 255, 0, 255, 61392, 32768), TEST_LOCATION);
+ DALI_TEST_EQUALS(255u, BilinearFilter1Component(0, 255, 0, 255, 65535, 32768), TEST_LOCATION);
// Vertical Blends:
- DALI_TEST_EQUALS( 0u, BilinearFilter1Component( 0, 0, 255, 255, 32768, 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 60u, BilinearFilter1Component( 0, 0, 255, 255, 32768, 15379 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 130u, BilinearFilter1Component( 0, 0, 255, 255, 32768, 33451 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 186u, BilinearFilter1Component( 0, 0, 255, 255, 32768, 47836 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 244u, BilinearFilter1Component( 0, 0, 255, 255, 32768, 62731 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 255u, BilinearFilter1Component( 0, 0, 255, 255, 32768, 65535 ), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, BilinearFilter1Component(0, 0, 255, 255, 32768, 0), TEST_LOCATION);
+ DALI_TEST_EQUALS(60u, BilinearFilter1Component(0, 0, 255, 255, 32768, 15379), TEST_LOCATION);
+ DALI_TEST_EQUALS(130u, BilinearFilter1Component(0, 0, 255, 255, 32768, 33451), TEST_LOCATION);
+ DALI_TEST_EQUALS(186u, BilinearFilter1Component(0, 0, 255, 255, 32768, 47836), TEST_LOCATION);
+ DALI_TEST_EQUALS(244u, BilinearFilter1Component(0, 0, 255, 255, 32768, 62731), TEST_LOCATION);
+ DALI_TEST_EQUALS(255u, BilinearFilter1Component(0, 0, 255, 255, 32768, 65535), TEST_LOCATION);
END_TEST;
}
#include <iostream>
-#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
#include <dali-test-suite-utils.h>
test_return_value = TET_PASS;
}
-const char* ChannelToString( Dali::Internal::Adaptor::Channel channel )
+const char* ChannelToString(Dali::Internal::Adaptor::Channel channel)
{
switch(channel)
{
- case LUMINANCE: return "Luminance";
- case RED: return "Red";
- case GREEN: return "Green";
- case BLUE: return "Blue";
- case ALPHA: return "Alpha";
+ case LUMINANCE:
+ return "Luminance";
+ case RED:
+ return "Red";
+ case GREEN:
+ return "Green";
+ case BLUE:
+ return "Blue";
+ case ALPHA:
+ return "Alpha";
default:
return "Unknown";
}
}
-const char* FormatToString( Dali::Pixel::Format format )
+const char* FormatToString(Dali::Pixel::Format format)
{
switch(format)
{
- case Dali::Pixel::A8: return "A8";
- case Dali::Pixel::L8: return "L8";
- case Dali::Pixel::LA88: return "LA88";
- case Dali::Pixel::RGB565: return "RGB565";
- case Dali::Pixel::BGR565: return "BGR565";
- case Dali::Pixel::RGBA4444: return "RGBA4444";
- case Dali::Pixel::BGRA4444: return "BGRA4444";
- case Dali::Pixel::RGBA5551: return "RGBA5551";
- case Dali::Pixel::BGRA5551: return "BGRA5551";
-
- case Dali::Pixel::RGB888: return "RGB888";
- case Dali::Pixel::RGBA8888: return "RGBA8888";
- case Dali::Pixel::BGRA8888: return "BGRA8888";
+ case Dali::Pixel::A8:
+ return "A8";
+ case Dali::Pixel::L8:
+ return "L8";
+ case Dali::Pixel::LA88:
+ return "LA88";
+ case Dali::Pixel::RGB565:
+ return "RGB565";
+ case Dali::Pixel::BGR565:
+ return "BGR565";
+ case Dali::Pixel::RGBA4444:
+ return "RGBA4444";
+ case Dali::Pixel::BGRA4444:
+ return "BGRA4444";
+ case Dali::Pixel::RGBA5551:
+ return "RGBA5551";
+ case Dali::Pixel::BGRA5551:
+ return "BGRA5551";
+
+ case Dali::Pixel::RGB888:
+ return "RGB888";
+ case Dali::Pixel::RGBA8888:
+ return "RGBA8888";
+ case Dali::Pixel::BGRA8888:
+ return "BGRA8888";
default:
return "Unknown";
}
}
-
int UtcDaliPixelManipulation01(void)
{
tet_infoline("Testing Dali::Internal::AdaptorManipulation HasChannel");
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::A8, Dali::Internal::Adaptor::ALPHA ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::A8, Dali::Internal::Adaptor::LUMINANCE ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::A8, Dali::Internal::Adaptor::ALPHA), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::A8, Dali::Internal::Adaptor::LUMINANCE), false, TEST_LOCATION);
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::L8, Dali::Internal::Adaptor::LUMINANCE ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::L8, Dali::Internal::Adaptor::ALPHA ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::L8, Dali::Internal::Adaptor::LUMINANCE), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::L8, Dali::Internal::Adaptor::ALPHA), false, TEST_LOCATION);
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::LA88, Dali::Internal::Adaptor::LUMINANCE ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::LA88, Dali::Internal::Adaptor::ALPHA ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::LA88, Dali::Internal::Adaptor::RED ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::LA88, Dali::Internal::Adaptor::LUMINANCE), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::LA88, Dali::Internal::Adaptor::ALPHA), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::LA88, Dali::Internal::Adaptor::RED), false, TEST_LOCATION);
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::RGB565, Dali::Internal::Adaptor::RED ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::RGB565, Dali::Internal::Adaptor::GREEN ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::RGB565, Dali::Internal::Adaptor::BLUE ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::RGB565, Dali::Internal::Adaptor::LUMINANCE ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::RGB565, Dali::Internal::Adaptor::RED), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::RGB565, Dali::Internal::Adaptor::GREEN), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::RGB565, Dali::Internal::Adaptor::BLUE), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::RGB565, Dali::Internal::Adaptor::LUMINANCE), false, TEST_LOCATION);
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::RGBA8888, Dali::Internal::Adaptor::RED ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::RGBA8888, Dali::Internal::Adaptor::GREEN ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::RGBA8888, Dali::Internal::Adaptor::BLUE ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::RGBA8888, Dali::Internal::Adaptor::ALPHA ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::RGBA8888, Dali::Internal::Adaptor::LUMINANCE ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::RGBA8888, Dali::Internal::Adaptor::RED), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::RGBA8888, Dali::Internal::Adaptor::GREEN), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::RGBA8888, Dali::Internal::Adaptor::BLUE), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::RGBA8888, Dali::Internal::Adaptor::ALPHA), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::RGBA8888, Dali::Internal::Adaptor::LUMINANCE), false, TEST_LOCATION);
- DALI_TEST_EQUALS( Dali::Internal::Adaptor::HasChannel( Dali::Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR, Dali::Internal::Adaptor::BLUE ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(Dali::Internal::Adaptor::HasChannel(Dali::Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR, Dali::Internal::Adaptor::BLUE), false, TEST_LOCATION);
END_TEST;
}
-
-
int UtcDaliPixelManipulation02(void)
{
tet_infoline("Testing Dali::Internal::AdaptorManipulation Read/WriteChannel");
- unsigned char pixel[4] = {0,0,0,0};
+ unsigned char pixel[4] = {0, 0, 0, 0};
- for( int formatIdx=1; formatIdx<Dali::Pixel::COMPRESSED_R11_EAC; ++formatIdx)
+ for(int formatIdx = 1; formatIdx < Dali::Pixel::COMPRESSED_R11_EAC; ++formatIdx)
{
pixel[0] = 0xFF;
pixel[1] = 0xFF;
pixel[2] = 0xFF;
pixel[3] = 0xFF;
- for( int channelIdx=0; channelIdx < Dali::Internal::Adaptor::MAX_NUMBER_OF_CHANNELS; ++channelIdx )
+ for(int channelIdx = 0; channelIdx < Dali::Internal::Adaptor::MAX_NUMBER_OF_CHANNELS; ++channelIdx)
{
- Dali::Pixel::Format format = static_cast<Dali::Pixel::Format>(formatIdx);
+ Dali::Pixel::Format format = static_cast<Dali::Pixel::Format>(formatIdx);
Dali::Internal::Adaptor::Channel channel = static_cast<Dali::Internal::Adaptor::Channel>(channelIdx);
- if( Dali::Internal::Adaptor::HasChannel( format, channel ) )
+ if(Dali::Internal::Adaptor::HasChannel(format, channel))
{
- Dali::Internal::Adaptor::WriteChannel( &pixel[0], format, channel, 0x15);
- unsigned int value = Dali::Internal::Adaptor::ReadChannel( &pixel[0], format, channel );
+ Dali::Internal::Adaptor::WriteChannel(&pixel[0], format, channel, 0x15);
+ unsigned int value = Dali::Internal::Adaptor::ReadChannel(&pixel[0], format, channel);
- tet_printf( "Testing writing and reading to %s channel in %s format:\n",
- ChannelToString(channel), FormatToString(format) );
+ tet_printf("Testing writing and reading to %s channel in %s format:\n",
+ ChannelToString(channel),
+ FormatToString(format));
- if( channel == Dali::Internal::Adaptor::ALPHA && (format == Dali::Pixel::RGBA5551 || format == Dali::Pixel::BGRA5551 ) )
+ if(channel == Dali::Internal::Adaptor::ALPHA && (format == Dali::Pixel::RGBA5551 || format == Dali::Pixel::BGRA5551))
{
- DALI_TEST_EQUALS( value, 0x1, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, 0x1, TEST_LOCATION);
}
- else if( format == Dali::Pixel::RGBA4444 || format == Dali::Pixel::BGRA4444 )
+ else if(format == Dali::Pixel::RGBA4444 || format == Dali::Pixel::BGRA4444)
{
- DALI_TEST_EQUALS( value, 0x05, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, 0x05, TEST_LOCATION);
}
else
{
- DALI_TEST_EQUALS( value, 0x15, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, 0x15, TEST_LOCATION);
}
}
}
END_TEST;
}
-
int UtcDaliPixelManipulation03N(void)
{
tet_infoline("Testing Dali::Internal::AdaptorManipulation Read/WriteChannel");
- unsigned char pixel[4] = {0,0,0,0};
+ unsigned char pixel[4] = {0, 0, 0, 0};
- for( int formatIdx=1; formatIdx<Dali::Pixel::COMPRESSED_R11_EAC; ++formatIdx)
+ for(int formatIdx = 1; formatIdx < Dali::Pixel::COMPRESSED_R11_EAC; ++formatIdx)
{
pixel[0] = 0xFF;
pixel[1] = 0xFF;
pixel[2] = 0xFF;
pixel[3] = 0xFF;
- for( int channelIdx=0; channelIdx < Dali::Internal::Adaptor::MAX_NUMBER_OF_CHANNELS; ++channelIdx )
+ for(int channelIdx = 0; channelIdx < Dali::Internal::Adaptor::MAX_NUMBER_OF_CHANNELS; ++channelIdx)
{
- Dali::Pixel::Format format = static_cast<Dali::Pixel::Format>(formatIdx);
+ Dali::Pixel::Format format = static_cast<Dali::Pixel::Format>(formatIdx);
Dali::Internal::Adaptor::Channel channel = static_cast<Dali::Internal::Adaptor::Channel>(channelIdx);
- if( ! Dali::Internal::Adaptor::HasChannel( format, channel ) )
+ if(!Dali::Internal::Adaptor::HasChannel(format, channel))
{
- unsigned int value = Dali::Internal::Adaptor::ReadChannel( &pixel[0], format, channel );
+ unsigned int value = Dali::Internal::Adaptor::ReadChannel(&pixel[0], format, channel);
- tet_printf( "Testing reading from %s channel in %s format:\n",
- ChannelToString(channel), FormatToString(format) );
+ tet_printf("Testing reading from %s channel in %s format:\n",
+ ChannelToString(channel),
+ FormatToString(format));
- DALI_TEST_EQUALS( value, 0x00, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, 0x00, TEST_LOCATION);
}
}
}
*/
// EXTERNAL INCLUDES
-#include <stdlib.h>
-#include <iostream>
-#include <dali.h>
#include <dali-test-suite-utils.h>
+#include <dali.h>
#include <dali/devel-api/adaptor-framework/lifecycle-controller.h>
+#include <stdlib.h>
+#include <iostream>
#include <dali/internal/adaptor/common/lifecycle-controller-impl.h>
namespace
{
-
-bool g_OnInitCalled = false;
-bool g_OnTerminateCalled = false;
-bool g_OnPauseCalled = false;
-bool g_OnResumeCalled = false;
-bool g_OnResetCalled = false;
+bool g_OnInitCalled = false;
+bool g_OnTerminateCalled = false;
+bool g_OnPauseCalled = false;
+bool g_OnResumeCalled = false;
+bool g_OnResetCalled = false;
bool g_OnLanguageChangedCalled = false;
void OnInit()
// Attempt to retrieve LifecycleController before creating application
LifecycleController lifecycleController;
lifecycleController = LifecycleController::Get();
- DALI_TEST_CHECK( !lifecycleController );
+ DALI_TEST_CHECK(!lifecycleController);
TestApplication app;
- Application application = Application::New();
+ Application application = Application::New();
lifecycleController = LifecycleController::Get();
- DALI_TEST_CHECK( lifecycleController );
+ DALI_TEST_CHECK(lifecycleController);
END_TEST;
}
int UtcDaliLifecycleControllerSignalInit(void)
{
TestApplication app;
- Application application = Application::New();
+ Application application = Application::New();
- DALI_TEST_CHECK( !g_OnInitCalled );
+ DALI_TEST_CHECK(!g_OnInitCalled);
LifecycleController lifecycleController = LifecycleController::Get();
- lifecycleController.InitSignal().Connect( &OnInit );
+ lifecycleController.InitSignal().Connect(&OnInit);
- GetImplementation( lifecycleController ).OnInit( application );
+ GetImplementation(lifecycleController).OnInit(application);
- DALI_TEST_CHECK( g_OnInitCalled );
+ DALI_TEST_CHECK(g_OnInitCalled);
END_TEST;
}
int UtcDaliLifecycleControllerSignalTerminate(void)
{
TestApplication app;
- Application application = Application::New();
+ Application application = Application::New();
- DALI_TEST_CHECK( !g_OnTerminateCalled );
+ DALI_TEST_CHECK(!g_OnTerminateCalled);
LifecycleController lifecycleController = LifecycleController::Get();
- lifecycleController.TerminateSignal().Connect( &OnTerminate );
+ lifecycleController.TerminateSignal().Connect(&OnTerminate);
- GetImplementation( lifecycleController ).OnTerminate( application );
+ GetImplementation(lifecycleController).OnTerminate(application);
- DALI_TEST_CHECK( g_OnTerminateCalled );
+ DALI_TEST_CHECK(g_OnTerminateCalled);
END_TEST;
}
int UtcDaliLifecycleControllerSignalPause(void)
{
TestApplication app;
- Application application = Application::New();
+ Application application = Application::New();
- DALI_TEST_CHECK( !g_OnPauseCalled );
+ DALI_TEST_CHECK(!g_OnPauseCalled);
LifecycleController lifecycleController = LifecycleController::Get();
- lifecycleController.PauseSignal().Connect( &OnPause );
+ lifecycleController.PauseSignal().Connect(&OnPause);
- GetImplementation( lifecycleController ).OnPause( application );
+ GetImplementation(lifecycleController).OnPause(application);
- DALI_TEST_CHECK( g_OnPauseCalled );
+ DALI_TEST_CHECK(g_OnPauseCalled);
END_TEST;
}
int UtcDaliLifecycleControllerSignalResume(void)
{
TestApplication app;
- Application application = Application::New();
+ Application application = Application::New();
- DALI_TEST_CHECK( !g_OnResumeCalled );
+ DALI_TEST_CHECK(!g_OnResumeCalled);
LifecycleController lifecycleController = LifecycleController::Get();
- lifecycleController.ResumeSignal().Connect( &OnResume );
+ lifecycleController.ResumeSignal().Connect(&OnResume);
- GetImplementation( lifecycleController ).OnResume( application );
+ GetImplementation(lifecycleController).OnResume(application);
- DALI_TEST_CHECK( g_OnResumeCalled );
+ DALI_TEST_CHECK(g_OnResumeCalled);
END_TEST;
}
int UtcDaliLifecycleControllerSignalReset(void)
{
TestApplication app;
- Application application = Application::New();
+ Application application = Application::New();
- DALI_TEST_CHECK( !g_OnResetCalled );
+ DALI_TEST_CHECK(!g_OnResetCalled);
LifecycleController lifecycleController = LifecycleController::Get();
- lifecycleController.ResetSignal().Connect( &OnReset );
+ lifecycleController.ResetSignal().Connect(&OnReset);
- GetImplementation( lifecycleController ).OnReset( application );
+ GetImplementation(lifecycleController).OnReset(application);
- DALI_TEST_CHECK( g_OnResetCalled );
+ DALI_TEST_CHECK(g_OnResetCalled);
END_TEST;
}
int UtcDaliLifecycleControllerSignalLanguageChanged(void)
{
TestApplication app;
- Application application = Application::New();
+ Application application = Application::New();
- DALI_TEST_CHECK( !g_OnLanguageChangedCalled );
+ DALI_TEST_CHECK(!g_OnLanguageChangedCalled);
LifecycleController lifecycleController = LifecycleController::Get();
- lifecycleController.LanguageChangedSignal().Connect( &OnLanguageChanged );
+ lifecycleController.LanguageChangedSignal().Connect(&OnLanguageChanged);
- GetImplementation( lifecycleController ).OnLanguageChanged( application );
+ GetImplementation(lifecycleController).OnLanguageChanged(application);
- DALI_TEST_CHECK( g_OnLanguageChangedCalled );
+ DALI_TEST_CHECK(g_OnLanguageChangedCalled);
END_TEST;
}
#include <iostream>
-#include <stdlib.h>
-#include <stdint.h>
-#include <dali/dali.h>
-#include <dali-test-suite-utils.h>
#include <adaptor-test-application.h>
-#include <dali/internal/sensor/common/tilt-sensor-impl.h>
+#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
#include <dali/internal/sensor/common/tilt-sensor-factory.h>
+#include <dali/internal/sensor/common/tilt-sensor-impl.h>
#include <dali/internal/system/linux/dali-ecore.h>
+#include <stdint.h>
+#include <stdlib.h>
using namespace Dali;
struct SignalHelper : public ConnectionTracker
{
SignalHelper()
- : mTiltSignalReceived( false ),
- mTimeoutOccurred( false )
+ : mTiltSignalReceived(false),
+ mTimeoutOccurred(false)
{
}
return Dali::TiltSensor(Dali::Internal::Adaptor::TiltSensorFactory::Create());
}
-bool ecore_timer_running = false;
-Ecore_Task_Cb timer_callback_func=NULL;
-const void* timer_callback_data=NULL;
-intptr_t timerId = 8; // intptr_t has the same size as a pointer and is platform independent so this can be returned as a pointer in ecore_timer_add below without compilation warnings
-}// anon namespace
+bool ecore_timer_running = false;
+Ecore_Task_Cb timer_callback_func = NULL;
+const void* timer_callback_data = NULL;
+intptr_t timerId = 8; // intptr_t has the same size as a pointer and is platform independent so this can be returned as a pointer in ecore_timer_add below without compilation warnings
+} // namespace
extern "C"
{
-Ecore_Timer* ecore_timer_add(double in,
- Ecore_Task_Cb func,
- const void *data)
-{
- ecore_timer_running = true;
- timer_callback_func = func;
- timer_callback_data = data;
- timerId+=8;
- return (Ecore_Timer*)timerId;
-}
-
-void* ecore_timer_del(Ecore_Timer *timer)
-{
- ecore_timer_running = false;
- timer_callback_func = NULL;
- return NULL;
-}
+ Ecore_Timer* ecore_timer_add(double in,
+ Ecore_Task_Cb func,
+ const void* data)
+ {
+ ecore_timer_running = true;
+ timer_callback_func = func;
+ timer_callback_data = data;
+ timerId += 8;
+ return (Ecore_Timer*)timerId;
+ }
+ void* ecore_timer_del(Ecore_Timer* timer)
+ {
+ ecore_timer_running = false;
+ timer_callback_func = NULL;
+ return NULL;
+ }
}
-
-
void tilt_sensor_startup(void)
{
}
{
}
-
int UtcDaliTiltSensorStart(void)
{
AdaptorTestApplication application;
tet_infoline("UtcDaliTiltSensorStart");
TiltSensor sensor = GetTiltSensor();
- DALI_TEST_CHECK( sensor );
+ DALI_TEST_CHECK(sensor);
sensor.Start();
- DALI_TEST_CHECK( sensor.IsStarted() );
+ DALI_TEST_CHECK(sensor.IsStarted());
END_TEST;
}
tet_infoline("UtcDaliTiltSensorStop");
TiltSensor sensor = GetTiltSensor();
- DALI_TEST_CHECK( sensor );
+ DALI_TEST_CHECK(sensor);
sensor.Start();
- DALI_TEST_CHECK( sensor.IsStarted() );
+ DALI_TEST_CHECK(sensor.IsStarted());
sensor.Stop();
- DALI_TEST_CHECK( !sensor.IsStarted() );
+ DALI_TEST_CHECK(!sensor.IsStarted());
END_TEST;
}
tet_infoline("UtcDaliTiltSensorIsStarted");
TiltSensor sensor = GetTiltSensor();
- DALI_TEST_CHECK( sensor );
+ DALI_TEST_CHECK(sensor);
// Should be disabled by default
- DALI_TEST_CHECK( !sensor.IsStarted() );
+ DALI_TEST_CHECK(!sensor.IsStarted());
END_TEST;
}
tet_infoline("UtcDaliTiltSensorGetRoll");
TiltSensor sensor = GetTiltSensor();
- DALI_TEST_CHECK( sensor );
+ DALI_TEST_CHECK(sensor);
float roll = sensor.GetRoll();
- DALI_TEST_CHECK( roll <= 1.0f && roll >= -1.0f ); // range check
+ DALI_TEST_CHECK(roll <= 1.0f && roll >= -1.0f); // range check
END_TEST;
}
tet_infoline("UtcDaliTiltSensorGetPitch");
TiltSensor sensor = GetTiltSensor();
- DALI_TEST_CHECK( sensor );
+ DALI_TEST_CHECK(sensor);
float pitch = sensor.GetPitch();
- DALI_TEST_CHECK( pitch <= 1.0f && pitch >= -1.0f ); // range check
+ DALI_TEST_CHECK(pitch <= 1.0f && pitch >= -1.0f); // range check
END_TEST;
}
tet_infoline("UtcDaliTiltSensorGetRotation");
TiltSensor sensor = GetTiltSensor();
- DALI_TEST_CHECK( sensor );
+ DALI_TEST_CHECK(sensor);
Quaternion rotation = sensor.GetRotation();
- Radian roll( sensor.GetRoll() );
- Radian pitch( sensor.GetPitch() );
+ Radian roll(sensor.GetRoll());
+ Radian pitch(sensor.GetPitch());
- Quaternion expectedRotation = Quaternion( roll * Math::PI * -0.5f, Vector3::YAXIS ) *
- Quaternion( pitch * Math::PI * -0.5f, Vector3::XAXIS );
+ Quaternion expectedRotation = Quaternion(roll * Math::PI * -0.5f, Vector3::YAXIS) *
+ Quaternion(pitch * Math::PI * -0.5f, Vector3::XAXIS);
- DALI_TEST_EQUALS( rotation, expectedRotation, ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(rotation, expectedRotation, ROTATION_EPSILON, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliTiltSensorSignalTilted(void)
{
AdaptorTestApplication application;
tet_infoline("UtcDaliTiltSensorSignalTilted");
TiltSensor sensor = GetTiltSensor();
- DALI_TEST_CHECK( sensor );
+ DALI_TEST_CHECK(sensor);
sensor.Start();
Radian angle(Degree(-45));
//Setting a negative threshold for testing purpose
- sensor.SetRotationThreshold( angle );
+ sensor.SetRotationThreshold(angle);
END_TEST;
}
tet_infoline("UtcDaliTiltSensorSetUpdateFrequency");
TiltSensor sensor = GetTiltSensor();
- DALI_TEST_CHECK( sensor );
- sensor.SetUpdateFrequency( 1.0f/*hertz*/ );
- DALI_TEST_EQUALS( sensor.GetUpdateFrequency(), 1.0f, TEST_LOCATION );
+ DALI_TEST_CHECK(sensor);
+ sensor.SetUpdateFrequency(1.0f /*hertz*/);
+ DALI_TEST_EQUALS(sensor.GetUpdateFrequency(), 1.0f, TEST_LOCATION);
- sensor.SetUpdateFrequency( 60.0f/*hertz*/ );
- DALI_TEST_EQUALS( sensor.GetUpdateFrequency(), 60.0f, TEST_LOCATION );
+ sensor.SetUpdateFrequency(60.0f /*hertz*/);
+ DALI_TEST_EQUALS(sensor.GetUpdateFrequency(), 60.0f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliTiltSensorSetRotationThreshold01(void)
{
AdaptorTestApplication application;
tet_infoline("UtcDaliTiltSensorSetRotationThreshold01");
TiltSensor sensor = GetTiltSensor();
- DALI_TEST_CHECK( sensor );
+ DALI_TEST_CHECK(sensor);
sensor.Start();
Radian angle(Degree(-45));
- sensor.SetRotationThreshold( angle );
- DALI_TEST_EQUALS( sensor.GetRotationThreshold(), angle, TEST_LOCATION );
+ sensor.SetRotationThreshold(angle);
+ DALI_TEST_EQUALS(sensor.GetRotationThreshold(), angle, TEST_LOCATION);
angle = Degree(90);
- sensor.SetRotationThreshold( angle );
- DALI_TEST_EQUALS( sensor.GetRotationThreshold(), angle, TEST_LOCATION );
+ sensor.SetRotationThreshold(angle);
+ DALI_TEST_EQUALS(sensor.GetRotationThreshold(), angle, TEST_LOCATION);
END_TEST;
}
namespace Dali
{
-
namespace Internal
{
-
namespace Adaptor
{
-
bool Adaptor::mAvailable = false;
bool Adaptor::IsAvailable()
namespace Dali
{
-
namespace Internal
{
-
namespace Adaptor
{
-
class Adaptor
{
public:
static bool IsAvailable();
static void SetAvailable();
- Adaptor() {}
- ~Adaptor() {}
+ Adaptor()
+ {
+ }
+ ~Adaptor()
+ {
+ }
public:
static bool mAvailable;
};
-} // Adaptor
+} // namespace Adaptor
-} // Internal
+} // namespace Internal
-} // Dali
+} // namespace Dali
-#endif // DALI_ADAPTOR_TEST_ADAPTOR_IMPL_H
+#endif // DALI_ADAPTOR_TEST_ADAPTOR_IMPL_H
*/
// INTERNAL INCLUDES
-#include "test-application.h"
#include "adaptor-test-adaptor-impl.h"
+#include "test-application.h"
namespace Dali
{
-
/**
* Adds some functionality on top of TestApplication that is required by the Adaptor.
*/
class AdaptorTestApplication : public TestApplication
{
public:
-
- AdaptorTestApplication( size_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
- size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
- float horizontalDpi = DEFAULT_HORIZONTAL_DPI,
- float verticalDpi = DEFAULT_VERTICAL_DPI )
- : TestApplication( surfaceWidth, surfaceHeight, horizontalDpi, verticalDpi )
+ AdaptorTestApplication(size_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
+ size_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
+ float horizontalDpi = DEFAULT_HORIZONTAL_DPI,
+ float verticalDpi = DEFAULT_VERTICAL_DPI)
+ : TestApplication(surfaceWidth, surfaceHeight, horizontalDpi, verticalDpi)
{
Internal::Adaptor::Adaptor::SetAvailable();
}
#define DALI_TEST_IMG_UTILS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// EXTERNAL INCLUDES
#include <cstdarg>
#include <cstdio>
-#include <iostream>
#include <cstring>
+#include <iostream>
// INTERNAL INCLUDES
#include <dali/dali.h>
#include <dali/devel-api/adaptor-framework/image-loading.h>
#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
using namespace Dali;
namespace
{
-
/**
* Test whether two buffers are equal with tolerance value.
* @param[in] buffer1 The first buffer
* @param[in] location The TEST_LOCATION macro should be used here
*/
-inline void DALI_TEST_EQUALS( const unsigned char* buffer1, const unsigned char* buffer2, unsigned int tolerance, long size, const char* location)
+inline void DALI_TEST_EQUALS(const unsigned char* buffer1, const unsigned char* buffer2, unsigned int tolerance, long size, const char* location)
{
- if( !tolerance )
+ if(!tolerance)
{
- if ( memcmp( buffer1, buffer2, size) )
+ if(memcmp(buffer1, buffer2, size))
{
- fprintf(stderr, "%s, checking buffer1 == buffer2\n", location );
+ fprintf(stderr, "%s, checking buffer1 == buffer2\n", location);
tet_result(TET_FAIL);
}
else
{
const unsigned char* buff1 = buffer1;
const unsigned char* buff2 = buffer2;
- unsigned int i = 0;
+ unsigned int i = 0;
//Create a mask to fast compare, it is expected to be similar values.
unsigned int maskBits = 0;
- while( maskBits < tolerance )
+ while(maskBits < tolerance)
{
maskBits |= (1 << i);
i++;
maskBits = ~maskBits;
bool equal = true;
- for( i = 0; i < size; ++i, ++buff1, ++buff2 )
+ for(i = 0; i < size; ++i, ++buff1, ++buff2)
{
//Check bit difference, if exist, do more exhaustive comparison with tolerance value
- if( (*buff1 ^ *buff2 ) & maskBits )
+ if((*buff1 ^ *buff2) & maskBits)
{
- if( *buff1 < *buff2 )
+ if(*buff1 < *buff2)
{
unsigned int diff = *buff2 - *buff1;
- if( diff > tolerance )
+ if(diff > tolerance)
{
equal = false;
break;
else
{
unsigned int diff = *buff1 - *buff2;
- if( diff > tolerance )
+ if(diff > tolerance)
{
equal = false;
break;
}
}
}
- if ( !equal )
+ if(!equal)
{
- fprintf(stderr, "%s, byte %d, checking %u == %u\n", location, i, *buff1, *buff2 );
+ fprintf(stderr, "%s, byte %d, checking %u == %u\n", location, i, *buff1, *buff2);
tet_result(TET_FAIL);
}
else
* @param[in] location The TEST_LOCATION macro should be used here
*/
-inline void DALI_IMAGE_TEST_EQUALS( Dali::Devel::PixelBuffer pixelBuffer1, Dali::Devel::PixelBuffer pixelBuffer2, unsigned int tolerance, const char* location)
+inline void DALI_IMAGE_TEST_EQUALS(Dali::Devel::PixelBuffer pixelBuffer1, Dali::Devel::PixelBuffer pixelBuffer2, unsigned int tolerance, const char* location)
{
- if( ( pixelBuffer1.GetPixelFormat() != Pixel::RGB888 ) || ( pixelBuffer2.GetPixelFormat() != Pixel::RGB888 ) )
+ if((pixelBuffer1.GetPixelFormat() != Pixel::RGB888) || (pixelBuffer2.GetPixelFormat() != Pixel::RGB888))
{
- fprintf(stderr, "%s, PixelFormat != Pixel::RGB888, test only support Pixel::RGB888 formats\n", location );
+ fprintf(stderr, "%s, PixelFormat != Pixel::RGB888, test only support Pixel::RGB888 formats\n", location);
tet_result(TET_FAIL);
}
- else if( ( pixelBuffer1.GetWidth() != pixelBuffer1.GetWidth() ) || ( pixelBuffer1.GetHeight() != pixelBuffer1.GetHeight() ) )
+ else if((pixelBuffer1.GetWidth() != pixelBuffer1.GetWidth()) || (pixelBuffer1.GetHeight() != pixelBuffer1.GetHeight()))
{
- fprintf(stderr, "%s, Different Image sizes\n", location );
+ fprintf(stderr, "%s, Different Image sizes\n", location);
tet_result(TET_FAIL);
}
else
{
- DALI_TEST_EQUALS( pixelBuffer1.GetBuffer(), pixelBuffer2.GetBuffer(), tolerance, pixelBuffer1.GetHeight() * pixelBuffer1.GetWidth() * 3, location);
+ DALI_TEST_EQUALS(pixelBuffer1.GetBuffer(), pixelBuffer2.GetBuffer(), tolerance, pixelBuffer1.GetHeight() * pixelBuffer1.GetWidth() * 3, location);
}
}
-}
+} // namespace
#endif // DALI_TEST_SUITE_UTILS_H
// First TET_PASS should set to zero
// first TET_FAIL should prevent any further TET_PASS from setting back to zero
// Any TET_FAIL should set to fail or leave as fail
- if( test_return_value != 1 )
+ if(test_return_value != 1)
test_return_value = value;
}
#define END_TEST \
- return ((test_return_value>0)?1:0)
+ return ((test_return_value > 0) ? 1 : 0)
extern "C"
{
+ void tet_infoline(const char* str)
+ {
+ fprintf(stderr, "%s\n", str);
+ }
-void tet_infoline(const char* str)
-{
- fprintf(stderr, "%s\n", str);
-}
-
-void tet_printf(const char *format, ...)
-{
- va_list arg;
- va_start(arg, format);
- vfprintf(stderr, format, arg);
- va_end(arg);
-}
+ void tet_printf(const char* format, ...)
+ {
+ va_list arg;
+ va_start(arg, format);
+ vfprintf(stderr, format, arg);
+ va_end(arg);
+ }
}
-
bool operator==(TimePeriod a, TimePeriod b)
{
- return Equals(a.durationSeconds, b.durationSeconds) && Equals(a.delaySeconds, b.delaySeconds) ;
+ return Equals(a.durationSeconds, b.durationSeconds) && Equals(a.delaySeconds, b.delaySeconds);
}
-std::ostream& operator<<( std::ostream& ostream, TimePeriod value )
+std::ostream& operator<<(std::ostream& ostream, TimePeriod value)
{
return ostream << "( Duration:" << value.durationSeconds << " Delay:" << value.delaySeconds << ")";
}
-std::ostream& operator<<( std::ostream& ostream, Radian angle )
+std::ostream& operator<<(std::ostream& ostream, Radian angle)
{
ostream << angle.radian;
return ostream;
}
-std::ostream& operator<<( std::ostream& ostream, Degree angle )
+std::ostream& operator<<(std::ostream& ostream, Degree angle)
{
ostream << angle.degree;
return ostream;
}
-void DALI_TEST_EQUALS( const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location )
+void DALI_TEST_EQUALS(const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location)
{
- DALI_TEST_EQUALS< const BaseHandle& >( baseHandle1, baseHandle2, location );
+ DALI_TEST_EQUALS<const BaseHandle&>(baseHandle1, baseHandle2, location);
}
-void DALI_TEST_EQUALS( const size_t value1, const uint32_t value2, const char* location )
+void DALI_TEST_EQUALS(const size_t value1, const uint32_t value2, const char* location)
{
- DALI_TEST_EQUALS< uint32_t >( ( uint32_t )( value1 ), value2, location );
+ DALI_TEST_EQUALS<uint32_t>((uint32_t)(value1), value2, location);
}
-void DALI_TEST_EQUALS( const uint32_t value1, const size_t value2, const char* location )
+void DALI_TEST_EQUALS(const uint32_t value1, const size_t value2, const char* location)
{
- DALI_TEST_EQUALS< uint32_t >( value1, ( uint32_t )( value2 ), location );
+ DALI_TEST_EQUALS<uint32_t>(value1, (uint32_t)(value2), location);
}
-void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location)
+void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, const char* location)
{
- const float* m1 = matrix1.AsFloat();
- const float* m2 = matrix2.AsFloat();
- bool equivalent = true;
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool equivalent = true;
- for (int32_t i=0;i<9;++i)
+ for(int32_t i = 0; i < 9; ++i)
{
- if( ! (fabsf(m1[i] - m2[i])< GetRangedEpsilon(m1[i], m2[i])) )
+ if(!(fabsf(m1[i] - m2[i]) < GetRangedEpsilon(m1[i], m2[i])))
{
equivalent = false;
}
}
- if( !equivalent )
+ if(!equivalent)
{
// Align each float to 1234.67, i.e. 3.6 will be " 3.60"
- fprintf( stderr, "%s, checking\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
- location,
- m1[0], m1[3], m1[6], m2[0], m2[3], m2[6],
- m1[1], m1[4], m1[7], m2[1], m2[4], m2[7],
- m1[2], m1[5], m1[8], m2[2], m2[5], m2[8] );
+ // clang-format off
+ fprintf(stderr, "%s, checking\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
+ location,
+ m1[0],m1[3],m1[6],m2[0],m2[3],m2[6],
+ m1[1],m1[4],m1[7],m2[1],m2[4],m2[7],
+ m1[2],m1[5],m1[8],m2[2],m2[5],m2[8]);
+ // clang-format on
tet_result(TET_FAIL);
throw("TET_FAIL");
}
}
-void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location)
+void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location)
{
- const float* m1 = matrix1.AsFloat();
- const float* m2 = matrix2.AsFloat();
- bool equivalent = true;
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool equivalent = true;
- for (int32_t i=0;i<9;++i)
+ for(int32_t i = 0; i < 9; ++i)
{
- equivalent &= (fabsf(m1[i] - m2[i])<epsilon);
+ equivalent &= (fabsf(m1[i] - m2[i]) < epsilon);
}
- if (!equivalent)
+ if(!equivalent)
{
// Align each float to 1234.67, i.e. 3.6 will be " 3.60"
- fprintf( stderr, "%s, checking\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
- location,
- m1[0], m1[3], m1[6], m2[0], m2[3], m2[6],
- m1[1], m1[4], m1[7], m2[1], m2[4], m2[7],
- m1[2], m1[5], m1[8], m2[2], m2[5], m2[8] );
+ // clang-format off
+ fprintf(stderr, "%s, checking\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
+ location,
+ m1[0],m1[3],m1[6],m2[0],m2[3],m2[6],
+ m1[1],m1[4],m1[7],m2[1],m2[4],m2[7],
+ m1[2],m1[5],m1[8],m2[2],m2[5],m2[8]);
+ // clang-format on
tet_result(TET_FAIL);
throw("TET_FAIL");
}
}
-void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, const char* location)
+void DALI_TEST_EQUALS(const Matrix& matrix1, const Matrix& matrix2, const char* location)
{
- const float* m1 = matrix1.AsFloat();
- const float* m2 = matrix2.AsFloat();
- bool identical = true;
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool identical = true;
int32_t i;
- for (i=0;i<16;++i)
+ for(i = 0; i < 16; ++i)
{
if(m1[i] != m2[i])
{
}
}
- if (!identical)
+ if(!identical)
{
// Align each float to 1234.67, i.e. 3.6 will be " 3.60"
- fprintf( stderr, "%s, checking\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
- location,
- m1[0], m1[4], m1[8], m1[12], m2[0], m2[4], m2[8], m2[12],
- m1[1], m1[5], m1[9], m1[13], m2[1], m2[5], m2[9], m2[13],
- m1[2], m1[6], m1[10], m1[14], m2[2], m2[6], m2[10], m2[14],
- m1[3], m1[7], m1[11], m1[15], m2[3], m2[7], m2[11], m2[15] );
+ // clang-format off
+ fprintf(stderr, "%s, checking\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
+ location,
+ m1[0],m1[4],m1[8],m1[12],m2[0],m2[4],m2[8],m2[12],
+ m1[1],m1[5],m1[9],m1[13],m2[1],m2[5],m2[9],m2[13],
+ m1[2],m1[6],m1[10],m1[14],m2[2],m2[6],m2[10],m2[14],
+ m1[3],m1[7],m1[11],m1[15],m2[3],m2[7],m2[11],m2[15]);
+ // clang-format on
tet_result(TET_FAIL);
throw("TET_FAIL");
}
}
-void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location)
+void DALI_TEST_EQUALS(const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location)
{
- const float* m1 = matrix1.AsFloat();
- const float* m2 = matrix2.AsFloat();
- bool equivalent = true;
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool equivalent = true;
- for (int32_t i=0;i<16;++i)
+ for(int32_t i = 0; i < 16; ++i)
{
- equivalent &= (fabsf(m1[i] - m2[i])<epsilon);
+ equivalent &= (fabsf(m1[i] - m2[i]) < epsilon);
}
- if (!equivalent)
+ if(!equivalent)
{
// Align each float to 1234.67, i.e. 3.6 will be " 3.60"
- fprintf( stderr, "%s, checking\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
- location,
- m1[0], m1[4], m1[8], m1[12], m2[0], m2[4], m2[8], m2[12],
- m1[1], m1[5], m1[9], m1[13], m2[1], m2[5], m2[9], m2[13],
- m1[2], m1[6], m1[10], m1[14], m2[2], m2[6], m2[10], m2[14],
- m1[3], m1[7], m1[11], m1[15], m2[3], m2[7], m2[11], m2[15] );
+ // clang-format off
+ fprintf(stderr, "%s, checking\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
+ location,
+ m1[0],m1[4],m1[8],m1[12],m2[0],m2[4],m2[8],m2[12],
+ m1[1],m1[5],m1[9],m1[13],m2[1],m2[5],m2[9],m2[13],
+ m1[2],m1[6],m1[10],m1[14],m2[2],m2[6],m2[10],m2[14],
+ m1[3],m1[7],m1[11],m1[15],m2[3],m2[7],m2[11],m2[15]);
+ // clang-format on
tet_result(TET_FAIL);
throw("TET_FAIL");
}
}
-
/**
* Test whether two strings are equal.
* @param[in] str1 The first string
* @param[in] str2 The second string
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* location)
+void DALI_TEST_EQUALS(const std::string& str1, const char* str2, const char* location)
{
DALI_TEST_EQUALS(str1.c_str(), str2, location);
}
-void DALI_TEST_EQUALS( Property::Value& str1, const char* str2, const char* location)
+void DALI_TEST_EQUALS(Property::Value& str1, const char* str2, const char* location)
{
bool result = false;
- if( str1.GetType() == Property::STRING )
+ if(str1.GetType() == Property::STRING)
{
std::string string;
str1.Get(string);
result = !string.compare(str2);
}
- if( result )
+ if(result)
{
tet_result(TET_PASS);
}
}
}
-void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* location)
+void DALI_TEST_EQUALS(const char* str1, const std::string& str2, const char* location)
{
DALI_TEST_EQUALS(str1, str2.c_str(), location);
}
-void DALI_TEST_ASSERT( DaliException& e, std::string conditionSubString, const char* location )
+void DALI_TEST_ASSERT(DaliException& e, std::string conditionSubString, const char* location)
{
- if( NULL == strstr( e.condition, conditionSubString.c_str() ) )
+ if(NULL == strstr(e.condition, conditionSubString.c_str()))
{
- fprintf(stderr, "Expected substring '%s' : actual exception string '%s' : location %s\n", conditionSubString.c_str(), e.condition, location );
+ fprintf(stderr, "Expected substring '%s' : actual exception string '%s' : location %s\n", conditionSubString.c_str(), e.condition, location);
tet_result(TET_FAIL);
throw("TET_FAIL");
}
}
// Functor to test whether an Applied signal is emitted
-ConstraintAppliedCheck::ConstraintAppliedCheck( bool& signalReceived )
-: mSignalReceived( signalReceived )
+ConstraintAppliedCheck::ConstraintAppliedCheck(bool& signalReceived)
+: mSignalReceived(signalReceived)
{
}
-void ConstraintAppliedCheck::operator()( Constraint& constraint )
+void ConstraintAppliedCheck::operator()(Constraint& constraint)
{
mSignalReceived = true;
}
void ConstraintAppliedCheck::CheckSignalReceived()
{
- if ( !mSignalReceived )
+ if(!mSignalReceived)
{
- fprintf(stderr, "Expected Applied signal was not received\n" );
- tet_result( TET_FAIL );
+ fprintf(stderr, "Expected Applied signal was not received\n");
+ tet_result(TET_FAIL);
throw("TET_FAIL");
}
else
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
}
void ConstraintAppliedCheck::CheckSignalNotReceived()
{
- if ( mSignalReceived )
+ if(mSignalReceived)
{
- fprintf(stderr, "Unexpected Applied signal was received\n" );
- tet_result( TET_FAIL );
+ fprintf(stderr, "Unexpected Applied signal was received\n");
+ tet_result(TET_FAIL);
throw("TET_FAIL");
}
else
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
}
namespace Test
{
-
struct ObjectDestructionFunctor
{
// Create a ObjectDestructionFunctor passing in a Dali::RefObject* to be monitored and a bool variable.
// Create ObjectRegistry instance and connect to the ObjectDestroyedSignal passing in the above functor for the callback.
// Get the ObjectPointer (Actor::GetObjectPtr) of the Actor to be checked for destruction and assign it to the Dali::RefObject*
// Check the bool variable which would be true when object destroyed.
- ObjectDestructionFunctor( Dali::RefObject* objectPtr, bool& refObjectDestroyed )
- : refObjectPointerToCheck( objectPtr ),
- refObjectDestroyedBoolean( refObjectDestroyed )
+ ObjectDestructionFunctor(Dali::RefObject* objectPtr, bool& refObjectDestroyed)
+ : refObjectPointerToCheck(objectPtr),
+ refObjectDestroyedBoolean(refObjectDestroyed)
{
refObjectDestroyed = false;
}
- void operator()( const Dali::RefObject* objectPointer )
+ void operator()(const Dali::RefObject* objectPointer)
{
- if ( refObjectPointerToCheck == objectPointer )
+ if(refObjectPointerToCheck == objectPointer)
{
refObjectDestroyedBoolean = true;
}
}
Dali::RefObject* refObjectPointerToCheck;
- bool& refObjectDestroyedBoolean;
+ bool& refObjectDestroyedBoolean;
};
-ObjectDestructionTracker::ObjectDestructionTracker( ObjectRegistry objectRegistry )
-: mObjectRegistry( objectRegistry ),
- mRefObjectDestroyed( false)
+ObjectDestructionTracker::ObjectDestructionTracker(ObjectRegistry objectRegistry)
+: mObjectRegistry(objectRegistry),
+ mRefObjectDestroyed(false)
{
}
-void ObjectDestructionTracker::Start( Actor actor )
+void ObjectDestructionTracker::Start(Actor actor)
{
- ObjectDestructionFunctor destructionFunctor( actor.GetObjectPtr(), mRefObjectDestroyed );
- mObjectRegistry.ObjectDestroyedSignal().Connect( this, destructionFunctor );
+ ObjectDestructionFunctor destructionFunctor(actor.GetObjectPtr(), mRefObjectDestroyed);
+ mObjectRegistry.ObjectDestroyedSignal().Connect(this, destructionFunctor);
}
bool ObjectDestructionTracker::IsDestroyed()
{
- return mRefObjectDestroyed;
+ return mRefObjectDestroyed;
}
} // namespace Test
// EXTERNAL INCLUDES
#include <cstdarg>
#include <cstdio>
-#include <iostream>
#include <cstring>
+#include <iostream>
#include <string>
// INTERNAL INCLUDES
extern "C"
{
-void tet_infoline(const char*str);
-void tet_printf(const char *format, ...);
+ void tet_infoline(const char* str);
+ void tet_printf(const char* format, ...);
}
-#include "test-application.h"
#include "test-actor-utils.h"
+#include "test-application.h"
#include "test-gesture-generator.h"
using namespace Dali;
* Inspired by https://stackoverflow.com/questions/1706346/file-macro-manipulation-handling-at-compile-time
* answer by Chetan Reddy
*/
-constexpr int32_t basenameIndex( const char * const path, const int32_t index = 0, const int32_t slashIndex = -1 )
+constexpr int32_t basenameIndex(const char* const path, const int32_t index = 0, const int32_t slashIndex = -1)
{
- return path[ index ]
- ? ( path[ index ] == '/'
- ? basenameIndex( path, index + 1, index )
- : basenameIndex( path, index + 1, slashIndex ) )
- : ( slashIndex + 1 );
+ return path[index]
+ ? (path[index] == '/'
+ ? basenameIndex(path, index + 1, index)
+ : basenameIndex(path, index + 1, slashIndex))
+ : (slashIndex + 1);
}
-#define __FILELINE__ ( { static const int32_t basenameIdx = basenameIndex( __FILE__ ); \
+#define __FILELINE__ ({ static const int32_t basenameIdx = basenameIndex( __FILE__ ); \
static_assert (basenameIdx >= 0, "compile-time basename" ); \
- __FILE__ ":" STRINGIZE(__LINE__) + basenameIdx ; } )
+ __FILE__ ":" STRINGIZE(__LINE__) + basenameIdx ; })
#define TEST_LOCATION __FILELINE__
-#define TEST_INNER_LOCATION(x) ( std::string(x) + " (" + STRINGIZE(__LINE__) + ")" ).c_str()
+#define TEST_INNER_LOCATION(x) (std::string(x) + " (" + STRINGIZE(__LINE__) + ")").c_str()
#define TET_UNDEF 2
#define TET_FAIL 1
void tet_result(int32_t value);
#define END_TEST \
- return ((test_return_value>0)?1:0)
+ return ((test_return_value > 0) ? 1 : 0)
void tet_infoline(const char* str);
-void tet_printf(const char *format, ...);
+void tet_printf(const char* format, ...);
/**
* DALI_TEST_CHECK is a wrapper for tet_result.
* If the condition evaluates to false, the test is stopped.
* @param[in] The boolean expression to check
*/
-#define DALI_TEST_CHECK(condition) \
-if ( (condition) ) \
-{ \
- tet_result(TET_PASS); \
-} \
-else \
-{ \
- fprintf(stderr, "Test failed in %s, condition: %s\n", __FILELINE__, #condition ); \
- tet_result(TET_FAIL); \
- throw("TET_FAIL"); \
-}
-
+#define DALI_TEST_CHECK(condition) \
+ if((condition)) \
+ { \
+ tet_result(TET_PASS); \
+ } \
+ else \
+ { \
+ fprintf(stderr, "Test failed in %s, condition: %s\n", __FILELINE__, #condition); \
+ tet_result(TET_FAIL); \
+ throw("TET_FAIL"); \
+ }
-bool operator==(TimePeriod a, TimePeriod b);
-std::ostream& operator<<( std::ostream& ostream, TimePeriod value );
-std::ostream& operator<<( std::ostream& ostream, Radian angle );
-std::ostream& operator<<( std::ostream& ostream, Degree angle );
+bool operator==(TimePeriod a, TimePeriod b);
+std::ostream& operator<<(std::ostream& ostream, TimePeriod value);
+std::ostream& operator<<(std::ostream& ostream, Radian angle);
+std::ostream& operator<<(std::ostream& ostream, Degree angle);
/**
* Test whether two values are equal.
template<typename Type>
inline void DALI_TEST_EQUALS(Type value1, Type value2, const char* location)
{
- if( !CompareType<Type>(value1, value2, 0.01f) )
+ if(!CompareType<Type>(value1, value2, 0.01f))
{
std::ostringstream o;
o << value1 << " == " << value2 << std::endl;
fprintf(stderr, "Test failed in %s, checking %s", location, o.str().c_str());
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
* @param[in] value1 The first value
* @param[in] value2 The second value
*/
-#define DALI_TEST_EQUAL( v1, v2 ) DALI_TEST_EQUALS( v1, v2, __FILELINE__ )
+#define DALI_TEST_EQUAL(v1, v2) DALI_TEST_EQUALS(v1, v2, __FILELINE__)
template<typename Type>
inline void DALI_TEST_EQUALS(Type value1, Type value2, float epsilon, const char* location)
{
- if( !CompareType<Type>(value1, value2, epsilon) )
+ if(!CompareType<Type>(value1, value2, epsilon))
{
std::ostringstream o;
o << value1 << " == " << value2 << std::endl;
fprintf(stderr, "Test failed in %s, checking %s", location, o.str().c_str());
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
template<typename Type>
inline void DALI_TEST_NOT_EQUALS(Type value1, Type value2, float epsilon, const char* location)
{
- if( CompareType<Type>(value1, value2, epsilon) )
+ if(CompareType<Type>(value1, value2, epsilon))
{
std::ostringstream o;
o << value1 << " != " << value2 << std::endl;
fprintf(stderr, "Test failed in %s, checking %s", location, o.str().c_str());
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
}
}
-
/**
* Test whether two TimePeriods are within a certain distance of each other.
* @param[in] value1 The first value
* @param[in] location The TEST_LOCATION macro should be used here
*/
template<>
-inline void DALI_TEST_EQUALS<TimePeriod>( TimePeriod value1, TimePeriod value2, float epsilon, const char* location)
+inline void DALI_TEST_EQUALS<TimePeriod>(TimePeriod value1, TimePeriod value2, float epsilon, const char* location)
{
- if ((fabs(value1.durationSeconds - value2.durationSeconds) > epsilon))
+ if((fabs(value1.durationSeconds - value2.durationSeconds) > epsilon))
{
fprintf(stderr, "Test failed in %s, checking durations %f == %f, epsilon %f\n", location, value1.durationSeconds, value2.durationSeconds, epsilon);
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
- else if ((fabs(value1.delaySeconds - value2.delaySeconds) > epsilon))
+ else if((fabs(value1.delaySeconds - value2.delaySeconds) > epsilon))
{
fprintf(stderr, "Test failed in %s, checking delays %f == %f, epsilon %f\n", location, value1.delaySeconds, value2.delaySeconds, epsilon);
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
* @param[in] baseHandle2 The second value
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location );
+void DALI_TEST_EQUALS(const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location);
/**
* Test whether a size_t value and an uint32_t are equal.
* @param[in] value2 The second value
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const size_t value1, const uint32_t value2, const char* location );
+void DALI_TEST_EQUALS(const size_t value1, const uint32_t value2, const char* location);
/**
* Test whether an uint32_t and a size_t value and are equal.
* @param[in] value2 The second value
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const uint32_t value1, const size_t value2, const char* location );
+void DALI_TEST_EQUALS(const uint32_t value1, const size_t value2, const char* location);
/**
* Test whether two Matrix3 objects are equal.
* @param[in] matrix2 The second object
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location);
+void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, const char* location);
/** Test whether two Matrix3 objects are equal (fuzzy compare).
* @param[in] matrix1 The first object
* @param[in] epsilon The epsilon to use for comparison
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location);
+void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location);
/**
* Test whether two Matrix objects are equal.
* @param[in] matrix2 The second object
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, const char* location);
+void DALI_TEST_EQUALS(const Matrix& matrix1, const Matrix& matrix2, const char* location);
/**
* Test whether two Matrix objects are equal (fuzzy-compare).
* @param[in] matrix2 The second object
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location);
+void DALI_TEST_EQUALS(const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location);
/**
* Test whether two strings are equal.
* @param[in] location The TEST_LOCATION macro should be used here
*/
template<>
-inline void DALI_TEST_EQUALS<const char*>( const char* str1, const char* str2, const char* location)
+inline void DALI_TEST_EQUALS<const char*>(const char* str1, const char* str2, const char* location)
{
- if (strcmp(str1, str2))
+ if(strcmp(str1, str2))
{
fprintf(stderr, "Test failed in %s, checking '%s' == '%s'\n", location, str1, str2);
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
* @param[in] location The TEST_LOCATION macro should be used here
*/
template<>
-inline void DALI_TEST_EQUALS<const std::string&>( const std::string &str1, const std::string &str2, const char* location)
+inline void DALI_TEST_EQUALS<const std::string&>(const std::string& str1, const std::string& str2, const char* location)
{
DALI_TEST_EQUALS(str1.c_str(), str2.c_str(), location);
}
* @param[in] str2 The second string
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( Property::Value& str1, const char* str2, const char* location);
+void DALI_TEST_EQUALS(Property::Value& str1, const char* str2, const char* location);
/**
* Test whether two strings are equal.
* @param[in] str2 The second string
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* location);
+void DALI_TEST_EQUALS(const std::string& str1, const char* str2, const char* location);
/**
* Test whether two strings are equal.
* @param[in] str2 The second string
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* location);
+void DALI_TEST_EQUALS(const char* str1, const std::string& str2, const char* location);
/**
* Test if a property value type is equal to a trivial type.
*/
template<typename Type>
-inline void DALI_TEST_VALUE_EQUALS( Property::Value&& value1, Type value2, float epsilon, const char* location)
+inline void DALI_TEST_VALUE_EQUALS(Property::Value&& value1, Type value2, float epsilon, const char* location)
{
Property::Value value2b(value2);
DALI_TEST_EQUALS(value1, value2b, epsilon, location);
}
-
/**
* Test whether one unsigned integer value is greater than another.
* Test succeeds if value1 > value2
* @param[in] value2 The second value
* @param[in] location The TEST_LOCATION macro should be used here
*/
-template< typename T >
-void DALI_TEST_GREATER( T value1, T value2, const char* location)
+template<typename T>
+void DALI_TEST_GREATER(T value1, T value2, const char* location)
{
- if (!(value1 > value2))
+ if(!(value1 > value2))
{
- std::cerr << "Test failed in " << location << ", checking " << value1 <<" > " << value2 << "\n";
+ std::cerr << "Test failed in " << location << ", checking " << value1 << " > " << value2 << "\n";
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
* assertion which triggered the exception.
* @param[in] location The TEST_LOCATION macro should be used here.
*/
-void DALI_TEST_ASSERT( DaliException& e, std::string conditionSubString, const char* location );
+void DALI_TEST_ASSERT(DaliException& e, std::string conditionSubString, const char* location);
/**
* Print the assert
* @param[in] e The exception that we expect was fired by a runtime assertion failure.
*/
-inline void DALI_TEST_PRINT_ASSERT( DaliException& e )
+inline void DALI_TEST_PRINT_ASSERT(DaliException& e)
{
- tet_printf("Assertion %s failed at %s\n", e.condition, e.location );
+ tet_printf("Assertion %s failed at %s\n", e.condition, e.location);
}
/**
* @param expressions code to execute
* @param assertstring the substring expected in the assert
*/
-#define DALI_TEST_ASSERTION( expressions, assertstring ) \
-try \
-{ \
- TestApplication::EnableLogging( false ); \
- expressions; \
- TestApplication::EnableLogging( true ); \
- fprintf(stderr, "Test failed in %s, expected assert: '%s' didn't occur\n", __FILELINE__, assertstring ); \
- tet_result(TET_FAIL); \
- throw("TET_FAIL"); } \
-catch( Dali::DaliException& e ) \
-{ \
- DALI_TEST_ASSERT( e, assertstring, TEST_LOCATION ); \
-}
+#define DALI_TEST_ASSERTION(expressions, assertstring) \
+ try \
+ { \
+ TestApplication::EnableLogging(false); \
+ expressions; \
+ TestApplication::EnableLogging(true); \
+ fprintf(stderr, "Test failed in %s, expected assert: '%s' didn't occur\n", __FILELINE__, assertstring); \
+ tet_result(TET_FAIL); \
+ throw("TET_FAIL"); \
+ } \
+ catch(Dali::DaliException & e) \
+ { \
+ DALI_TEST_ASSERT(e, assertstring, TEST_LOCATION); \
+ }
// Functor to test whether an Applied signal is emitted
struct ConstraintAppliedCheck
{
- ConstraintAppliedCheck( bool& signalReceived );
- void operator()( Constraint& constraint );
- void Reset();
- void CheckSignalReceived();
- void CheckSignalNotReceived();
+ ConstraintAppliedCheck(bool& signalReceived);
+ void operator()(Constraint& constraint);
+ void Reset();
+ void CheckSignalReceived();
+ void CheckSignalNotReceived();
bool& mSignalReceived; // owned by individual tests
};
/**
* A Helper to test default functions
*/
-template <typename T>
+template<typename T>
struct DefaultFunctionCoverage
{
DefaultFunctionCoverage()
{
- T a;
- T *b = new T(a);
+ T a;
+ T* b = new T(a);
DALI_TEST_CHECK(b);
a = *b;
delete b;
class ObjectDestructionTracker : public ConnectionTracker
{
public:
-
/**
* @brief Call in main part of code
* @param[in] objectRegistry The object Registry being used
*/
- ObjectDestructionTracker( ObjectRegistry objectRegistry );
+ ObjectDestructionTracker(ObjectRegistry objectRegistry);
/**
* @brief Call in sub bock of code where the Actor being checked is still alive.
*
* @param[in] actor Actor to be checked for destruction
*/
- void Start( Actor actor );
+ void Start(Actor actor);
/**
* @brief Call to check if Actor alive or destroyed.
private:
ObjectRegistry mObjectRegistry;
- bool mRefObjectDestroyed;
+ bool mRefObjectDestroyed;
};
} // namespace Test
namespace Dali
{
-
Shader CreateShader()
{
- return Shader::New( "vertexSrc", "fragmentSrc" );
+ return Shader::New("vertexSrc", "fragmentSrc");
}
TextureSet CreateTextureSet()
return TextureSet::New();
}
-TextureSet CreateTextureSet( Texture texture )
+TextureSet CreateTextureSet(Texture texture)
{
TextureSet textureSet = TextureSet::New();
textureSet.SetTexture(0u, texture);
VertexBuffer CreateVertexBuffer()
{
Property::Map texturedQuadVertexFormat;
- texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
+ texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
- VertexBuffer vertexData = VertexBuffer::New( texturedQuadVertexFormat );
+ VertexBuffer vertexData = VertexBuffer::New(texturedQuadVertexFormat);
return vertexData;
}
Geometry CreateQuadGeometry(void)
{
- VertexBuffer vertexData = CreateVertexBuffer();
- const float halfQuadSize = .5f;
- struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
+ VertexBuffer vertexData = CreateVertexBuffer();
+ const float halfQuadSize = .5f;
+ struct TexturedQuadVertex
+ {
+ Vector2 position;
+ Vector2 textureCoordinates;
+ };
TexturedQuadVertex texturedQuadVertexData[4] = {
- { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
- { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
- { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
- { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
+ {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)},
+ {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)},
+ {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)},
+ {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}};
vertexData.SetData(texturedQuadVertexData, 4);
- unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
+ unsigned short indexData[6] = {0, 3, 1, 0, 2, 3};
Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexData );
- geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
+ geometry.AddVertexBuffer(vertexData);
+ geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
return geometry;
}
-
-
} // namespace Dali
namespace Dali
{
-
-Shader CreateShader();
-TextureSet CreateTextureSet();
-TextureSet CreateTextureSet( Texture texture );
-Geometry CreateQuadGeometry();
+Shader CreateShader();
+TextureSet CreateTextureSet();
+TextureSet CreateTextureSet(Texture texture);
+Geometry CreateQuadGeometry();
VertexBuffer CreateVertexBuffer();
-}
+} // namespace Dali
#endif // MESH_BUILDER_H
namespace Dali
{
-
namespace
{
-
const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
- attribute mediump vec2 aPosition;\n
- uniform mediump mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
- \n
- void main()\n
- {\n
- mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
- vertexPosition.xyz *= uSize;\n
- gl_Position = uMvpMatrix * vertexPosition;\n
- }\n
-);
+ attribute mediump vec2 aPosition;\n
+ uniform mediump mat4 uMvpMatrix;\n
+ uniform mediump vec3 uSize;\n
+ \n void main()\n {
+ \n
+ mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);
+ \n
+ vertexPosition.xyz *= uSize;
+ \n
+ gl_Position = uMvpMatrix * vertexPosition;
+ \n
+ }\n);
const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
uniform lowp vec4 uColor;\n
- \n
- void main()\n
- {\n
- gl_FragColor = uColor;\n
- }\n
-);
+ \n void main()\n {
+ \n
+ gl_FragColor = uColor;
+ \n
+ }\n);
} // unnamed namespace
Actor CreateRenderableActor()
{
- return CreateRenderableActor( Texture(), VERTEX_SHADER, FRAGMENT_SHADER );
+ return CreateRenderableActor(Texture(), VERTEX_SHADER, FRAGMENT_SHADER);
}
-Actor CreateRenderableActor( Texture texture )
+Actor CreateRenderableActor(Texture texture)
{
- return CreateRenderableActor( texture, VERTEX_SHADER, FRAGMENT_SHADER );
+ return CreateRenderableActor(texture, VERTEX_SHADER, FRAGMENT_SHADER);
}
-Actor CreateRenderableActor( Texture texture, const std::string& vertexShader, const std::string& fragmentShader )
+Actor CreateRenderableActor(Texture texture, const std::string& vertexShader, const std::string& fragmentShader)
{
// Create the geometry
Geometry geometry = CreateQuadGeometry();
// Create Shader
- Shader shader = Shader::New( vertexShader, fragmentShader );
+ Shader shader = Shader::New(vertexShader, fragmentShader);
// Create renderer from geometry and material
- Renderer renderer = Renderer::New( geometry, shader );
+ Renderer renderer = Renderer::New(geometry, shader);
// Create actor and set renderer
Actor actor = Actor::New();
- actor.AddRenderer( renderer );
+ actor.AddRenderer(renderer);
// If we a texture, then create a texture-set and add to renderer
- if( texture )
+ if(texture)
{
TextureSet textureSet = TextureSet::New();
- textureSet.SetTexture( 0u, texture );
- renderer.SetTextures( textureSet );
+ textureSet.SetTexture(0u, texture);
+ renderer.SetTextures(textureSet);
// Set actor to the size of the texture if set
- actor.SetProperty( Actor::Property::SIZE, Vector2( texture.GetWidth(), texture.GetHeight() ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(texture.GetWidth(), texture.GetHeight()));
}
return actor;
namespace Dali
{
-
class Actor;
class Image;
class Texture;
* @param[in] texture Texture to set.
* @return An actor with a renderer.
*/
-Actor CreateRenderableActor( Texture texture );
+Actor CreateRenderableActor(Texture texture);
/**
* @brief Creates a renderable-actor with a texture and custom shaders.
* @param[in] fragmentShader The fragment-shader.
* @return An actor with a renderer.
*/
-Actor CreateRenderableActor( Texture texture, const std::string& vertexShader, const std::string& fragmentShader );
+Actor CreateRenderableActor(Texture texture, const std::string& vertexShader, const std::string& fragmentShader);
} // namespace Dali
namespace Dali
{
-
bool TestApplication::mLoggingEnabled = true;
-TestApplication::TestApplication( uint32_t surfaceWidth,
- uint32_t surfaceHeight,
- uint32_t horizontalDpi,
- uint32_t verticalDpi,
- bool initialize,
- bool enablePartialUpdate )
-: mCore( NULL ),
- mSurfaceWidth( surfaceWidth ),
- mSurfaceHeight( surfaceHeight ),
- mFrame( 0u ),
- mDpi{ horizontalDpi, verticalDpi },
+TestApplication::TestApplication(uint32_t surfaceWidth,
+ uint32_t surfaceHeight,
+ uint32_t horizontalDpi,
+ uint32_t verticalDpi,
+ bool initialize,
+ bool enablePartialUpdate)
+: mCore(NULL),
+ mSurfaceWidth(surfaceWidth),
+ mSurfaceHeight(surfaceHeight),
+ mFrame(0u),
+ mDpi{horizontalDpi, verticalDpi},
mLastVSyncTime(0u),
mPartialUpdateEnabled(enablePartialUpdate)
{
- if( initialize )
+ if(initialize)
{
Initialize();
}
// We always need the first update!
mStatus.keepUpdating = Integration::KeepUpdating::STAGE_KEEP_RENDERING;
- mCore = Dali::Integration::Core::New( mRenderController,
- mPlatformAbstraction,
- mGlAbstraction,
- mGlSyncAbstraction,
- mGlContextHelperAbstraction,
- Integration::RenderToFrameBuffer::FALSE,
- Integration::DepthBufferAvailable::TRUE,
- Integration::StencilBufferAvailable::TRUE,
- mPartialUpdateEnabled ? Integration::PartialUpdateAvailable::TRUE : Integration::PartialUpdateAvailable::FALSE );
+ mCore = Dali::Integration::Core::New(mRenderController,
+ mPlatformAbstraction,
+ mGlAbstraction,
+ mGlSyncAbstraction,
+ mGlContextHelperAbstraction,
+ Integration::RenderToFrameBuffer::FALSE,
+ Integration::DepthBufferAvailable::TRUE,
+ Integration::StencilBufferAvailable::TRUE,
+ mPartialUpdateEnabled ? Integration::PartialUpdateAvailable::TRUE : Integration::PartialUpdateAvailable::FALSE);
mCore->ContextCreated();
Dali::Integration::Log::InstallLogFunction(logFunction);
Dali::Integration::Trace::LogContextFunction logContextFunction(&TestApplication::LogContext);
- Dali::Integration::Trace::InstallLogContextFunction( logContextFunction );
+ Dali::Integration::Trace::InstallLogContextFunction(logContextFunction);
- Dali::Integration::Trace::LogContext( true, "Test" );
+ Dali::Integration::Trace::LogContext(true, "Test");
}
void TestApplication::CreateScene()
{
- mScene = Dali::Integration::Scene::New( Size( static_cast<float>( mSurfaceWidth ), static_cast<float>( mSurfaceHeight ) ) );
- mScene.SetDpi( Vector2( static_cast<float>( mDpi.x ), static_cast<float>( mDpi.y ) ) );
+ mScene = Dali::Integration::Scene::New(Size(static_cast<float>(mSurfaceWidth), static_cast<float>(mSurfaceHeight)));
+ mScene.SetDpi(Vector2(static_cast<float>(mDpi.x), static_cast<float>(mDpi.y)));
}
void TestApplication::InitializeCore()
delete mCore;
}
-void TestApplication::LogContext( bool start, const char* tag )
+void TestApplication::LogContext(bool start, const char* tag)
{
- if( start )
+ if(start)
{
fprintf(stderr, "INFO: Trace Start: %s\n", tag);
}
void TestApplication::LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message)
{
- if( mLoggingEnabled )
+ if(mLoggingEnabled)
{
switch(level)
{
mCore->ProcessEvents();
}
-void TestApplication::DoUpdate( uint32_t intervalMilliseconds, const char* location )
+void TestApplication::DoUpdate(uint32_t intervalMilliseconds, const char* location)
{
- if( GetUpdateStatus() == 0 &&
- mRenderStatus.NeedsUpdate() == false &&
- ! GetRenderController().WasCalled(TestRenderController::RequestUpdateFunc) )
+ if(GetUpdateStatus() == 0 &&
+ mRenderStatus.NeedsUpdate() == false &&
+ !GetRenderController().WasCalled(TestRenderController::RequestUpdateFunc))
{
- fprintf(stderr, "WARNING - Update not required :%s\n", location==NULL?"NULL":location);
+ fprintf(stderr, "WARNING - Update not required :%s\n", location == NULL ? "NULL" : location);
}
- uint32_t nextVSyncTime = mLastVSyncTime + intervalMilliseconds;
- float elapsedSeconds = static_cast<float>( intervalMilliseconds ) * 0.001f;
+ uint32_t nextVSyncTime = mLastVSyncTime + intervalMilliseconds;
+ float elapsedSeconds = static_cast<float>(intervalMilliseconds) * 0.001f;
- mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false );
+ mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false);
GetRenderController().Initialize();
mLastVSyncTime = nextVSyncTime;
}
-bool TestApplication::Render( uint32_t intervalMilliseconds, const char* location )
+bool TestApplication::Render(uint32_t intervalMilliseconds, const char* location)
{
- DoUpdate( intervalMilliseconds, location );
+ DoUpdate(intervalMilliseconds, location);
// Reset the status
- mRenderStatus.SetNeedsUpdate( false );
- mRenderStatus.SetNeedsPostRender( false );
+ mRenderStatus.SetNeedsUpdate(false);
+ mRenderStatus.SetNeedsPostRender(false);
- mCore->PreRender( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
- mCore->RenderScene( mRenderStatus, mScene, true /*render the off-screen buffers*/ );
- mCore->RenderScene( mRenderStatus, mScene, false /*render the surface*/ );
- mCore->PostRender( false /*do not skip rendering*/ );
+ mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
+ mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
+ mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
+ mCore->PostRender(false /*do not skip rendering*/);
mFrame++;
{
DoUpdate(intervalMilliseconds, location);
- mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
+ mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
mCore->PreRender(mScene, damagedRects);
return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate();
return mStatus.KeepUpdating();
}
-bool TestApplication::UpdateOnly( uint32_t intervalMilliseconds )
+bool TestApplication::UpdateOnly(uint32_t intervalMilliseconds)
{
- DoUpdate( intervalMilliseconds );
+ DoUpdate(intervalMilliseconds);
return mStatus.KeepUpdating();
}
return mRenderStatus.NeedsPostRender();
}
-bool TestApplication::RenderOnly( )
+bool TestApplication::RenderOnly()
{
// Update Time values
- mCore->PreRender( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
- mCore->RenderScene( mRenderStatus, mScene, true /*render the off-screen buffers*/ );
- mCore->RenderScene( mRenderStatus, mScene, false /*render the surface*/ );
- mCore->PostRender( false /*do not skip rendering*/ );
+ mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
+ mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
+ mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
+ mCore->PostRender(false /*do not skip rendering*/);
mFrame++;
mCore->ContextCreated();
}
-uint32_t TestApplication::Wait( uint32_t durationToWait )
+uint32_t TestApplication::Wait(uint32_t durationToWait)
{
int time = 0;
- for(uint32_t i = 0; i <= ( durationToWait / RENDER_FRAME_INTERVAL); i++)
+ for(uint32_t i = 0; i <= (durationToWait / RENDER_FRAME_INTERVAL); i++)
{
SendNotification();
Render(RENDER_FRAME_INTERVAL);
return time;
}
-} // Namespace dali
+} // namespace Dali
*/
// INTERNAL INCLUDES
+#include <dali/integration-api/resource-policies.h>
+#include <dali/integration-api/scene.h>
+#include <dali/integration-api/trace.h>
+#include <dali/public-api/common/dali-common.h>
#include <test-platform-abstraction.h>
-#include "test-gl-sync-abstraction.h"
+
#include "test-gl-abstraction.h"
#include "test-gl-context-helper-abstraction.h"
+#include "test-gl-sync-abstraction.h"
#include "test-render-controller.h"
-#include <dali/public-api/common/dali-common.h>
-#include <dali/integration-api/resource-policies.h>
-#include <dali/integration-api/trace.h>
-#include <dali/integration-api/scene.h>
namespace Dali
{
-
class DALI_CORE_API TestApplication : public ConnectionTracker
{
public:
-
// Default values derived from H2 device.
- static const uint32_t DEFAULT_SURFACE_WIDTH = 480;
+ static const uint32_t DEFAULT_SURFACE_WIDTH = 480;
static const uint32_t DEFAULT_SURFACE_HEIGHT = 800;
static constexpr uint32_t DEFAULT_HORIZONTAL_DPI = 220;
static const uint32_t RENDER_FRAME_INTERVAL = 16;
- TestApplication( uint32_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
- uint32_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
- uint32_t horizontalDpi = DEFAULT_HORIZONTAL_DPI,
- uint32_t verticalDpi = DEFAULT_VERTICAL_DPI,
- bool initialize = true,
- bool enablePartialUpdate = false );
+ TestApplication(uint32_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
+ uint32_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
+ uint32_t horizontalDpi = DEFAULT_HORIZONTAL_DPI,
+ uint32_t verticalDpi = DEFAULT_VERTICAL_DPI,
+ bool initialize = true,
+ bool enablePartialUpdate = false);
void Initialize();
void CreateCore();
void CreateScene();
void InitializeCore();
~TestApplication() override;
- static void LogMessage( Dali::Integration::Log::DebugPriority level, std::string& message );
- static void LogContext( bool start, const char* tag );
- Dali::Integration::Core& GetCore();
- TestPlatformAbstraction& GetPlatform();
- TestRenderController& GetRenderController();
- TestGlAbstraction& GetGlAbstraction();
- TestGlSyncAbstraction& GetGlSyncAbstraction();
+ static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
+ static void LogContext(bool start, const char* tag);
+ Dali::Integration::Core& GetCore();
+ TestPlatformAbstraction& GetPlatform();
+ TestRenderController& GetRenderController();
+ TestGlAbstraction& GetGlAbstraction();
+ TestGlSyncAbstraction& GetGlSyncAbstraction();
TestGlContextHelperAbstraction& GetGlContextHelperAbstraction();
- void ProcessEvent(const Integration::Event& event);
- void SendNotification();
- bool Render( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL );
- bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
- bool RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
- uint32_t GetUpdateStatus();
- bool UpdateOnly( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
- bool RenderOnly( );
- void ResetContext();
- bool GetRenderNeedsUpdate();
- bool GetRenderNeedsPostRender();
- uint32_t Wait( uint32_t durationToWait );
- static void EnableLogging( bool enabled )
+ void ProcessEvent(const Integration::Event& event);
+ void SendNotification();
+ bool Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL);
+ bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
+ bool RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
+ uint32_t GetUpdateStatus();
+ bool UpdateOnly(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL);
+ bool RenderOnly();
+ void ResetContext();
+ bool GetRenderNeedsUpdate();
+ bool GetRenderNeedsPostRender();
+ uint32_t Wait(uint32_t durationToWait);
+ static void EnableLogging(bool enabled)
{
mLoggingEnabled = enabled;
}
}
private:
- void DoUpdate( uint32_t intervalMilliseconds, const char* location=NULL );
+ void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL);
protected:
- TestPlatformAbstraction mPlatformAbstraction;
- TestRenderController mRenderController;
- TestGlAbstraction mGlAbstraction;
- TestGlSyncAbstraction mGlSyncAbstraction;
+ TestPlatformAbstraction mPlatformAbstraction;
+ TestRenderController mRenderController;
+ TestGlAbstraction mGlAbstraction;
+ TestGlSyncAbstraction mGlSyncAbstraction;
TestGlContextHelperAbstraction mGlContextHelperAbstraction;
Integration::UpdateStatus mStatus;
Integration::RenderStatus mRenderStatus;
- Integration::Core* mCore;
+ Integration::Core* mCore;
Dali::Integration::Scene mScene;
uint32_t mSurfaceWidth;
uint32_t mSurfaceHeight;
uint32_t mFrame;
- struct { uint32_t x; uint32_t y; } mDpi;
- uint32_t mLastVSyncTime;
- bool mPartialUpdateEnabled;
+ struct
+ {
+ uint32_t x;
+ uint32_t y;
+ } mDpi;
+ uint32_t mLastVSyncTime;
+ bool mPartialUpdateEnabled;
static bool mLoggingEnabled;
};
-} // Dali
+} // namespace Dali
#endif // DALI_TEST_APPLICATION_H
#define DALI_TEST_COMPARE_TYPES_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/public-api/dali-core.h>
using namespace Dali;
-
-template <typename Type>
+template<typename Type>
inline bool CompareType(Type value1, Type value2, float epsilon)
{
return value1 == value2;
* @param[in] epsilon difference threshold
* @returns true if difference is smaller than epsilon threshold, false otherwise
*/
-template <>
+template<>
inline bool CompareType<float>(float value1, float value2, float epsilon)
{
return fabsf(value1 - value2) < epsilon;
* @param[in] epsilon difference threshold
* @returns true if difference is smaller than epsilon threshold, false otherwise
*/
-template <>
+template<>
inline bool CompareType<Vector2>(Vector2 vector1, Vector2 vector2, float epsilon)
{
- return fabsf(vector1.x - vector2.x)<epsilon && fabsf(vector1.y - vector2.y)<epsilon;
+ return fabsf(vector1.x - vector2.x) < epsilon && fabsf(vector1.y - vector2.y) < epsilon;
}
/**
* @param[in] epsilon difference threshold
* @returns true if difference is smaller than epsilon threshold, false otherwise
*/
-template <>
+template<>
inline bool CompareType<Vector3>(Vector3 vector1, Vector3 vector2, float epsilon)
{
- return fabsf(vector1.x - vector2.x)<epsilon &&
- fabsf(vector1.y - vector2.y)<epsilon &&
- fabsf(vector1.z - vector2.z)<epsilon;
+ return fabsf(vector1.x - vector2.x) < epsilon &&
+ fabsf(vector1.y - vector2.y) < epsilon &&
+ fabsf(vector1.z - vector2.z) < epsilon;
}
-
/**
* A helper for fuzzy-comparing Vector4 objects
* @param[in] vector1 the first object
* @param[in] epsilon difference threshold
* @returns true if difference is smaller than epsilon threshold, false otherwise
*/
-template <>
+template<>
inline bool CompareType<Vector4>(Vector4 vector1, Vector4 vector2, float epsilon)
{
- return fabsf(vector1.x - vector2.x)<epsilon &&
- fabsf(vector1.y - vector2.y)<epsilon &&
- fabsf(vector1.z - vector2.z)<epsilon &&
- fabsf(vector1.w - vector2.w)<epsilon;
+ return fabsf(vector1.x - vector2.x) < epsilon &&
+ fabsf(vector1.y - vector2.y) < epsilon &&
+ fabsf(vector1.z - vector2.z) < epsilon &&
+ fabsf(vector1.w - vector2.w) < epsilon;
}
-template <>
+template<>
inline bool CompareType<Quaternion>(Quaternion q1, Quaternion q2, float epsilon)
{
Quaternion q2N = -q2; // These quaternions represent the same rotation
return CompareType<Vector4>(q1.mVector, q2.mVector, epsilon) || CompareType<Vector4>(q1.mVector, q2N.mVector, epsilon);
}
-template <>
+template<>
inline bool CompareType<Radian>(Radian q1, Radian q2, float epsilon)
{
return CompareType<float>(q1.radian, q2.radian, epsilon);
}
-template <>
+template<>
inline bool CompareType<Degree>(Degree q1, Degree q2, float epsilon)
{
return CompareType<float>(q1.degree, q2.degree, epsilon);
}
-template <>
+template<>
inline bool CompareType<Extents>(Extents extents1, Extents extents2, float epsilon)
{
return (extents1.start == extents2.start) &&
(extents1.bottom == extents2.bottom);
}
-template <>
+template<>
inline bool CompareType<Property::Value>(Property::Value q1, Property::Value q2, float epsilon)
{
Property::Type type = q1.GetType();
- if( type != q2.GetType() )
+ if(type != q2.GetType())
{
return false;
}
bool a, b;
q1.Get(a);
q2.Get(b);
- result = a == b;
+ result = a == b;
break;
}
case Property::INTEGER:
int a, b;
q1.Get(a);
q2.Get(b);
- result = a == b;
+ result = a == b;
break;
}
case Property::FLOAT:
float a, b;
q1.Get(a);
q2.Get(b);
- result = CompareType<float>(a, b, epsilon);
+ result = CompareType<float>(a, b, epsilon);
break;
}
case Property::VECTOR2:
case Property::MAP:
{
//TODO: Implement this?
- DALI_ASSERT_ALWAYS( 0 && "Not implemented");
+ DALI_ASSERT_ALWAYS(0 && "Not implemented");
result = false;
break;
}
Extents a, b;
q1.Get(a);
q2.Get(b);
- result = CompareType<Extents>( a, b, epsilon );
+ result = CompareType<Extents>(a, b, epsilon);
break;
}
case Property::NONE:
return result;
}
-
-
#endif
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace
{
-const uint32_t RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
+const uint32_t RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
-Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
+Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
+ Integration::Point point;
+ point.SetState(state);
point.SetDeviceId(4);
- point.SetScreenPosition( screenPosition );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
+ point.SetScreenPosition(screenPosition);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time )
+Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( stateA );
+ Integration::Point point;
+ point.SetState(stateA);
point.SetDeviceId(4);
- point.SetScreenPosition( screenPositionA );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
- point.SetScreenPosition( screenPositionB );
- point.SetState( stateB);
+ point.SetScreenPosition(screenPositionA);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
+ point.SetScreenPosition(screenPositionB);
+ point.SetState(stateB);
point.SetDeviceId(7);
- touchEvent.points.push_back( point );
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
return RENDER_FRAME_INTERVAL;
}
-void TestStartLongPress( TestApplication& application, float x, float y, uint32_t time )
+void TestStartLongPress(TestApplication& application, float x, float y, uint32_t time)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( x, y ), time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(x, y), time));
}
-void TestTriggerLongPress( TestApplication& application )
+void TestTriggerLongPress(TestApplication& application)
{
application.GetPlatform().TriggerTimer();
}
-void TestGenerateLongPress( TestApplication& application, float x, float y, uint32_t time )
+void TestGenerateLongPress(TestApplication& application, float x, float y, uint32_t time)
{
- TestStartLongPress( application, x, y, time );
- TestTriggerLongPress( application );
+ TestStartLongPress(application, x, y, time);
+ TestTriggerLongPress(application);
}
-void TestEndLongPress( TestApplication& application, float x, float y, uint32_t time )
+void TestEndLongPress(TestApplication& application, float x, float y, uint32_t time)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( x, y ), time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(x, y), time));
}
-void TestGeneratePinch( TestApplication& application)
+void TestGeneratePinch(TestApplication& application)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( 20.0f, 55.0f ), PointState::UP, Vector2( 20.0f, 58.0f ), 200 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 74.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 46.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 58.0f), 190));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(20.0f, 55.0f), PointState::UP, Vector2(20.0f, 58.0f), 200));
}
-void TestStartPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestStartPinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, a1, PointState::DOWN, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 50 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 150 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, a1, PointState::DOWN, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 50));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 100));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 150));
}
-void TestContinuePinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestContinuePinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time + 50 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time +150 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time + 50));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 100));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 150));
}
-void TestEndPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestEndPinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, a2, PointState::UP, b2, time +50 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, a2, PointState::UP, b2, time + 50));
}
-void TestGenerateMiniPan( TestApplication& application)
+void TestGenerateMiniPan(TestApplication& application)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 250 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 40.0f ), 255 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 250));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 251));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 40.0f), 255));
}
-void TestStartPan( TestApplication& application, Vector2 start, Vector2 end, uint32_t& time )
+void TestStartPan(TestApplication& application, Vector2 start, Vector2 end, uint32_t& time)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, start, time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, start, time));
time += RENDER_FRAME_INTERVAL;
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, end, time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, end, time));
time += RENDER_FRAME_INTERVAL;
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, end, time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, end, time));
time += RENDER_FRAME_INTERVAL;
}
-void TestMovePan( TestApplication& application, Vector2 pos, uint32_t time )
+void TestMovePan(TestApplication& application, Vector2 pos, uint32_t time)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, pos, time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, pos, time));
}
-void TestEndPan( TestApplication& application, Vector2 pos, uint32_t time )
+void TestEndPan(TestApplication& application, Vector2 pos, uint32_t time)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, pos, time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, pos, time));
}
-void TestGenerateTap( TestApplication& application, float x, float y, uint32_t time_down )
+void TestGenerateTap(TestApplication& application, float x, float y, uint32_t time_down)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( x, y ), time_down ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( x, y ), time_down + 20 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(x, y), time_down));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(x, y), time_down + 20));
}
-void TestGenerateTwoPointTap( TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down )
+void TestGenerateTwoPointTap(TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( x1, y1 ), PointState::DOWN, Vector2( x2, y2 ), time_down ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( x1, y1 ), PointState::UP, Vector2( x2, y2 ), time_down + 20 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(x1, y1), PointState::DOWN, Vector2(x2, y2), time_down));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(x1, y1), PointState::UP, Vector2(x2, y2), time_down + 20));
}
-void TestGenerateRotation( TestApplication& application )
+void TestGenerateRotation(TestApplication& application)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 25.0f, 95.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 30.0f, 100.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 35.0f, 105.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 40.0f, 110.0f ), 190 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), PointState::UP, Vector2( 45.0f, 115.0f ), 200 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(25.0f, 95.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(30.0f, 100.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(35.0f, 105.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(40.0f, 110.0f), 190));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(20.0f, 20.0f), PointState::UP, Vector2(45.0f, 115.0f), 200));
}
-void TestStartRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestStartRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, a1, PointState::DOWN, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 50 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 150 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, a1, PointState::DOWN, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 50));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 100));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 150));
}
-void TestContinueRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestContinueRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time + 50 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time +150 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time + 50));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 100));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 150));
}
-void TestEndRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestEndRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, a2, PointState::UP, b2, time +50 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, a2, PointState::UP, b2, time + 50));
}
} // namespace Dali
#define DALI_TEST_GESTURE_GENERATOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
/**
* Produces the initial touch of a long press
*/
-void TestStartLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 );
+void TestStartLongPress(TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450);
/**
* Triggers the timer to begin a long press gesture
*/
-void TestTriggerLongPress( TestApplication& application );
+void TestTriggerLongPress(TestApplication& application);
/**
* Produces the initial press and triggers the timer to begin a long press gesture
*/
-void TestGenerateLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 );
+void TestGenerateLongPress(TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450);
/**
* End a long press by lifting the touch
*/
-void TestEndLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 );
+void TestEndLongPress(TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450);
/**
* Produces a vertical pinch gesture between (20,20) and (20,90)
*/
-void TestGeneratePinch( TestApplication& application );
+void TestGeneratePinch(TestApplication& application);
/**
* Produces the gesture started event of a pinch, using 4 touches, 50ms apart, starting with 1, ending at 2
*/
-void TestStartPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestStartPinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
/**
* Produces a gesture continuing event of a pinch, using 4 touches, 50ms apart, starting with 1, ending at 2
*/
-void TestContinuePinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestContinuePinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
/**
* Produces a gesture finished event of a pinch, using 2 touches, 50ms apart
*/
-void TestEndPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestEndPinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
/**
* Produces a pan gesture from (20,20) to (20,40)
*/
-void TestGenerateMiniPan( TestApplication& application );
+void TestGenerateMiniPan(TestApplication& application);
/**
* Produces the start event of a pan gesture, assuming minimum distance moved between start and end is greater than 15
* in either direction or 11 in both (x&y). Time will be incremented using the standard frame interval per touch movement
*/
-void TestStartPan( TestApplication& application, Vector2 start, Vector2 end, uint32_t& time );
+void TestStartPan(TestApplication& application, Vector2 start, Vector2 end, uint32_t& time);
/**
* Continues a pan event by creating a single touch at pos.
* N.B This does not increment the time
*/
-void TestMovePan( TestApplication& application, Vector2 pos, uint32_t time = 400);
+void TestMovePan(TestApplication& application, Vector2 pos, uint32_t time = 400);
/**
* End a pan gesture at position pos
*/
-void TestEndPan( TestApplication& application, Vector2 pos, uint32_t time = 500);
+void TestEndPan(TestApplication& application, Vector2 pos, uint32_t time = 500);
/**
* Produces a single point tap gesture with a 20ms interval
*/
-void TestGenerateTap( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time_down = 100 );
+void TestGenerateTap(TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time_down = 100);
/**
* Produce a tap gesture with two touch points and a 20ms interval
*/
-void TestGenerateTwoPointTap( TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down );
+void TestGenerateTwoPointTap(TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down);
/**
* Produces a rotation gesture.
*/
-void TestGenerateRotation( TestApplication& application );
+void TestGenerateRotation(TestApplication& application);
/**
* Produces the gesture started event of a rotation, using 4 touches, 50ms apart, starting with 1, ending at 2
*/
-void TestStartRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestStartRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
/**
* Produces a gesture continuing event of a rotation, using 4 touches, 50ms apart, starting with 1, ending at 2
*/
-void TestContinueRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestContinueRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
/**
* Produces a gesture finished event of a rotation, using 2 touches, 50ms apart
*/
-void TestEndRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestEndRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
} // namespace Dali
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
TestGlAbstraction::TestGlAbstraction()
{
Initialize();
}
-TestGlAbstraction::~TestGlAbstraction() {}
+TestGlAbstraction::~TestGlAbstraction()
+{
+}
void TestGlAbstraction::Initialize()
{
- mCurrentProgram = 0;
- mCompileStatus = GL_TRUE;
- mLinkStatus = GL_TRUE;
- mNumberOfActiveUniforms = 0;
- mGetAttribLocationResult = 0;
- mGetErrorResult = 0;
- mGetStringResult = NULL;
- mIsBufferResult = 0;
- mIsEnabledResult = 0;
- mIsFramebufferResult = 0;
- mIsProgramResult = 0;
- mIsRenderbufferResult = 0;
- mIsShaderResult = 0;
- mIsTextureResult = 0;
- mActiveTextureUnit = 0;
- mCheckFramebufferStatusResult = 0;
- mFramebufferStatus = 0;
- mFramebufferDepthAttached = 0;
- mFramebufferStencilAttached = 0;
+ mCurrentProgram = 0;
+ mCompileStatus = GL_TRUE;
+ mLinkStatus = GL_TRUE;
+ mNumberOfActiveUniforms = 0;
+ mGetAttribLocationResult = 0;
+ mGetErrorResult = 0;
+ mGetStringResult = NULL;
+ mIsBufferResult = 0;
+ mIsEnabledResult = 0;
+ mIsFramebufferResult = 0;
+ mIsProgramResult = 0;
+ mIsRenderbufferResult = 0;
+ mIsShaderResult = 0;
+ mIsTextureResult = 0;
+ mActiveTextureUnit = 0;
+ mCheckFramebufferStatusResult = 0;
+ mFramebufferStatus = 0;
+ mFramebufferDepthAttached = 0;
+ mFramebufferStencilAttached = 0;
mFramebufferColorAttachmentCount = 0;
- mFrameBufferColorStatus = 0;
- mNumBinaryFormats = 0;
- mBinaryFormats = 0;
- mProgramBinaryLength = 0;
+ mFrameBufferColorStatus = 0;
+ mNumBinaryFormats = 0;
+ mBinaryFormats = 0;
+ mProgramBinaryLength = 0;
mVertexAttribArrayChanged = false;
- mGetProgramBinaryCalled = false;
+ mGetProgramBinaryCalled = false;
mLastShaderCompiled = 0;
- mLastClearBitMask = 0;
- mLastClearColor = Color::TRANSPARENT;
- mClearCount = 0;
+ mLastClearBitMask = 0;
+ mLastClearColor = Color::TRANSPARENT;
+ mClearCount = 0;
mLastBlendEquationRgb = 0;
mLastBlendEquationAlpha = 0;
mLastBlendFuncDstRgb = 0;
mLastBlendFuncSrcAlpha = 0;
mLastBlendFuncDstAlpha = 0;
- mLastAutoTextureIdUsed = 0;
- mNumGeneratedTextures = 0;
- mLastShaderIdUsed = 0;
- mLastProgramIdUsed = 0;
- mLastUniformIdUsed = 0;
- mLastDepthMask = false;
+ mLastAutoTextureIdUsed = 0;
+ mNumGeneratedTextures = 0;
+ mLastShaderIdUsed = 0;
+ mLastProgramIdUsed = 0;
+ mLastUniformIdUsed = 0;
+ mLastDepthMask = false;
mUniforms.clear();
mProgramUniforms1i.clear();
mTexParamaterTrace.Reset();
mDrawTrace.Reset();
- for( unsigned int i=0; i<MAX_ATTRIBUTE_CACHE_SIZE; ++i )
+ for(unsigned int i = 0; i < MAX_ATTRIBUTE_CACHE_SIZE; ++i)
{
mVertexAttribArrayState[i] = false;
}
return true;
}
-bool TestGlAbstraction::TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const
+bool TestGlAbstraction::TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const
{
- return ( ( imageGlFormat == GL_RGB ) && ( textureGlFormat == GL_RGBA ) );
+ return ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA));
}
-} // Namespace dali
+} // namespace Dali
bool BlendEnabled(const Dali::TraceCallStack& callStack)
{
std::stringstream out;
out << GL_BLEND;
- bool blendEnabled = callStack.FindMethodAndParams( "Enable", out.str() );
+ bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str());
return blendEnabled;
}
{
std::stringstream out;
out << GL_BLEND;
- bool blendEnabled = callStack.FindMethodAndParams( "Disable", out.str() );
+ bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str());
return blendEnabled;
}
-
*/
// EXTERNAL INCLUDES
-#include <sstream>
-#include <string>
-#include <cstring>
-#include <map>
#include <cstdio>
+#include <cstring>
#include <cstring> // for strcmp
+#include <map>
+#include <sstream>
+#include <string>
#include <typeinfo>
// INTERNAL INCLUDES
-#include <dali/public-api/dali-core.h>
#include <dali/devel-api/rendering/frame-buffer-devel.h>
#include <dali/integration-api/core.h>
#include <dali/integration-api/gl-abstraction.h>
#include <dali/integration-api/gl-defines.h>
-#include <test-trace-call-stack.h>
+#include <dali/public-api/dali-core.h>
#include <test-compare-types.h>
+#include <test-trace-call-stack.h>
namespace Dali
{
-
static const unsigned int MAX_ATTRIBUTE_CACHE_SIZE = 64;
-static const char *mStdAttribs[MAX_ATTRIBUTE_CACHE_SIZE] =
-{
+static const char* mStdAttribs[MAX_ATTRIBUTE_CACHE_SIZE] =
+ {
"aPosition", // ATTRIB_POSITION
"aNormal", // ATTRIB_NORMAL
"aTexCoord", // ATTRIB_TEXCOORD
"aBoneIndices" // ATTRIB_BONE_INDICES
};
-class DALI_CORE_API TestGlAbstraction: public Dali::Integration::GlAbstraction
+class DALI_CORE_API TestGlAbstraction : public Dali::Integration::GlAbstraction
{
public:
TestGlAbstraction();
bool IsSurfacelessContextSupported() const override;
- bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const override;
+ bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const override;
/* OpenGL ES 2.0 */
- inline void ActiveTexture( GLenum textureUnit ) override
+ inline void ActiveTexture(GLenum textureUnit) override
{
mActiveTextureUnit = textureUnit - GL_TEXTURE0;
}
return mActiveTextureUnit + GL_TEXTURE0;
}
- inline void AttachShader( GLuint program, GLuint shader ) override
+ inline void AttachShader(GLuint program, GLuint shader) override
{
std::stringstream out;
out << program << ", " << shader;
TraceCallStack::NamedParams namedParams;
namedParams["program"] = ToString(program);
- namedParams["shader"] = ToString(shader);
+ namedParams["shader"] = ToString(shader);
mShaderTrace.PushCall("AttachShader", out.str(), namedParams);
}
- inline void BindAttribLocation( GLuint program, GLuint index, const char* name ) override
+ inline void BindAttribLocation(GLuint program, GLuint index, const char* name) override
{
}
- inline void BindBuffer( GLenum target, GLuint buffer ) override
+ inline void BindBuffer(GLenum target, GLuint buffer) override
{
}
- inline void BindFramebuffer( GLenum target, GLuint framebuffer ) override
+ inline void BindFramebuffer(GLenum target, GLuint framebuffer) override
{
//Add 010 bit;
mFramebufferStatus |= 2;
}
- inline void BindRenderbuffer( GLenum target, GLuint renderbuffer ) override
+ inline void BindRenderbuffer(GLenum target, GLuint renderbuffer) override
{
}
* @param[in] activeTextureUnit The specific active texture unit.
* @return A vector containing the IDs that were bound.
*/
- inline const std::vector<GLuint>& GetBoundTextures( GLuint activeTextureUnit ) const
+ inline const std::vector<GLuint>& GetBoundTextures(GLuint activeTextureUnit) const
{
- return mActiveTextures[ activeTextureUnit - GL_TEXTURE0 ].mBoundTextures;
+ return mActiveTextures[activeTextureUnit - GL_TEXTURE0].mBoundTextures;
}
/**
{
mBoundTextures.clear();
- for( unsigned int i=0; i<MIN_TEXTURE_UNIT_LIMIT; ++i )
+ for(unsigned int i = 0; i < MIN_TEXTURE_UNIT_LIMIT; ++i)
{
- mActiveTextures[ i ].mBoundTextures.clear();
+ mActiveTextures[i].mBoundTextures.clear();
}
}
- inline void BindTexture( GLenum target, GLuint texture ) override
+ inline void BindTexture(GLenum target, GLuint texture) override
{
// Record the bound textures for future checks
- if( texture )
+ if(texture)
{
- mBoundTextures.push_back( texture );
+ mBoundTextures.push_back(texture);
- if( mActiveTextureUnit < MIN_TEXTURE_UNIT_LIMIT )
+ if(mActiveTextureUnit < MIN_TEXTURE_UNIT_LIMIT)
{
- mActiveTextures[ mActiveTextureUnit ].mBoundTextures.push_back( texture );
+ mActiveTextures[mActiveTextureUnit].mBoundTextures.push_back(texture);
}
}
out << target << ", " << texture;
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
+ namedParams["target"] = ToString(target);
namedParams["texture"] = ToString(texture);
mTextureTrace.PushCall("BindTexture", out.str(), namedParams);
return mLastBlendColor;
}
- inline void BlendEquation( GLenum mode ) override
+ inline void BlendEquation(GLenum mode) override
{
mLastBlendEquationRgb = mode;
mLastBlendEquationAlpha = mode;
}
- inline void BlendEquationSeparate( GLenum modeRgb, GLenum modeAlpha ) override
+ inline void BlendEquationSeparate(GLenum modeRgb, GLenum modeAlpha) override
{
mLastBlendEquationRgb = modeRgb;
mLastBlendEquationAlpha = modeAlpha;
inline void BlendFunc(GLenum sfactor, GLenum dfactor) override
{
- mLastBlendFuncSrcRgb = sfactor;
- mLastBlendFuncDstRgb = dfactor;
+ mLastBlendFuncSrcRgb = sfactor;
+ mLastBlendFuncDstRgb = dfactor;
mLastBlendFuncSrcAlpha = sfactor;
mLastBlendFuncDstAlpha = dfactor;
}
inline void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) override
{
- mLastBlendFuncSrcRgb = srcRGB;
- mLastBlendFuncDstRgb = dstRGB;
+ mLastBlendFuncSrcRgb = srcRGB;
+ mLastBlendFuncDstRgb = dstRGB;
mLastBlendFuncSrcAlpha = srcAlpha;
mLastBlendFuncDstAlpha = dstAlpha;
}
inline void BufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) override
{
- mBufferDataCalls.push_back(size);
+ mBufferDataCalls.push_back(size);
}
inline void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) override
{
- mBufferSubDataCalls.push_back(size);
+ mBufferSubDataCalls.push_back(size);
}
inline GLenum CheckFramebufferStatus(GLenum target) override
{
//If it has the three last bits set to 1 - 111, then the three minimum functions to create a
//Framebuffer texture have been called
- if( mFramebufferStatus == 7 )
+ if(mFramebufferStatus == 7)
{
return GL_FRAMEBUFFER_COMPLETE;
}
out << s;
TraceCallStack::NamedParams namedParams;
- namedParams["s"] = ToString( s );
+ namedParams["s"] = ToString(s);
- mStencilFunctionTrace.PushCall( "ClearStencil", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("ClearStencil", out.str(), namedParams);
}
inline void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) override
{
- mColorMaskParams.red = red;
+ mColorMaskParams.red = red;
mColorMaskParams.green = green;
- mColorMaskParams.blue = blue;
+ mColorMaskParams.blue = blue;
mColorMaskParams.alpha = alpha;
}
inline void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) override
{
std::stringstream out;
- out << target<<", "<<level<<", "<<width << ", " << height;
+ out << target << ", " << level << ", " << width << ", " << height;
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["level"] = ToString(level);
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
namedParams["internalformat"] = ToString(internalformat);
- namedParams["width"] = ToString(width);
- namedParams["height"] = ToString(height);
- namedParams["border"] = ToString(border);
- namedParams["size"] = ToString(imageSize);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
+ namedParams["border"] = ToString(border);
+ namedParams["size"] = ToString(imageSize);
mTextureTrace.PushCall("CompressedTexImage2D", out.str(), namedParams);
}
inline void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) override
{
std::stringstream out;
- out << target << ", "<<level <<", " << xoffset << ", " << yoffset << ", " << width << ", " << height;
+ out << target << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height;
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["level"] = ToString(level);
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
namedParams["xoffset"] = ToString(xoffset);
namedParams["yoffset"] = ToString(yoffset);
- namedParams["width"] = ToString(width);
- namedParams["height"] = ToString(height);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
mTextureTrace.PushCall("CompressedTexSubImage2D", out.str(), namedParams);
}
TraceCallStack::NamedParams namedParams;
- for(GLsizei i=0; i<n; i++)
+ for(GLsizei i = 0; i < n; i++)
{
out << textures[i] << ", ";
std::stringstream paramName;
- paramName<<"texture["<<i<<"]";
+ paramName << "texture[" << i << "]";
namedParams[paramName.str()] = ToString(textures[i]);
mDeletedTextureIds.push_back(textures[i]);
mNumGeneratedTextures--;
return mDeletedTextureIds.size() == 0;
}
- inline bool CheckTextureDeleted( GLuint textureId )
+ inline bool CheckTextureDeleted(GLuint textureId)
{
bool found = false;
- for(std::vector<GLuint>::iterator iter=mDeletedTextureIds.begin(); iter != mDeletedTextureIds.end(); ++iter)
+ for(std::vector<GLuint>::iterator iter = mDeletedTextureIds.begin(); iter != mDeletedTextureIds.end(); ++iter)
{
if(*iter == textureId)
{
out << program << ", " << shader;
TraceCallStack::NamedParams namedParams;
namedParams["program"] = ToString(program);
- namedParams["shader"] = ToString(shader);
+ namedParams["shader"] = ToString(shader);
mShaderTrace.PushCall("DetachShader", out.str(), namedParams);
}
inline void DisableVertexAttribArray(GLuint index) override
{
- SetVertexAttribArray( index, false );
+ SetVertexAttribArray(index, false);
}
inline void DrawArrays(GLenum mode, GLint first, GLsizei count) override
std::stringstream out;
out << mode << ", " << first << ", " << count;
TraceCallStack::NamedParams namedParams;
- namedParams["mode"] = ToString(mode);
+ namedParams["mode"] = ToString(mode);
namedParams["first"] = ToString(first);
namedParams["count"] = ToString(count);
mDrawTrace.PushCall("DrawArrays", out.str(), namedParams);
out << mode << ", " << count << ", " << type << ", indices";
TraceCallStack::NamedParams namedParams;
- namedParams["mode"] = ToString(mode);
+ namedParams["mode"] = ToString(mode);
namedParams["count"] = ToString(count);
- namedParams["type"] = ToString(type);
+ namedParams["type"] = ToString(type);
// Skip void pointers - are they of any use?
mDrawTrace.PushCall("DrawElements", out.str(), namedParams);
}
inline void EnableVertexAttribArray(GLuint index) override
{
- SetVertexAttribArray( index, true);
+ SetVertexAttribArray(index, true);
}
inline void Finish(void) override
inline void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) override
{
- if (attachment == GL_DEPTH_ATTACHMENT)
+ if(attachment == GL_DEPTH_ATTACHMENT)
{
mFramebufferDepthAttached = true;
}
- else if (attachment == GL_STENCIL_ATTACHMENT)
+ else if(attachment == GL_STENCIL_ATTACHMENT)
{
mFramebufferStencilAttached = true;
}
mFramebufferStatus |= 4;
//We check 4 attachment colors
- if ((attachment >= GL_COLOR_ATTACHMENT0) && (attachment < GL_COLOR_ATTACHMENT0 + Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS))
+ if((attachment >= GL_COLOR_ATTACHMENT0) && (attachment < GL_COLOR_ATTACHMENT0 + Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS))
{
uint8_t mask = 1 << (attachment - GL_COLOR_ATTACHMENT0);
- if ((mFrameBufferColorStatus & mask) == 0)
+ if((mFrameBufferColorStatus & mask) == 0)
{
mFrameBufferColorStatus |= mask;
++mFramebufferColorAttachmentCount;
inline void GenerateMipmap(GLenum target) override
{
std::stringstream out;
- out<<target;
+ out << target;
TraceCallStack::NamedParams namedParams;
namedParams["target"] = ToString(target);
inline void GenFramebuffers(GLsizei n, GLuint* framebuffers) override
{
- for( int i = 0; i < n; i++ )
+ for(int i = 0; i < n; i++)
{
framebuffers[i] = i + 1;
}
inline void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) override
{
- for( int i = 0; i < n; i++ )
+ for(int i = 0; i < n; i++)
{
renderbuffers[i] = i + 1;
}
* This method can be used by test cases, to manipulate the texture IDs generated by GenTextures.
* @param[in] ids A vector containing the next IDs to be generated
*/
- inline void SetNextTextureIds( const std::vector<GLuint>& ids )
+ inline void SetNextTextureIds(const std::vector<GLuint>& ids)
{
mNextTextureIds = ids;
}
inline void GenTextures(GLsizei count, GLuint* textures) override
{
- for( int i=0; i<count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( !mNextTextureIds.empty() )
+ if(!mNextTextureIds.empty())
{
- *(textures+i) = mNextTextureIds[0];
- mNextTextureIds.erase( mNextTextureIds.begin() );
+ *(textures + i) = mNextTextureIds[0];
+ mNextTextureIds.erase(mNextTextureIds.begin());
}
else
{
- *(textures+i) = ++mLastAutoTextureIdUsed;
+ *(textures + i) = ++mLastAutoTextureIdUsed;
}
mNumGeneratedTextures++;
}
namedParams["count"] = ToString(count);
std::stringstream out;
- for(int i=0; i<count; i++)
+ for(int i = 0; i < count; i++)
{
out << textures[i];
- if(i<count-1)
+ if(i < count - 1)
{
out << ", ";
}
std::ostringstream oss;
- oss<<"indices["<<i<<"]";
+ oss << "indices[" << i << "]";
namedParams[oss.str()] = ToString(textures[i]);
}
{
case 0:
*length = snprintf(name, bufsize, "sTexture");
- *type = GL_SAMPLER_2D;
- *size = 1;
+ *type = GL_SAMPLER_2D;
+ *size = 1;
break;
case 1:
*length = snprintf(name, bufsize, "sEffect");
- *type = GL_SAMPLER_2D;
- *size = 1;
+ *type = GL_SAMPLER_2D;
+ *size = 1;
break;
case 2:
*length = snprintf(name, bufsize, "sGloss");
- *type = GL_SAMPLER_2D;
- *size = 1;
+ *type = GL_SAMPLER_2D;
+ *size = 1;
break;
default:
break;
{
}
- inline int GetAttribLocation(GLuint program, const char* name) override
+ inline int GetAttribLocation(GLuint program, const char* name) override
{
std::string attribName(name);
- for( unsigned int i = 0; i < ATTRIB_TYPE_LAST; ++i )
+ for(unsigned int i = 0; i < ATTRIB_TYPE_LAST; ++i)
{
- if( mStdAttribs[i] == attribName )
+ if(mStdAttribs[i] == attribName)
{
return i;
}
inline void GetIntegerv(GLenum pname, GLint* params) override
{
- switch( pname )
+ switch(pname)
{
case GL_MAX_TEXTURE_SIZE:
*params = 2048;
inline void GetProgramiv(GLuint program, GLenum pname, GLint* params) override
{
- switch( pname )
+ switch(pname)
{
case GL_LINK_STATUS:
*params = mLinkStatus;
inline void GetShaderiv(GLuint shader, GLenum pname, GLint* params) override
{
- switch( pname ) {
+ switch(pname)
+ {
case GL_COMPILE_STATUS:
*params = mCompileStatus;
break;
inline GLint GetUniformLocation(GLuint program, const char* name) override
{
ProgramUniformMap::iterator it = mUniforms.find(program);
- if( it == mUniforms.end() )
+ if(it == mUniforms.end())
{
// Not a valid program ID
mGetErrorResult = GL_INVALID_OPERATION;
return -1;
}
- UniformIDMap& uniformIDs = it->second;
- UniformIDMap::iterator it2 = uniformIDs.find( name );
- if( it2 == uniformIDs.end() )
+ UniformIDMap& uniformIDs = it->second;
+ UniformIDMap::iterator it2 = uniformIDs.find(name);
+ if(it2 == uniformIDs.end())
{
// Uniform not found, so add it...
uniformIDs[name] = ++mLastUniformIdUsed;
namedParams["program"] = ToString(program);
mShaderTrace.PushCall("LinkProgram", out.str(), namedParams);
- mNumberOfActiveUniforms=3;
+ mNumberOfActiveUniforms = 3;
GetUniformLocation(program, "sTexture");
GetUniformLocation(program, "sEffect");
GetUniformLocation(program, "sGloss");
inline void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) override
{
- mScissorParams.x = x;
- mScissorParams.y = y;
- mScissorParams.width = width;
+ mScissorParams.x = x;
+ mScissorParams.y = y;
+ mScissorParams.width = width;
mScissorParams.height = height;
std::stringstream out;
out << x << ", " << y << ", " << width << ", " << height;
TraceCallStack::NamedParams namedParams;
- namedParams["x"] = ToString( x );
- namedParams["y"] = ToString( y );
- namedParams["width"] = ToString( width );
- namedParams["height"] = ToString( height );
- mScissorTrace.PushCall( "Scissor", out.str(), namedParams );
+ namedParams["x"] = ToString(x);
+ namedParams["y"] = ToString(y);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
+ mScissorTrace.PushCall("Scissor", out.str(), namedParams);
}
inline void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) override
stringBuilder += string[i];
}
mShaderSources[shader] = stringBuilder;
- mLastShaderCompiled = shader;
+ mLastShaderCompiled = shader;
}
inline void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) override
{
- const std::string shaderSource = mShaderSources[shader];
- const int shaderSourceLength = static_cast<int>(shaderSource.length());
- if( shaderSourceLength < bufsize )
+ const std::string shaderSource = mShaderSources[shader];
+ const int shaderSourceLength = static_cast<int>(shaderSource.length());
+ if(shaderSourceLength < bufsize)
{
- strncpy( source, shaderSource.c_str(), shaderSourceLength );
+ strncpy(source, shaderSource.c_str(), shaderSourceLength);
*length = shaderSourceLength;
}
else
{
- *length = bufsize -1;
+ *length = bufsize - 1;
strncpy(source, shaderSource.c_str(), *length);
source[*length] = 0x0;
}
out << func << ", " << ref << ", " << mask;
TraceCallStack::NamedParams namedParams;
- namedParams["func"] = ToString( func );
- namedParams["ref"] = ToString( ref );
- namedParams["mask"] = ToString( mask );
+ namedParams["func"] = ToString(func);
+ namedParams["ref"] = ToString(ref);
+ namedParams["mask"] = ToString(mask);
- mStencilFunctionTrace.PushCall( "StencilFunc", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilFunc", out.str(), namedParams);
}
inline void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) override
out << face << ", " << func << ", " << ref << ", " << mask;
TraceCallStack::NamedParams namedParams;
- namedParams["face"] = ToString( face );
- namedParams["func"] = ToString( func );
- namedParams["ref"] = ToString( ref );
- namedParams["mask"] = ToString( mask );
+ namedParams["face"] = ToString(face);
+ namedParams["func"] = ToString(func);
+ namedParams["ref"] = ToString(ref);
+ namedParams["mask"] = ToString(mask);
- mStencilFunctionTrace.PushCall( "StencilFuncSeparate", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilFuncSeparate", out.str(), namedParams);
}
inline void StencilMask(GLuint mask) override
out << mask;
TraceCallStack::NamedParams namedParams;
- namedParams["mask"] = ToString( mask );
+ namedParams["mask"] = ToString(mask);
- mStencilFunctionTrace.PushCall( "StencilMask", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilMask", out.str(), namedParams);
}
inline void StencilMaskSeparate(GLenum face, GLuint mask) override
out << face << ", " << mask;
TraceCallStack::NamedParams namedParams;
- namedParams["face"] = ToString( face );
- namedParams["mask"] = ToString( mask );
+ namedParams["face"] = ToString(face);
+ namedParams["mask"] = ToString(mask);
- mStencilFunctionTrace.PushCall( "StencilMaskSeparate", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilMaskSeparate", out.str(), namedParams);
}
inline void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) override
out << fail << ", " << zfail << ", " << zpass;
TraceCallStack::NamedParams namedParams;
- namedParams["fail"] = ToString( fail );
- namedParams["zfail"] = ToString( zfail );
- namedParams["zpass"] = ToString( zpass );
+ namedParams["fail"] = ToString(fail);
+ namedParams["zfail"] = ToString(zfail);
+ namedParams["zpass"] = ToString(zpass);
- mStencilFunctionTrace.PushCall( "StencilOp", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilOp", out.str(), namedParams);
}
inline void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) override
out << face << ", " << fail << ", " << zfail << "," << zpass;
TraceCallStack::NamedParams namedParams;
- namedParams["face"] = ToString( face );
- namedParams["fail"] = ToString( fail );
- namedParams["zfail"] = ToString( zfail );
- namedParams["zpass"] = ToString( zpass );
+ namedParams["face"] = ToString(face);
+ namedParams["fail"] = ToString(fail);
+ namedParams["zfail"] = ToString(zfail);
+ namedParams["zpass"] = ToString(zpass);
- mStencilFunctionTrace.PushCall( "StencilOpSeparate", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilOpSeparate", out.str(), namedParams);
}
inline void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) override
{
std::stringstream out;
- out << target<<", "<<level<<", "<<width << ", " << height;
+ out << target << ", " << level << ", " << width << ", " << height;
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["level"] = ToString(level);
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
namedParams["internalformat"] = ToString(internalformat);
- namedParams["width"] = ToString(width);
- namedParams["height"] = ToString(height);
- namedParams["border"] = ToString(border);
- namedParams["format"] = ToString(format);
- namedParams["type"] = ToString(type);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
+ namedParams["border"] = ToString(border);
+ namedParams["format"] = ToString(format);
+ namedParams["type"] = ToString(type);
mTextureTrace.PushCall("TexImage2D", out.str(), namedParams);
}
TraceCallStack::NamedParams namedParams;
namedParams["target"] = ToString(target);
- namedParams["pname"] = ToString(pname);
- namedParams["param"] = ToString(param);
+ namedParams["pname"] = ToString(pname);
+ namedParams["param"] = ToString(param);
mTexParamaterTrace.PushCall("TexParameterf", out.str(), namedParams);
}
out << target << ", " << pname << ", " << params[0];
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["pname"] = ToString(pname);
+ namedParams["target"] = ToString(target);
+ namedParams["pname"] = ToString(pname);
namedParams["params[0]"] = ToString(params[0]);
mTexParamaterTrace.PushCall("TexParameterfv", out.str(), namedParams);
out << target << ", " << pname << ", " << param;
TraceCallStack::NamedParams namedParams;
namedParams["target"] = ToString(target);
- namedParams["pname"] = ToString(pname);
- namedParams["param"] = ToString(param);
+ namedParams["pname"] = ToString(pname);
+ namedParams["param"] = ToString(param);
mTexParamaterTrace.PushCall("TexParameteri", out.str(), namedParams);
}
std::stringstream out;
out << target << ", " << pname << ", " << params[0];
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["pname"] = ToString(pname);
+ namedParams["target"] = ToString(target);
+ namedParams["pname"] = ToString(pname);
namedParams["params[0]"] = ToString(params[0]);
mTexParamaterTrace.PushCall("TexParameteriv", out.str(), namedParams);
}
inline void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) override
{
std::stringstream out;
- out << target << ", "<<level <<", " << xoffset << ", " << yoffset << ", " << width << ", " << height;
+ out << target << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height;
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["level"] = ToString(level);
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
namedParams["xoffset"] = ToString(xoffset);
namedParams["yoffset"] = ToString(yoffset);
- namedParams["width"] = ToString(width);
- namedParams["height"] = ToString(height);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
mTextureTrace.PushCall("TexSubImage2D", out.str(), namedParams);
}
- inline void Uniform1f(GLint location, GLfloat value ) override
+ inline void Uniform1f(GLint location, GLfloat value) override
{
- std::string params = ToString( value );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(value);
+ AddUniformCallToTraceStack(location, params);
- if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, value ) )
+ if(!mProgramUniforms1f.SetUniformValue(mCurrentProgram, location, value))
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) override
{
std::string params;
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- params = params + ToString( v[i] ) + ",";
+ params = params + ToString(v[i]) + ",";
}
- AddUniformCallToTraceStack( location, params );
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, v[i] ) )
+ if(!mProgramUniforms1f.SetUniformValue(mCurrentProgram, location, v[i]))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Uniform1i(GLint location, GLint x) override
{
- std::string params = ToString( x );
+ std::string params = ToString(x);
- AddUniformCallToTraceStack( location, params );
+ AddUniformCallToTraceStack(location, params);
- if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram, location, x ) )
+ if(!mProgramUniforms1i.SetUniformValue(mCurrentProgram, location, x))
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform1iv(GLint location, GLsizei count, const GLint* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram,
- location,
- v[i] ) )
+ if(!mProgramUniforms1i.SetUniformValue(mCurrentProgram,
+ location,
+ v[i]))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Uniform2f(GLint location, GLfloat x, GLfloat y) override
{
- std::string params = ToString( x ) + "," + ToString( y );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y);
+ AddUniformCallToTraceStack(location, params);
- if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
- location,
- Vector2( x, y ) ) )
+ if(!mProgramUniforms2f.SetUniformValue(mCurrentProgram,
+ location,
+ Vector2(x, y)))
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
- location,
- Vector2( v[2*i], v[2*i+1] ) ) )
+ if(!mProgramUniforms2f.SetUniformValue(mCurrentProgram,
+ location,
+ Vector2(v[2 * i], v[2 * i + 1])))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Uniform2i(GLint location, GLint x, GLint y) override
{
- std::string params = ToString( x ) + "," + ToString( y );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y);
+ AddUniformCallToTraceStack(location, params);
}
inline void Uniform2iv(GLint location, GLsizei count, const GLint* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
}
inline void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) override
{
- std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y) + "," + ToString(z);
+ AddUniformCallToTraceStack(location, params);
- if( ! mProgramUniforms3f.SetUniformValue( mCurrentProgram,
- location,
- Vector3( x, y, z ) ) )
+ if(!mProgramUniforms3f.SetUniformValue(mCurrentProgram,
+ location,
+ Vector3(x, y, z)))
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniforms3f.SetUniformValue(
- mCurrentProgram,
- location,
- Vector3( v[3*i], v[3*i+1], v[3*i+2] ) ) )
+ if(!mProgramUniforms3f.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Vector3(v[3 * i], v[3 * i + 1], v[3 * i + 2])))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Uniform3i(GLint location, GLint x, GLint y, GLint z) override
{
- std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y) + "," + ToString(z);
+ AddUniformCallToTraceStack(location, params);
}
inline void Uniform3iv(GLint location, GLsizei count, const GLint* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
}
inline void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
{
- std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z ) + "," + ToString( w );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y) + "," + ToString(z) + "," + ToString(w);
+ AddUniformCallToTraceStack(location, params);
- if( ! mProgramUniforms4f.SetUniformValue( mCurrentProgram,
- location,
- Vector4( x, y, z, w ) ) )
+ if(!mProgramUniforms4f.SetUniformValue(mCurrentProgram,
+ location,
+ Vector4(x, y, z, w)))
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniforms4f.SetUniformValue(
- mCurrentProgram,
- location,
- Vector4( v[4*i], v[4*i+1], v[4*i+2], v[4*i+3] ) ) )
+ if(!mProgramUniforms4f.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Vector4(v[4 * i], v[4 * i + 1], v[4 * i + 2], v[4 * i + 3])))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) override
{
- std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z ) + "," + ToString( w );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y) + "," + ToString(z) + "," + ToString(w);
+ AddUniformCallToTraceStack(location, params);
}
inline void Uniform4iv(GLint location, GLsizei count, const GLint* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
}
inline void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
{
- std::string params = ToString( value );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(value);
+ AddUniformCallToTraceStack(location, params);
}
inline void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
{
- std::string params = ToString( value );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(value);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniformsMat3.SetUniformValue(
- mCurrentProgram,
- location,
- Matrix3( value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], value[8] ) ) )
+ if(!mProgramUniformsMat3.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Matrix3(value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], value[8])))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
{
- std::string params = ToString( value );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(value);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniformsMat4.SetUniformValue(
- mCurrentProgram,
- location,
- Matrix( value ) ) )
+ if(!mProgramUniformsMat4.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Matrix(value)))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override
{
std::string commaString(", ");
- std::string params( std::to_string(x) + commaString + std::to_string(y) + commaString + std::to_string(width) + commaString + std::to_string(height) );
+ std::string params(std::to_string(x) + commaString + std::to_string(y) + commaString + std::to_string(width) + commaString + std::to_string(height));
mViewportTrace.PushCall("Viewport", params);
}
{
}
- inline GLint GetFragDataLocation(GLuint program, const GLchar *name) override
+ inline GLint GetFragDataLocation(GLuint program, const GLchar* name) override
{
return -1;
}
}
private:
-
- inline void AddUniformCallToTraceStack( GLint location, std::string& value )
- {
- std::string name = "<not found>";
- bool matched = false;
+ inline void AddUniformCallToTraceStack(GLint location, std::string& value)
+ {
+ std::string name = "<not found>";
+ bool matched = false;
UniformIDMap& map = mUniforms[mCurrentProgram];
- for (UniformIDMap::iterator it=map.begin(); it!=map.end(); ++it)
+ for(UniformIDMap::iterator it = map.begin(); it != map.end(); ++it)
{
- if( it->second == location )
+ if(it->second == location)
{
- name = it->first;
+ name = it->first;
matched = true;
break;
}
}
- if ( matched )
+ if(matched)
{
- mSetUniformTrace.PushCall( name, value );
+ mSetUniformTrace.PushCall(name, value);
}
}
-
public: // TEST FUNCTIONS
- inline void SetCompileStatus( GLuint value ) { mCompileStatus = value; }
- inline void SetLinkStatus( GLuint value ) { mLinkStatus = value; }
- inline void SetGetAttribLocationResult( int result) { mGetAttribLocationResult = result; }
- inline void SetGetErrorResult( GLenum result) { mGetErrorResult = result; }
- inline void SetGetStringResult( GLubyte* result) { mGetStringResult = result; }
- inline void SetIsBufferResult( GLboolean result) { mIsBufferResult = result; }
- inline void SetIsEnabledResult( GLboolean result) { mIsEnabledResult = result; }
- inline void SetIsFramebufferResult( GLboolean result) { mIsFramebufferResult = result; }
- inline void SetIsProgramResult( GLboolean result) { mIsProgramResult = result; }
- inline void SetIsRenderbufferResult( GLboolean result) { mIsRenderbufferResult = result; }
- inline void SetIsShaderResult( GLboolean result) { mIsShaderResult = result; }
- inline void SetIsTextureResult( GLboolean result) { mIsTextureResult = result; }
- inline void SetCheckFramebufferStatusResult( GLenum result) { mCheckFramebufferStatusResult = result; }
- inline void SetNumBinaryFormats( GLint numFormats ) { mNumBinaryFormats = numFormats; }
- inline void SetBinaryFormats( GLint binaryFormats ) { mBinaryFormats = binaryFormats; }
- inline void SetProgramBinaryLength( GLint length ) { mProgramBinaryLength = length; }
+ inline void SetCompileStatus(GLuint value)
+ {
+ mCompileStatus = value;
+ }
+ inline void SetLinkStatus(GLuint value)
+ {
+ mLinkStatus = value;
+ }
+ inline void SetGetAttribLocationResult(int result)
+ {
+ mGetAttribLocationResult = result;
+ }
+ inline void SetGetErrorResult(GLenum result)
+ {
+ mGetErrorResult = result;
+ }
+ inline void SetGetStringResult(GLubyte* result)
+ {
+ mGetStringResult = result;
+ }
+ inline void SetIsBufferResult(GLboolean result)
+ {
+ mIsBufferResult = result;
+ }
+ inline void SetIsEnabledResult(GLboolean result)
+ {
+ mIsEnabledResult = result;
+ }
+ inline void SetIsFramebufferResult(GLboolean result)
+ {
+ mIsFramebufferResult = result;
+ }
+ inline void SetIsProgramResult(GLboolean result)
+ {
+ mIsProgramResult = result;
+ }
+ inline void SetIsRenderbufferResult(GLboolean result)
+ {
+ mIsRenderbufferResult = result;
+ }
+ inline void SetIsShaderResult(GLboolean result)
+ {
+ mIsShaderResult = result;
+ }
+ inline void SetIsTextureResult(GLboolean result)
+ {
+ mIsTextureResult = result;
+ }
+ inline void SetCheckFramebufferStatusResult(GLenum result)
+ {
+ mCheckFramebufferStatusResult = result;
+ }
+ inline void SetNumBinaryFormats(GLint numFormats)
+ {
+ mNumBinaryFormats = numFormats;
+ }
+ inline void SetBinaryFormats(GLint binaryFormats)
+ {
+ mBinaryFormats = binaryFormats;
+ }
+ inline void SetProgramBinaryLength(GLint length)
+ {
+ mProgramBinaryLength = length;
+ }
inline bool GetVertexAttribArrayState(GLuint index)
{
- if( index >= MAX_ATTRIBUTE_CACHE_SIZE )
+ if(index >= MAX_ATTRIBUTE_CACHE_SIZE)
{
// out of range
return false;
}
- return mVertexAttribArrayState[ index ];
+ return mVertexAttribArrayState[index];
+ }
+ inline void ClearVertexAttribArrayChanged()
+ {
+ mVertexAttribArrayChanged = false;
+ }
+ inline bool GetVertexAttribArrayChanged()
+ {
+ return mVertexAttribArrayChanged;
}
- inline void ClearVertexAttribArrayChanged() { mVertexAttribArrayChanged = false; }
- inline bool GetVertexAttribArrayChanged() { return mVertexAttribArrayChanged; }
//Methods for CullFace verification
- inline void EnableCullFaceCallTrace(bool enable) { mCullFaceTrace.Enable(enable); }
- inline void ResetCullFaceCallStack() { mCullFaceTrace.Reset(); }
- inline TraceCallStack& GetCullFaceTrace() { return mCullFaceTrace; }
+ inline void EnableCullFaceCallTrace(bool enable)
+ {
+ mCullFaceTrace.Enable(enable);
+ }
+ inline void ResetCullFaceCallStack()
+ {
+ mCullFaceTrace.Reset();
+ }
+ inline TraceCallStack& GetCullFaceTrace()
+ {
+ return mCullFaceTrace;
+ }
//Methods for Enable/Disable call verification
- inline void EnableEnableDisableCallTrace(bool enable) { mEnableDisableTrace.Enable(enable); }
- inline void ResetEnableDisableCallStack() { mEnableDisableTrace.Reset(); }
- inline TraceCallStack& GetEnableDisableTrace() { return mEnableDisableTrace; }
+ inline void EnableEnableDisableCallTrace(bool enable)
+ {
+ mEnableDisableTrace.Enable(enable);
+ }
+ inline void ResetEnableDisableCallStack()
+ {
+ mEnableDisableTrace.Reset();
+ }
+ inline TraceCallStack& GetEnableDisableTrace()
+ {
+ return mEnableDisableTrace;
+ }
//Methods for Shader verification
- inline void EnableShaderCallTrace(bool enable) { mShaderTrace.Enable(enable); }
- inline void ResetShaderCallStack() { mShaderTrace.Reset(); }
- inline TraceCallStack& GetShaderTrace() { return mShaderTrace; }
+ inline void EnableShaderCallTrace(bool enable)
+ {
+ mShaderTrace.Enable(enable);
+ }
+ inline void ResetShaderCallStack()
+ {
+ mShaderTrace.Reset();
+ }
+ inline TraceCallStack& GetShaderTrace()
+ {
+ return mShaderTrace;
+ }
//Methods for Texture verification
- inline void EnableTextureCallTrace(bool enable) { mTextureTrace.Enable(enable); }
- inline void ResetTextureCallStack() { mTextureTrace.Reset(); }
- inline TraceCallStack& GetTextureTrace() { return mTextureTrace; }
+ inline void EnableTextureCallTrace(bool enable)
+ {
+ mTextureTrace.Enable(enable);
+ }
+ inline void ResetTextureCallStack()
+ {
+ mTextureTrace.Reset();
+ }
+ inline TraceCallStack& GetTextureTrace()
+ {
+ return mTextureTrace;
+ }
//Methods for Texture verification
- inline void EnableTexParameterCallTrace(bool enable) { mTexParamaterTrace.Enable(enable); }
- inline void ResetTexParameterCallStack() { mTexParamaterTrace.Reset(); }
- inline TraceCallStack& GetTexParameterTrace() { return mTexParamaterTrace; }
+ inline void EnableTexParameterCallTrace(bool enable)
+ {
+ mTexParamaterTrace.Enable(enable);
+ }
+ inline void ResetTexParameterCallStack()
+ {
+ mTexParamaterTrace.Reset();
+ }
+ inline TraceCallStack& GetTexParameterTrace()
+ {
+ return mTexParamaterTrace;
+ }
//Methods for Draw verification
- inline void EnableDrawCallTrace(bool enable) { mDrawTrace.Enable(enable); }
- inline void ResetDrawCallStack() { mDrawTrace.Reset(); }
- inline TraceCallStack& GetDrawTrace() { return mDrawTrace; }
+ inline void EnableDrawCallTrace(bool enable)
+ {
+ mDrawTrace.Enable(enable);
+ }
+ inline void ResetDrawCallStack()
+ {
+ mDrawTrace.Reset();
+ }
+ inline TraceCallStack& GetDrawTrace()
+ {
+ return mDrawTrace;
+ }
//Methods for Depth function verification
- inline void EnableDepthFunctionCallTrace(bool enable) { mDepthFunctionTrace.Enable(enable); }
- inline void ResetDepthFunctionCallStack() { mDepthFunctionTrace.Reset(); }
- inline TraceCallStack& GetDepthFunctionTrace() { return mDepthFunctionTrace; }
+ inline void EnableDepthFunctionCallTrace(bool enable)
+ {
+ mDepthFunctionTrace.Enable(enable);
+ }
+ inline void ResetDepthFunctionCallStack()
+ {
+ mDepthFunctionTrace.Reset();
+ }
+ inline TraceCallStack& GetDepthFunctionTrace()
+ {
+ return mDepthFunctionTrace;
+ }
//Methods for Stencil function verification
- inline void EnableStencilFunctionCallTrace(bool enable) { mStencilFunctionTrace.Enable(enable); }
- inline void ResetStencilFunctionCallStack() { mStencilFunctionTrace.Reset(); }
- inline TraceCallStack& GetStencilFunctionTrace() { return mStencilFunctionTrace; }
+ inline void EnableStencilFunctionCallTrace(bool enable)
+ {
+ mStencilFunctionTrace.Enable(enable);
+ }
+ inline void ResetStencilFunctionCallStack()
+ {
+ mStencilFunctionTrace.Reset();
+ }
+ inline TraceCallStack& GetStencilFunctionTrace()
+ {
+ return mStencilFunctionTrace;
+ }
//Methods for Scissor verification
- inline void EnableScissorCallTrace(bool enable) { mScissorTrace.Enable(enable); }
- inline void ResetScissorCallStack() { mScissorTrace.Reset(); }
- inline TraceCallStack& GetScissorTrace() { return mScissorTrace; }
+ inline void EnableScissorCallTrace(bool enable)
+ {
+ mScissorTrace.Enable(enable);
+ }
+ inline void ResetScissorCallStack()
+ {
+ mScissorTrace.Reset();
+ }
+ inline TraceCallStack& GetScissorTrace()
+ {
+ return mScissorTrace;
+ }
//Methods for Uniform function verification
- inline void EnableSetUniformCallTrace(bool enable) { mSetUniformTrace.Enable(enable); }
- inline void ResetSetUniformCallStack() { mSetUniformTrace.Reset(); }
- inline TraceCallStack& GetSetUniformTrace() { return mSetUniformTrace; }
+ inline void EnableSetUniformCallTrace(bool enable)
+ {
+ mSetUniformTrace.Enable(enable);
+ }
+ inline void ResetSetUniformCallStack()
+ {
+ mSetUniformTrace.Reset();
+ }
+ inline TraceCallStack& GetSetUniformTrace()
+ {
+ return mSetUniformTrace;
+ }
//Methods for Viewport verification
- inline void EnableViewportCallTrace(bool enable) { mViewportTrace.Enable(enable); }
- inline void ResetViewportCallStack() { mViewportTrace.Reset(); }
- inline TraceCallStack& GetViewportTrace() { return mViewportTrace; }
+ inline void EnableViewportCallTrace(bool enable)
+ {
+ mViewportTrace.Enable(enable);
+ }
+ inline void ResetViewportCallStack()
+ {
+ mViewportTrace.Reset();
+ }
+ inline TraceCallStack& GetViewportTrace()
+ {
+ return mViewportTrace;
+ }
- template <typename T>
- inline bool GetUniformValue( const char* name, T& value ) const
+ template<typename T>
+ inline bool GetUniformValue(const char* name, T& value) const
{
- for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
- program_it != mUniforms.end();
- ++program_it )
+ for(ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+ program_it != mUniforms.end();
+ ++program_it)
{
- const UniformIDMap &uniformIDs = program_it->second;
+ const UniformIDMap& uniformIDs = program_it->second;
- UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
- if( uniform_it != uniformIDs.end() )
+ UniformIDMap::const_iterator uniform_it = uniformIDs.find(name);
+ if(uniform_it != uniformIDs.end())
{
// found one matching uniform name, lets check the value...
GLuint programId = program_it->first;
- GLint uniformId = uniform_it->second;
+ GLint uniformId = uniform_it->second;
- const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
- return mProgramUniforms.GetUniformValue( programId, uniformId, value );
+ const ProgramUniformValue<T>& mProgramUniforms = GetProgramUniformsForType(value);
+ return mProgramUniforms.GetUniformValue(programId, uniformId, value);
}
}
return false;
}
-
- template <typename T>
- inline bool CheckUniformValue( const char* name, const T& value ) const
+ template<typename T>
+ inline bool CheckUniformValue(const char* name, const T& value) const
{
- for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
- program_it != mUniforms.end();
- ++program_it )
+ for(ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+ program_it != mUniforms.end();
+ ++program_it)
{
- const UniformIDMap &uniformIDs = program_it->second;
+ const UniformIDMap& uniformIDs = program_it->second;
- UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
- if( uniform_it != uniformIDs.end() )
+ UniformIDMap::const_iterator uniform_it = uniformIDs.find(name);
+ if(uniform_it != uniformIDs.end())
{
// found one matching uniform name, lets check the value...
GLuint programId = program_it->first;
- GLint uniformId = uniform_it->second;
+ GLint uniformId = uniform_it->second;
- const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
- if( mProgramUniforms.CheckUniformValue( programId, uniformId, value ) )
+ const ProgramUniformValue<T>& mProgramUniforms = GetProgramUniformsForType(value);
+ if(mProgramUniforms.CheckUniformValue(programId, uniformId, value))
{
// the value matches
return true;
}
}
- fprintf(stderr, "Not found, printing possible values:\n" );
- for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
- program_it != mUniforms.end();
- ++program_it )
+ fprintf(stderr, "Not found, printing possible values:\n");
+ for(ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+ program_it != mUniforms.end();
+ ++program_it)
{
- const UniformIDMap &uniformIDs = program_it->second;
+ const UniformIDMap& uniformIDs = program_it->second;
- UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
- if( uniform_it != uniformIDs.end() )
+ UniformIDMap::const_iterator uniform_it = uniformIDs.find(name);
+ if(uniform_it != uniformIDs.end())
{
// found one matching uniform name, lets check the value...
GLuint programId = program_it->first;
- GLint uniformId = uniform_it->second;
+ GLint uniformId = uniform_it->second;
- const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
- T origValue;
- if ( mProgramUniforms.GetUniformValue(programId, uniformId, origValue) )
+ const ProgramUniformValue<T>& mProgramUniforms = GetProgramUniformsForType(value);
+ T origValue;
+ if(mProgramUniforms.GetUniformValue(programId, uniformId, origValue))
{
std::stringstream out;
out << uniform_it->first << ": " << origValue;
- fprintf(stderr, "%s\n", out.str().c_str() );
+ fprintf(stderr, "%s\n", out.str().c_str());
}
}
}
return false;
}
- template <typename T>
- inline bool GetUniformValue( GLuint programId, GLuint uniformId, T& outValue) const
+ template<typename T>
+ inline bool GetUniformValue(GLuint programId, GLuint uniformId, T& outValue) const
{
- const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( outValue );
- return mProgramUniforms.GetUniformValue( programId, uniformId, outValue );
+ const ProgramUniformValue<T>& mProgramUniforms = GetProgramUniformsForType(outValue);
+ return mProgramUniforms.GetUniformValue(programId, uniformId, outValue);
}
- inline bool GetUniformIds( const char* name, GLuint& programId, GLuint& uniformId ) const
+ inline bool GetUniformIds(const char* name, GLuint& programId, GLuint& uniformId) const
{
- for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
- program_it != mUniforms.end();
- ++program_it )
+ for(ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+ program_it != mUniforms.end();
+ ++program_it)
{
- const UniformIDMap &uniformIDs = program_it->second;
+ const UniformIDMap& uniformIDs = program_it->second;
- UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
- if( uniform_it != uniformIDs.end() )
+ UniformIDMap::const_iterator uniform_it = uniformIDs.find(name);
+ if(uniform_it != uniformIDs.end())
{
programId = program_it->first;
uniformId = uniform_it->second;
struct ScissorParams
{
- GLint x;
- GLint y;
+ GLint x;
+ GLint y;
GLsizei width;
GLsizei height;
- ScissorParams() : x( 0 ), y( 0 ), width( 0 ), height( 0 ) { }
+ ScissorParams()
+ : x(0),
+ y(0),
+ width(0),
+ height(0)
+ {
+ }
};
// Methods to check scissor tests
- inline const ScissorParams& GetScissorParams() const { return mScissorParams; }
+ inline const ScissorParams& GetScissorParams() const
+ {
+ return mScissorParams;
+ }
struct ColorMaskParams
{
GLboolean blue;
GLboolean alpha;
- ColorMaskParams() : red( true ), green( true ), blue( true ), alpha( true ) { }
+ ColorMaskParams()
+ : red(true),
+ green(true),
+ blue(true),
+ alpha(true)
+ {
+ }
};
- inline bool GetProgramBinaryCalled() const { return mGetProgramBinaryCalled; }
+ inline bool GetProgramBinaryCalled() const
+ {
+ return mGetProgramBinaryCalled;
+ }
- inline unsigned int GetClearCountCalled() const { return mClearCount; }
+ inline unsigned int GetClearCountCalled() const
+ {
+ return mClearCount;
+ }
- inline const ColorMaskParams& GetColorMaskParams() const { return mColorMaskParams; }
+ inline const ColorMaskParams& GetColorMaskParams() const
+ {
+ return mColorMaskParams;
+ }
- typedef std::vector<size_t> BufferDataCalls;
- inline const BufferDataCalls& GetBufferDataCalls() const { return mBufferDataCalls; }
- inline void ResetBufferDataCalls() { mBufferDataCalls.clear(); }
+ typedef std::vector<size_t> BufferDataCalls;
+ inline const BufferDataCalls& GetBufferDataCalls() const
+ {
+ return mBufferDataCalls;
+ }
+ inline void ResetBufferDataCalls()
+ {
+ mBufferDataCalls.clear();
+ }
- typedef std::vector<size_t> BufferSubDataCalls;
- inline const BufferSubDataCalls& GetBufferSubDataCalls() const { return mBufferSubDataCalls; }
- inline void ResetBufferSubDataCalls() { mBufferSubDataCalls.clear(); }
+ typedef std::vector<size_t> BufferSubDataCalls;
+ inline const BufferSubDataCalls& GetBufferSubDataCalls() const
+ {
+ return mBufferSubDataCalls;
+ }
+ inline void ResetBufferSubDataCalls()
+ {
+ mBufferSubDataCalls.clear();
+ }
private:
- GLuint mCurrentProgram;
- GLuint mCompileStatus;
- BufferDataCalls mBufferDataCalls;
- BufferSubDataCalls mBufferSubDataCalls;
- GLuint mLinkStatus;
- GLint mNumberOfActiveUniforms;
- GLint mGetAttribLocationResult;
- GLenum mGetErrorResult;
- GLubyte* mGetStringResult;
- GLboolean mIsBufferResult;
- GLboolean mIsEnabledResult;
- GLboolean mIsFramebufferResult;
- GLboolean mIsProgramResult;
- GLboolean mIsRenderbufferResult;
- GLboolean mIsShaderResult;
- GLboolean mIsTextureResult;
- GLenum mActiveTextureUnit;
- GLenum mCheckFramebufferStatusResult;
- GLint mFramebufferStatus;
- GLenum mFramebufferDepthAttached;
- GLenum mFramebufferStencilAttached;
- GLuint mFramebufferColorAttachmentCount;
- GLuint mFrameBufferColorStatus;
- GLint mNumBinaryFormats;
- GLint mBinaryFormats;
- GLint mProgramBinaryLength;
- bool mVertexAttribArrayState[MAX_ATTRIBUTE_CACHE_SIZE];
- bool mVertexAttribArrayChanged; // whether the vertex attrib array has been changed
- bool mGetProgramBinaryCalled;
- typedef std::map< GLuint, std::string> ShaderSourceMap;
- ShaderSourceMap mShaderSources;
- GLuint mLastShaderCompiled;
- GLbitfield mLastClearBitMask;
- Vector4 mLastClearColor;
- unsigned int mClearCount;
+ GLuint mCurrentProgram;
+ GLuint mCompileStatus;
+ BufferDataCalls mBufferDataCalls;
+ BufferSubDataCalls mBufferSubDataCalls;
+ GLuint mLinkStatus;
+ GLint mNumberOfActiveUniforms;
+ GLint mGetAttribLocationResult;
+ GLenum mGetErrorResult;
+ GLubyte* mGetStringResult;
+ GLboolean mIsBufferResult;
+ GLboolean mIsEnabledResult;
+ GLboolean mIsFramebufferResult;
+ GLboolean mIsProgramResult;
+ GLboolean mIsRenderbufferResult;
+ GLboolean mIsShaderResult;
+ GLboolean mIsTextureResult;
+ GLenum mActiveTextureUnit;
+ GLenum mCheckFramebufferStatusResult;
+ GLint mFramebufferStatus;
+ GLenum mFramebufferDepthAttached;
+ GLenum mFramebufferStencilAttached;
+ GLuint mFramebufferColorAttachmentCount;
+ GLuint mFrameBufferColorStatus;
+ GLint mNumBinaryFormats;
+ GLint mBinaryFormats;
+ GLint mProgramBinaryLength;
+ bool mVertexAttribArrayState[MAX_ATTRIBUTE_CACHE_SIZE];
+ bool mVertexAttribArrayChanged; // whether the vertex attrib array has been changed
+ bool mGetProgramBinaryCalled;
+ typedef std::map<GLuint, std::string> ShaderSourceMap;
+ ShaderSourceMap mShaderSources;
+ GLuint mLastShaderCompiled;
+ GLbitfield mLastClearBitMask;
+ Vector4 mLastClearColor;
+ unsigned int mClearCount;
Vector4 mLastBlendColor;
GLenum mLastBlendEquationRgb;
GLboolean mLastDepthMask;
// Data for manipulating the IDs returned by GenTextures
- GLuint mLastAutoTextureIdUsed;
- GLuint mNumGeneratedTextures;
+ GLuint mLastAutoTextureIdUsed;
+ GLuint mNumGeneratedTextures;
std::vector<GLuint> mNextTextureIds;
std::vector<GLuint> mDeletedTextureIds;
std::vector<GLuint> mBoundTextures;
std::vector<GLuint> mBoundTextures;
};
- ActiveTextureType mActiveTextures[ MIN_TEXTURE_UNIT_LIMIT ];
+ ActiveTextureType mActiveTextures[MIN_TEXTURE_UNIT_LIMIT];
TraceCallStack mCullFaceTrace;
TraceCallStack mEnableDisableTrace;
TraceCallStack mViewportTrace;
// Shaders & Uniforms
- GLuint mLastShaderIdUsed;
- GLuint mLastProgramIdUsed;
- GLuint mLastUniformIdUsed;
- typedef std::map< std::string, GLint > UniformIDMap;
- typedef std::map< GLuint, UniformIDMap > ProgramUniformMap;
- ProgramUniformMap mUniforms;
+ GLuint mLastShaderIdUsed;
+ GLuint mLastProgramIdUsed;
+ GLuint mLastUniformIdUsed;
+ typedef std::map<std::string, GLint> UniformIDMap;
+ typedef std::map<GLuint, UniformIDMap> ProgramUniformMap;
+ ProgramUniformMap mUniforms;
- template <typename T>
- struct ProgramUniformValue : public std::map< GLuint, std::map< GLint, T > >
+ template<typename T>
+ struct ProgramUniformValue : public std::map<GLuint, std::map<GLint, T> >
{
public:
- typedef std::map< GLint, T > UniformValueMap;
- typedef std::map< GLuint, UniformValueMap > Map;
+ typedef std::map<GLint, T> UniformValueMap;
+ typedef std::map<GLuint, UniformValueMap> Map;
- bool SetUniformValue( GLuint program, GLuint uniform, const T& value )
+ bool SetUniformValue(GLuint program, GLuint uniform, const T& value)
{
- if( program == 0 )
+ if(program == 0)
{
return false;
}
- typename Map::iterator it = Map::find( program );
- if( it == Map::end() )
+ typename Map::iterator it = Map::find(program);
+ if(it == Map::end())
{
// if its the first uniform for this program add it
- std::pair< typename Map::iterator, bool > result =
- Map::insert( typename Map::value_type( program, UniformValueMap() ) );
+ std::pair<typename Map::iterator, bool> result =
+ Map::insert(typename Map::value_type(program, UniformValueMap()));
it = result.first;
}
UniformValueMap& uniforms = it->second;
- uniforms[uniform] = value;
+ uniforms[uniform] = value;
return true;
}
- bool CheckUniformValue( GLuint program, GLuint uniform, const T& value ) const
+ bool CheckUniformValue(GLuint program, GLuint uniform, const T& value) const
{
T uniformValue;
- if ( GetUniformValue( program, uniform, uniformValue ) )
+ if(GetUniformValue(program, uniform, uniformValue))
{
return CompareType<T>(value, uniformValue, Math::MACHINE_EPSILON_10);
}
return false;
}
- bool GetUniformValue( GLuint program, GLuint uniform, T& value ) const
+ bool GetUniformValue(GLuint program, GLuint uniform, T& value) const
{
- if( program == 0 )
+ if(program == 0)
{
return false;
}
- typename Map::const_iterator it = Map::find( program );
- if( it == Map::end() )
+ typename Map::const_iterator it = Map::find(program);
+ if(it == Map::end())
{
// Uniform values always initialised as 0
value = GetZero();
return true;
}
- const UniformValueMap& uniforms = it->second;
- typename UniformValueMap::const_iterator it2 = uniforms.find( uniform );
- if( it2 == uniforms.end() )
+ const UniformValueMap& uniforms = it->second;
+ typename UniformValueMap::const_iterator it2 = uniforms.find(uniform);
+ if(it2 == uniforms.end())
{
// Uniform values always initialised as 0
value = GetZero();
T GetZero() const;
};
- ProgramUniformValue<int> mProgramUniforms1i;
- ProgramUniformValue<float> mProgramUniforms1f;
+ ProgramUniformValue<int> mProgramUniforms1i;
+ ProgramUniformValue<float> mProgramUniforms1f;
ProgramUniformValue<Vector2> mProgramUniforms2f;
ProgramUniformValue<Vector3> mProgramUniforms3f;
ProgramUniformValue<Vector4> mProgramUniforms4f;
- ProgramUniformValue<Matrix> mProgramUniformsMat4;
+ ProgramUniformValue<Matrix> mProgramUniformsMat4;
ProgramUniformValue<Matrix3> mProgramUniformsMat3;
- inline const ProgramUniformValue<int>& GetProgramUniformsForType( const int ) const
+ inline const ProgramUniformValue<int>& GetProgramUniformsForType(const int) const
{
return mProgramUniforms1i;
}
- inline const ProgramUniformValue<float>& GetProgramUniformsForType( const float ) const
+ inline const ProgramUniformValue<float>& GetProgramUniformsForType(const float) const
{
return mProgramUniforms1f;
}
- inline const ProgramUniformValue<Vector2>& GetProgramUniformsForType( const Vector2& ) const
+ inline const ProgramUniformValue<Vector2>& GetProgramUniformsForType(const Vector2&) const
{
return mProgramUniforms2f;
}
- inline const ProgramUniformValue<Vector3>& GetProgramUniformsForType( const Vector3& ) const
+ inline const ProgramUniformValue<Vector3>& GetProgramUniformsForType(const Vector3&) const
{
return mProgramUniforms3f;
}
- inline const ProgramUniformValue<Vector4>& GetProgramUniformsForType( const Vector4& ) const
+ inline const ProgramUniformValue<Vector4>& GetProgramUniformsForType(const Vector4&) const
{
return mProgramUniforms4f;
}
- inline const ProgramUniformValue<Matrix>& GetProgramUniformsForType( const Matrix& ) const
+ inline const ProgramUniformValue<Matrix>& GetProgramUniformsForType(const Matrix&) const
{
return mProgramUniformsMat4;
}
- inline const ProgramUniformValue<Matrix3>& GetProgramUniformsForType( const Matrix3& ) const
+ inline const ProgramUniformValue<Matrix3>& GetProgramUniformsForType(const Matrix3&) const
{
return mProgramUniformsMat3;
}
inline void SetVertexAttribArray(GLuint index, bool state)
{
- if( index >= MAX_ATTRIBUTE_CACHE_SIZE )
+ if(index >= MAX_ATTRIBUTE_CACHE_SIZE)
{
// out of range
return;
}
- mVertexAttribArrayState[ index ] = state;
- mVertexAttribArrayChanged = true;
+ mVertexAttribArrayState[index] = state;
+ mVertexAttribArrayChanged = true;
}
- ScissorParams mScissorParams;
+ ScissorParams mScissorParams;
ColorMaskParams mColorMaskParams;
};
-template <>
+template<>
inline int TestGlAbstraction::ProgramUniformValue<int>::GetZero() const
{
return 0;
}
-template <>
+template<>
inline float TestGlAbstraction::ProgramUniformValue<float>::GetZero() const
{
return 0.0f;
}
-template <>
+template<>
inline Vector2 TestGlAbstraction::ProgramUniformValue<Vector2>::GetZero() const
{
return Vector2::ZERO;
}
-template <>
+template<>
inline Vector3 TestGlAbstraction::ProgramUniformValue<Vector3>::GetZero() const
{
return Vector3::ZERO;
}
-template <>
+template<>
inline Vector4 TestGlAbstraction::ProgramUniformValue<Vector4>::GetZero() const
{
return Vector4::ZERO;
}
-template <>
+template<>
inline Matrix TestGlAbstraction::ProgramUniformValue<Matrix>::GetZero() const
{
return Matrix();
}
-template <>
+template<>
inline Matrix3 TestGlAbstraction::ProgramUniformValue<Matrix3>::GetZero() const
{
- return Matrix3( Matrix() );
+ return Matrix3(Matrix());
}
} // namespace Dali
bool BlendEnabled(const Dali::TraceCallStack& callStack);
bool BlendDisabled(const Dali::TraceCallStack& callStack);
-
#endif // TEST_GL_ABSTRACTION_H
namespace Dali
{
-
/**
* Class to emulate the GL context helper
*/
-class DALI_CORE_API TestGlContextHelperAbstraction: public Integration::GlContextHelperAbstraction
+class DALI_CORE_API TestGlContextHelperAbstraction : public Integration::GlContextHelperAbstraction
{
public:
/**
* Constructor
*/
- TestGlContextHelperAbstraction() {};
+ TestGlContextHelperAbstraction(){};
/**
* Destructor
*/
- ~TestGlContextHelperAbstraction() override {};
+ ~TestGlContextHelperAbstraction() override{};
/**
* @brief Switch to the surfaceless GL context
*/
- void MakeSurfacelessContextCurrent() override {};
+ void MakeSurfacelessContextCurrent() override{};
/**
* @brief Clear the GL context
*/
- void MakeContextNull() override {};
+ void MakeContextNull() override{};
/**
* @brief Wait until all GL rendering calls for the current GL context are executed
*/
- void WaitClient() override {};
+ void WaitClient() override{};
private:
-
- TestGlContextHelperAbstraction( const TestGlContextHelperAbstraction& ); ///< Undefined
- TestGlContextHelperAbstraction& operator=( const TestGlContextHelperAbstraction& ); ///< Undefined
+ TestGlContextHelperAbstraction(const TestGlContextHelperAbstraction&); ///< Undefined
+ TestGlContextHelperAbstraction& operator=(const TestGlContextHelperAbstraction&); ///< Undefined
};
-} // Dali
+} // namespace Dali
#endif // TEST_GL_CONTEXT_HELPER_ABSTRACTION_H
namespace Dali
{
-
TestSyncObject::TestSyncObject(TraceCallStack& trace)
: synced(false),
mTrace(trace)
return synced;
}
-
-
TestGlSyncAbstraction::TestGlSyncAbstraction()
{
Initialize();
*/
TestGlSyncAbstraction::~TestGlSyncAbstraction()
{
- for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
+ for(SyncIter iter = mSyncObjects.begin(), end = mSyncObjects.end(); iter != end; ++iter)
{
delete *iter;
}
* Create a sync object
* @return the sync object
*/
-Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObject( )
+Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObject()
{
mTrace.PushCall("CreateSyncObject", ""); // Trace the method
TestSyncObject* syncObject = new TestSyncObject(mTrace);
- mSyncObjects.push_back( syncObject );
+ mSyncObjects.push_back(syncObject);
return syncObject;
}
* Destroy a sync object
* @param[in] syncObject The object to destroy
*/
-void TestGlSyncAbstraction::DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject )
+void TestGlSyncAbstraction::DestroySyncObject(Integration::GlSyncAbstraction::SyncObject* syncObject)
{
std::stringstream out;
out << syncObject;
mTrace.PushCall("DestroySyncObject", out.str()); // Trace the method
- for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
+ for(SyncIter iter = mSyncObjects.begin(), end = mSyncObjects.end(); iter != end; ++iter)
{
- if( *iter == syncObject )
+ if(*iter == syncObject)
{
delete *iter;
mSyncObjects.erase(iter);
}
}
-
-Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncObject( )
+Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncObject()
{
- if( !mSyncObjects.empty() )
+ if(!mSyncObjects.empty())
{
return mSyncObjects.back();
}
* @param[in]
* @param[in] sync The sync value to set
*/
-void TestGlSyncAbstraction::SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync )
+void TestGlSyncAbstraction::SetObjectSynced(Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync)
{
TestSyncObject* testSyncObject = static_cast<TestSyncObject*>(syncObject);
- testSyncObject->synced = sync;
+ testSyncObject->synced = sync;
}
/**
* Turn trace on
*/
-void TestGlSyncAbstraction::EnableTrace(bool enable) { mTrace.Enable(enable); }
+void TestGlSyncAbstraction::EnableTrace(bool enable)
+{
+ mTrace.Enable(enable);
+}
/**
* Reset the trace callstack
*/
-void TestGlSyncAbstraction::ResetTrace() { mTrace.Reset(); }
+void TestGlSyncAbstraction::ResetTrace()
+{
+ mTrace.Reset();
+}
/**
* Get the trace object (allows test case to find methods on it)
*/
-TraceCallStack& TestGlSyncAbstraction::GetTrace() { return mTrace; }
+TraceCallStack& TestGlSyncAbstraction::GetTrace()
+{
+ return mTrace;
+}
int32_t TestGlSyncAbstraction::GetNumberOfSyncObjects()
{
- return static_cast<int32_t>( mSyncObjects.size() );
+ return static_cast<int32_t>(mSyncObjects.size());
}
-
-} // Dali
+} // namespace Dali
#define TEST_GL_SYNC_ABSTRACTION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// EXTERNAL INCLUDES
+#include <map>
#include <sstream>
#include <string>
-#include <map>
// INTERNAL INCLUDES
#include <dali/integration-api/core.h>
#include <dali/integration-api/gl-sync-abstraction.h>
+
#include "test-trace-call-stack.h"
namespace Dali
{
-
class DALI_CORE_API TestSyncObject : public Integration::GlSyncAbstraction::SyncObject
{
public:
TestSyncObject(TraceCallStack& trace);
~TestSyncObject() override;
- bool IsSynced() override;
- bool synced;
+ bool IsSynced() override;
+ bool synced;
TraceCallStack& mTrace;
};
/**
* Class to emulate the GL sync functions with tracing
*/
-class DALI_CORE_API TestGlSyncAbstraction: public Integration::GlSyncAbstraction
+class DALI_CORE_API TestGlSyncAbstraction : public Integration::GlSyncAbstraction
{
public:
/**
* Create a sync object
* @return the sync object
*/
- Integration::GlSyncAbstraction::SyncObject* CreateSyncObject( ) override;
+ Integration::GlSyncAbstraction::SyncObject* CreateSyncObject() override;
/**
* Destroy a sync object
* @param[in] syncObject The object to destroy
*/
- void DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject ) override;
-
+ void DestroySyncObject(Integration::GlSyncAbstraction::SyncObject* syncObject) override;
public: // TEST FUNCTIONS
- Integration::GlSyncAbstraction::SyncObject* GetLastSyncObject( );
+ Integration::GlSyncAbstraction::SyncObject* GetLastSyncObject();
/**
* Test method to trigger the object sync behaviour.
* @param[in]
* @param[in] sync The sync value to set
*/
- void SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync );
+ void SetObjectSynced(Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync);
/**
* Turn trace on
int32_t GetNumberOfSyncObjects();
private:
+ TestGlSyncAbstraction(const TestGlSyncAbstraction&); ///< Undefined
+ TestGlSyncAbstraction& operator=(const TestGlSyncAbstraction&); ///< Undefined
- TestGlSyncAbstraction( const TestGlSyncAbstraction& ); ///< Undefined
- TestGlSyncAbstraction& operator=( const TestGlSyncAbstraction& ); ///< Undefined
-
- typedef std::vector<TestSyncObject*> SyncContainer;
- typedef SyncContainer::iterator SyncIter;
- SyncContainer mSyncObjects; ///< The sync objects
- TraceCallStack mTrace; ///< the trace call stack for testing
+ typedef std::vector<TestSyncObject*> SyncContainer;
+ typedef SyncContainer::iterator SyncIter;
+ SyncContainer mSyncObjects; ///< The sync objects
+ TraceCallStack mTrace; ///< the trace call stack for testing
};
-} // Dali
+} // namespace Dali
#endif // TEST_GL_SYNC_ABSTRACTION_H
*/
#include "test-harness.h"
+
+#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <testcase.h>
#include <unistd.h>
-#include <vector>
-#include <map>
+
#include <cstring>
-#include <testcase.h>
-#include <fcntl.h>
+#include <map>
+#include <vector>
namespace TestHarness
{
-
typedef std::map<int32_t, TestCase> RunningTestCases;
const char* basename(const char* path)
{
- const char* ptr=path;
- const char* slash=NULL;
- for( ; *ptr != '\0' ; ++ptr )
+ const char* ptr = path;
+ const char* slash = NULL;
+ for(; *ptr != '\0'; ++ptr)
{
- if(*ptr == '/') slash=ptr;
+ if(*ptr == '/') slash = ptr;
}
if(slash != NULL) ++slash;
return slash;
open("/dev/null", O_RDWR); // Redirect file descriptor number 2 (i.e. stderr) to /dev/null
}
-int32_t RunTestCase( struct ::testcase_s& testCase )
+int32_t RunTestCase(struct ::testcase_s& testCase)
{
int32_t result = EXIT_STATUS_TESTCASE_FAILED;
-// dont want to catch exception as we want to be able to get
-// gdb stack trace from the first error
-// by default tests should all always pass with no exceptions
- if( testCase.startup )
+ // dont want to catch exception as we want to be able to get
+ // gdb stack trace from the first error
+ // by default tests should all always pass with no exceptions
+ if(testCase.startup)
{
testCase.startup();
}
{
result = testCase.function();
}
- catch( const char* )
+ catch(const char*)
{
// just catch test fail exception, return is already set to EXIT_STATUS_TESTCASE_FAILED
}
- if( testCase.cleanup )
+ if(testCase.cleanup)
{
testCase.cleanup();
}
return result;
}
-
-int32_t RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutput )
+int32_t RunTestCaseInChildProcess(struct ::testcase_s& testCase, bool suppressOutput)
{
int32_t testResult = EXIT_STATUS_TESTCASE_FAILED;
int32_t pid = fork();
- if( pid == 0 ) // Child process
+ if(pid == 0) // Child process
{
- if( suppressOutput )
+ if(suppressOutput)
{
SuppressLogOutput();
}
else
{
printf("\n");
- for(int32_t i=0; i<80; ++i) printf("#");
+ for(int32_t i = 0; i < 80; ++i) printf("#");
printf("\nTC: %s\n", testCase.name);
fflush(stdout);
}
- int32_t status = RunTestCase( testCase );
+ int32_t status = RunTestCase(testCase);
- if( ! suppressOutput )
+ if(!suppressOutput)
{
fflush(stdout);
fflush(stderr);
fclose(stdout);
fclose(stderr);
}
- exit( status );
+ exit(status);
}
else if(pid == -1)
{
}
else // Parent process
{
- int32_t status = 0;
+ int32_t status = 0;
int32_t childPid = waitpid(pid, &status, 0);
- if( childPid == -1 )
+ if(childPid == -1)
{
perror("waitpid");
exit(EXIT_STATUS_WAITPID_FAILED);
}
- if( WIFEXITED(status) )
+ if(WIFEXITED(status))
{
- if( childPid > 0 )
+ if(childPid > 0)
{
testResult = WEXITSTATUS(status);
- if( testResult )
+ if(testResult)
{
printf("Test case %s failed: %d\n", testCase.name, testResult);
}
}
}
- else if(WIFSIGNALED(status) )
+ else if(WIFSIGNALED(status))
{
int32_t signal = WTERMSIG(status);
- testResult = EXIT_STATUS_TESTCASE_ABORTED;
- if( signal == SIGABRT )
+ testResult = EXIT_STATUS_TESTCASE_ABORTED;
+ if(signal == SIGABRT)
{
- printf("Test case %s failed: test case asserted\n", testCase.name );
+ printf("Test case %s failed: test case asserted\n", testCase.name);
}
else
{
return testResult;
}
-void OutputStatistics( const char* processName, int32_t numPasses, int32_t numFailures )
+void OutputStatistics(const char* processName, int32_t numPasses, int32_t numFailures)
{
- FILE* fp=fopen("summary.xml", "a");
- if( fp != NULL )
+ FILE* fp = fopen("summary.xml", "a");
+ if(fp != NULL)
{
- fprintf( fp,
- " <suite name=\"%s\">\n"
- " <total_case>%d</total_case>\n"
- " <pass_case>%d</pass_case>\n"
- " <pass_rate>%5.2f</pass_rate>\n"
- " <fail_case>%d</fail_case>\n"
- " <fail_rate>%5.2f</fail_rate>\n"
- " <block_case>0</block_case>\n"
- " <block_rate>0.00</block_rate>\n"
- " <na_case>0</na_case>\n"
- " <na_rate>0.00</na_rate>\n"
- " </suite>\n",
- basename(processName),
- numPasses+numFailures,
- numPasses,
- (float)numPasses/(numPasses+numFailures),
- numFailures,
- (float)numFailures/(numPasses+numFailures) );
+ fprintf(fp,
+ " <suite name=\"%s\">\n"
+ " <total_case>%d</total_case>\n"
+ " <pass_case>%d</pass_case>\n"
+ " <pass_rate>%5.2f</pass_rate>\n"
+ " <fail_case>%d</fail_case>\n"
+ " <fail_rate>%5.2f</fail_rate>\n"
+ " <block_case>0</block_case>\n"
+ " <block_rate>0.00</block_rate>\n"
+ " <na_case>0</na_case>\n"
+ " <na_rate>0.00</na_rate>\n"
+ " </suite>\n",
+ basename(processName),
+ numPasses + numFailures,
+ numPasses,
+ (float)numPasses / (numPasses + numFailures),
+ numFailures,
+ (float)numFailures / (numPasses + numFailures));
fclose(fp);
}
}
-int32_t RunAll( const char* processName, ::testcase tc_array[] )
+int32_t RunAll(const char* processName, ::testcase tc_array[])
{
int32_t numFailures = 0;
- int32_t numPasses = 0;
+ int32_t numPasses = 0;
// Run test cases in child process( to kill output/handle signals ), but run serially.
- for( uint32_t i=0; tc_array[i].name; i++)
+ for(uint32_t i = 0; tc_array[i].name; i++)
{
- int32_t result = RunTestCaseInChildProcess( tc_array[i], false );
- if( result == 0 )
+ int32_t result = RunTestCaseInChildProcess(tc_array[i], false);
+ if(result == 0)
{
numPasses++;
}
}
}
- OutputStatistics( processName, numPasses, numFailures);
+ OutputStatistics(processName, numPasses, numFailures);
return numFailures;
}
// Constantly runs up to MAX_NUM_CHILDREN processes
-int32_t RunAllInParallel( const char* processName, ::testcase tc_array[], bool reRunFailed)
+int32_t RunAllInParallel(const char* processName, ::testcase tc_array[], bool reRunFailed)
{
int32_t numFailures = 0;
- int32_t numPasses = 0;
+ int32_t numPasses = 0;
- RunningTestCases children;
+ RunningTestCases children;
std::vector<int32_t> failedTestCases;
// Fork up to MAX_NUM_CHILDREN processes, then
// wait. As soon as a proc completes, fork the next.
- int32_t nextTestCase = 0;
+ int32_t nextTestCase = 0;
int32_t numRunningChildren = 0;
- while( tc_array[nextTestCase].name || numRunningChildren > 0)
+ while(tc_array[nextTestCase].name || numRunningChildren > 0)
{
// Create more children (up to the max number or til the end of the array)
- while( numRunningChildren < MAX_NUM_CHILDREN && tc_array[nextTestCase].name )
+ while(numRunningChildren < MAX_NUM_CHILDREN && tc_array[nextTestCase].name)
{
int32_t pid = fork();
- if( pid == 0 ) // Child process
+ if(pid == 0) // Child process
{
SuppressLogOutput();
- exit( RunTestCase( tc_array[nextTestCase] ) );
+ exit(RunTestCase(tc_array[nextTestCase]));
}
else if(pid == -1)
{
// Wait for the next child to finish
- int32_t status=0;
+ int32_t status = 0;
int32_t childPid = waitpid(-1, &status, 0);
- if( childPid == -1 )
+ if(childPid == -1)
{
perror("waitpid");
exit(EXIT_STATUS_WAITPID_FAILED);
}
- if( WIFEXITED(status) )
+ if(WIFEXITED(status))
{
- if( childPid > 0 )
+ if(childPid > 0)
{
int32_t testResult = WEXITSTATUS(status);
- if( testResult )
+ if(testResult)
{
printf("Test case %s failed: %d\n", children[childPid].testCaseName, testResult);
failedTestCases.push_back(children[childPid].testCase);
}
}
- else if( WIFSIGNALED(status) || WIFSTOPPED(status))
+ else if(WIFSIGNALED(status) || WIFSTOPPED(status))
{
- status = WIFSIGNALED(status)?WTERMSIG(status):WSTOPSIG(status);
+ status = WIFSIGNALED(status) ? WTERMSIG(status) : WSTOPSIG(status);
- if( childPid > 0 )
+ if(childPid > 0)
{
RunningTestCases::iterator iter = children.find(childPid);
- if( iter != children.end() )
+ if(iter != children.end())
{
printf("Test case %s exited with signal %s\n", iter->second.testCaseName, strsignal(status));
failedTestCases.push_back(iter->second.testCase);
}
}
- OutputStatistics( processName, numPasses, numFailures );
+ OutputStatistics(processName, numPasses, numFailures);
- if( reRunFailed )
+ if(reRunFailed)
{
- for( uint32_t i=0; i<failedTestCases.size(); i++)
+ for(uint32_t i = 0; i < failedTestCases.size(); i++)
{
- char* testCaseStrapline;
- int32_t numChars = asprintf(&testCaseStrapline, "Test case %s", tc_array[failedTestCases[i]].name );
+ char* testCaseStrapline;
+ int32_t numChars = asprintf(&testCaseStrapline, "Test case %s", tc_array[failedTestCases[i]].name);
printf("\n%s\n", testCaseStrapline);
- for(int32_t j=0; j<numChars; j++)
+ for(int32_t j = 0; j < numChars; j++)
{
printf("=");
}
printf("\n");
- RunTestCaseInChildProcess( tc_array[failedTestCases[i] ], false );
+ RunTestCaseInChildProcess(tc_array[failedTestCases[i]], false);
}
}
return numFailures;
}
-
-
int32_t FindAndRunTestCase(::testcase tc_array[], const char* testCaseName)
{
int32_t result = EXIT_STATUS_TESTCASE_NOT_FOUND;
- for( int32_t i = 0; tc_array[i].name; i++ )
+ for(int32_t i = 0; tc_array[i].name; i++)
{
- if( !strcmp(testCaseName, tc_array[i].name) )
+ if(!strcmp(testCaseName, tc_array[i].name))
{
- return RunTestCase( tc_array[i] );
+ return RunTestCase(tc_array[i]);
}
}
void Usage(const char* program)
{
- printf("Usage: \n"
- " %s <testcase name>\t\t Execute a test case\n"
- " %s \t\t Execute all test cases in parallel\n"
- " %s -r\t\t Execute all test cases in parallel, rerunning failed test cases\n"
- " %s -s\t\t Execute all test cases serially\n",
- program, program, program, program);
+ printf(
+ "Usage: \n"
+ " %s <testcase name>\t\t Execute a test case\n"
+ " %s \t\t Execute all test cases in parallel\n"
+ " %s -r\t\t Execute all test cases in parallel, rerunning failed test cases\n"
+ " %s -s\t\t Execute all test cases serially\n",
+ program,
+ program,
+ program,
+ program);
}
-} // namespace
+} // namespace TestHarness
#define TEST_HARNESS_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <stdio.h>
#include <testcase.h>
+
#include <cstdint>
namespace TestHarness
{
-
enum ExitStatus
{
- EXIT_STATUS_TESTCASE_SUCCEEDED, // 0
- EXIT_STATUS_TESTCASE_FAILED, // 1
- EXIT_STATUS_TESTCASE_ABORTED, // 2
- EXIT_STATUS_FORK_FAILED, // 3
- EXIT_STATUS_WAITPID_FAILED, // 4
- EXIT_STATUS_BAD_ARGUMENT, // 5
- EXIT_STATUS_TESTCASE_NOT_FOUND // 6
+ EXIT_STATUS_TESTCASE_SUCCEEDED, // 0
+ EXIT_STATUS_TESTCASE_FAILED, // 1
+ EXIT_STATUS_TESTCASE_ABORTED, // 2
+ EXIT_STATUS_FORK_FAILED, // 3
+ EXIT_STATUS_WAITPID_FAILED, // 4
+ EXIT_STATUS_BAD_ARGUMENT, // 5
+ EXIT_STATUS_TESTCASE_NOT_FOUND // 6
};
const int32_t MAX_NUM_CHILDREN(16);
struct TestCase
{
- int32_t testCase;
+ int32_t testCase;
const char* testCaseName;
TestCase()
}
TestCase& operator=(const TestCase& rhs)
{
- testCase = rhs.testCase;
+ testCase = rhs.testCase;
testCaseName = rhs.testCaseName;
return *this;
-
}
};
* Run a test case
* @param[in] testCase The Testkit-lite test case to run
*/
-int32_t RunTestCase( struct testcase_s& testCase );
+int32_t RunTestCase(struct testcase_s& testCase);
/**
* Run all test cases in parallel
* @param[in] tc_array The array of auto-generated testkit-lite test cases
* @return 0 on success
*/
-int32_t RunAll( const char* processName, testcase tc_array[] );
+int32_t RunAll(const char* processName, testcase tc_array[]);
/**
* Find the named test case in the given array, and run it
#define TEST_INTRUSIVE_PTR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// INTERNAL INCLUDES
-#include <iostream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
namespace Dali
{
-
-template <typename T>
+template<typename T>
struct UtcCoverageIntrusivePtr
{
typedef IntrusivePtr<T> (*Creator)();
- void Check( Creator creator)
+ void Check(Creator creator)
{
IntrusivePtr<T> a = creator();
IntrusivePtr<T> b = creator();
- DALI_TEST_CHECK( a.Get() );
+ DALI_TEST_CHECK(a.Get());
a.Reset();
DALI_TEST_CHECK(a);
a.Reset();
-
};
-
};
-} // Dali
+} // namespace Dali
#endif // TEST_INTRUSIVE_PTR_H
-
-
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*
*/
-
#include "test-application.h"
-#include "test-native-image.h"
+#include "test-native-image.h"
namespace Dali
{
-
TestNativeImagePointer TestNativeImage::New(uint32_t width, uint32_t height)
{
return new TestNativeImage(width, height);
}
TestNativeImage::TestNativeImage(uint32_t width, uint32_t height)
-: mWidth(width), mHeight(height), mExtensionCreateCalls(0), mExtensionDestroyCalls(0), mTargetTextureCalls(0),createResult(true)
+: mWidth(width),
+ mHeight(height),
+ mExtensionCreateCalls(0),
+ mExtensionDestroyCalls(0),
+ mTargetTextureCalls(0),
+ createResult(true)
{
}
{
}
-} // namespace dali
+} // namespace Dali
#define TEST_NATIVE_IMAGE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// INTERNAL INCLUDES
#include <dali/public-api/images/native-image-interface.h>
+
#include <dali/integration-api/gl-defines.h>
namespace Dali
public:
static TestNativeImagePointer New(uint32_t width, uint32_t height);
- inline void SetGlExtensionCreateResult(bool result){ createResult = result;}
- inline virtual bool CreateResource() { ++mExtensionCreateCalls; return createResult;};
- inline virtual void DestroyResource() { ++mExtensionDestroyCalls; };
- inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return mTargetTextureError;};
- inline virtual void PrepareTexture() {};
- inline virtual uint32_t GetWidth() const {return mWidth;};
- inline virtual uint32_t GetHeight() const {return mHeight;};
- inline virtual bool RequiresBlending() const {return true;};
- inline virtual int GetTextureTarget() const {return GL_TEXTURE_EXTERNAL_OES;};
- inline virtual const char* GetCustomFragmentPrefix() const {return "#extension GL_OES_EGL_image_external:require\n";};
- inline const char* GetCustomSamplerTypename() const override { return "samplerExternalOES"; };
+ inline void SetGlExtensionCreateResult(bool result)
+ {
+ createResult = result;
+ }
+ inline virtual bool CreateResource()
+ {
+ ++mExtensionCreateCalls;
+ return createResult;
+ };
+ inline virtual void DestroyResource()
+ {
+ ++mExtensionDestroyCalls;
+ };
+ inline virtual GLenum TargetTexture()
+ {
+ ++mTargetTextureCalls;
+ return mTargetTextureError;
+ };
+ inline virtual void PrepareTexture(){};
+ inline virtual uint32_t GetWidth() const
+ {
+ return mWidth;
+ };
+ inline virtual uint32_t GetHeight() const
+ {
+ return mHeight;
+ };
+ inline virtual bool RequiresBlending() const
+ {
+ return true;
+ };
+ inline virtual int GetTextureTarget() const
+ {
+ return GL_TEXTURE_EXTERNAL_OES;
+ };
+ inline virtual const char* GetCustomFragmentPrefix() const
+ {
+ return "#extension GL_OES_EGL_image_external:require\n";
+ };
+ inline const char* GetCustomSamplerTypename() const override
+ {
+ return "samplerExternalOES";
+ };
- inline Any GetNativeImageHandle() const override { return nullptr; };
- inline bool SourceChanged() const override { return false; };
+ inline Any GetNativeImageHandle() const override
+ {
+ return nullptr;
+ };
+ inline bool SourceChanged() const override
+ {
+ return false;
+ };
- inline virtual Dali::NativeImageInterface::Extension* GetExtension() {return nullptr;}
+ inline virtual Dali::NativeImageInterface::Extension* GetExtension()
+ {
+ return nullptr;
+ }
private:
TestNativeImage(uint32_t width, uint32_t height);
uint32_t mWidth;
uint32_t mHeight;
+
public:
- int32_t mExtensionCreateCalls;
- int32_t mExtensionDestroyCalls;
- int32_t mTargetTextureCalls;
- uint32_t mTargetTextureError=0u;
- bool createResult;
+ int32_t mExtensionCreateCalls;
+ int32_t mExtensionDestroyCalls;
+ int32_t mTargetTextureCalls;
+ uint32_t mTargetTextureError = 0u;
+ bool createResult;
};
-
-
-} // Dali
+} // namespace Dali
#endif // TEST_NATIVE_IMAGE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
#include "test-platform-abstraction.h"
-#include "dali-test-suite-utils.h"
+
#include <dali/integration-api/bitmap.h>
+#include "dali-test-suite-utils.h"
+
namespace Dali
{
-
TestPlatformAbstraction::TestPlatformAbstraction()
: mTrace(),
- mIsLoadingResult( false ),
+ mIsLoadingResult(false),
mClosestSize(),
mLoadFileResult(),
- mSaveFileResult( false ),
+ mSaveFileResult(false),
mSynchronouslyLoadedResource(),
mTimerId(0),
mCallbackFunction(nullptr)
{
}
-ImageDimensions TestPlatformAbstraction::GetClosestImageSize( const std::string& filename,
- ImageDimensions size,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection )
+ImageDimensions TestPlatformAbstraction::GetClosestImageSize(const std::string& filename,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection)
{
- ImageDimensions closestSize = ImageDimensions( mClosestSize );
+ ImageDimensions closestSize = ImageDimensions(mClosestSize);
mTrace.PushCall("GetClosestImageSize", "");
return closestSize;
}
-ImageDimensions TestPlatformAbstraction::GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
- ImageDimensions size,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection )
+ImageDimensions TestPlatformAbstraction::GetClosestImageSize(Integration::ResourcePointer resourceBuffer,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection)
{
- ImageDimensions closestSize = ImageDimensions( mClosestSize );
+ ImageDimensions closestSize = ImageDimensions(mClosestSize);
mTrace.PushCall("GetClosestImageSize", "");
return closestSize;
}
-Integration::ResourcePointer TestPlatformAbstraction::LoadImageSynchronously( const Integration::BitmapResourceType& resourceType, const std::string& resourcePath )
+Integration::ResourcePointer TestPlatformAbstraction::LoadImageSynchronously(const Integration::BitmapResourceType& resourceType, const std::string& resourcePath)
{
mTrace.PushCall("LoadResourceSynchronously", "");
return mSynchronouslyLoadedResource;
}
-Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer( const Integration::BitmapResourceType& resourceType, uint8_t * buffer, size_t size )
+Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer(const Integration::BitmapResourceType& resourceType, uint8_t* buffer, size_t size)
{
mTrace.PushCall("DecodeBuffer", "");
return mDecodedBitmap;
}
-bool TestPlatformAbstraction::LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
+bool TestPlatformAbstraction::LoadShaderBinaryFile(const std::string& filename, Dali::Vector<unsigned char>& buffer) const
{
mTrace.PushCall("LoadShaderBinaryFile", "");
- if( mLoadFileResult.loadResult )
+ if(mLoadFileResult.loadResult)
{
buffer = mLoadFileResult.buffer;
}
{
mTrace.Reset();
mTrace.Enable(true);
- mIsLoadingResult=false;
+ mIsLoadingResult = false;
mSynchronouslyLoadedResource.Reset();
mDecodedBitmap.Reset();
}
{
switch(func)
{
- case LoadResourceSynchronouslyFunc: return mTrace.FindMethod("LoadResourceSynchronously");
- case LoadShaderBinaryFileFunc: return mTrace.FindMethod("LoadShaderBinaryFile");
- case SaveShaderBinaryFileFunc: return mTrace.FindMethod("SaveShaderBinaryFile");
+ case LoadResourceSynchronouslyFunc:
+ return mTrace.FindMethod("LoadResourceSynchronously");
+ case LoadShaderBinaryFileFunc:
+ return mTrace.FindMethod("LoadShaderBinaryFile");
+ case SaveShaderBinaryFileFunc:
+ return mTrace.FindMethod("SaveShaderBinaryFile");
}
return false;
}
mDecodedBitmap.Reset();
}
-void TestPlatformAbstraction::SetClosestImageSize( const Vector2& size )
+void TestPlatformAbstraction::SetClosestImageSize(const Vector2& size)
{
- mClosestSize = ImageDimensions( static_cast<uint32_t>( size.x ), static_cast<uint32_t>( size.y ) );
+ mClosestSize = ImageDimensions(static_cast<uint32_t>(size.x), static_cast<uint32_t>(size.y));
}
-void TestPlatformAbstraction::SetLoadFileResult( bool result, Dali::Vector< unsigned char >& buffer )
+void TestPlatformAbstraction::SetLoadFileResult(bool result, Dali::Vector<unsigned char>& buffer)
{
mLoadFileResult.loadResult = result;
- if( result )
+ if(result)
{
mLoadFileResult.buffer = buffer;
}
}
-void TestPlatformAbstraction::SetSaveFileResult( bool result )
+void TestPlatformAbstraction::SetSaveFileResult(bool result)
{
mSaveFileResult = result;
}
-void TestPlatformAbstraction::SetSynchronouslyLoadedResource( Integration::ResourcePointer resource )
+void TestPlatformAbstraction::SetSynchronouslyLoadedResource(Integration::ResourcePointer resource)
{
mSynchronouslyLoadedResource = resource;
}
-void TestPlatformAbstraction::SetDecodedBitmap( Integration::BitmapPtr bitmap )
+void TestPlatformAbstraction::SetDecodedBitmap(Integration::BitmapPtr bitmap)
{
mDecodedBitmap = bitmap;
}
-uint32_t TestPlatformAbstraction::StartTimer( uint32_t milliseconds, CallbackBase* callback )
+uint32_t TestPlatformAbstraction::StartTimer(uint32_t milliseconds, CallbackBase* callback)
{
mCallbackFunction = callback;
mTimerId++;
void TestPlatformAbstraction::TriggerTimer()
{
- if (mCallbackFunction != nullptr)
+ if(mCallbackFunction != nullptr)
{
- CallbackBase::Execute( *mCallbackFunction );
+ CallbackBase::Execute(*mCallbackFunction);
}
}
-void TestPlatformAbstraction::CancelTimer ( uint32_t timerId )
+void TestPlatformAbstraction::CancelTimer(uint32_t timerId)
{
mCallbackFunction = nullptr;
}
#define DALI_TEST_PLATFORM_ABSTRACTION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// EXTERNAL INCLUDES
#include <stdint.h>
+
#include <cstring>
#include <string>
#include <vector>
namespace Dali
{
-
/**
* Concrete implementation of the platform abstraction class.
*/
class DALI_CORE_API TestPlatformAbstraction : public Dali::Integration::PlatformAbstraction
{
-
public:
-
/**
* Constructor
*/
/**
* @copydoc PlatformAbstraction::GetClosestImageSize()
*/
- ImageDimensions GetClosestImageSize( const std::string& filename,
- ImageDimensions size,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection ) override;
+ ImageDimensions GetClosestImageSize(const std::string& filename,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection) override;
/**
* @copydoc PlatformAbstraction::GetClosestImageSize()
*/
- ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
- ImageDimensions size,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection ) override;
+ ImageDimensions GetClosestImageSize(Integration::ResourcePointer resourceBuffer,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection) override;
/**
* @copydoc PlatformAbstraction::LoadResourceSynchronously()
*/
- Integration::ResourcePointer LoadImageSynchronously( const Integration::BitmapResourceType& resourceType, const std::string& resourcePath ) override;
+ Integration::ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& resourceType, const std::string& resourcePath) override;
/**
* @copydoc PlatformAbstraction::DecodeBuffer()
*/
- Integration::BitmapPtr DecodeBuffer( const Dali::Integration::BitmapResourceType& resourceType, uint8_t * buffer, size_t size ) override;
+ Integration::BitmapPtr DecodeBuffer(const Dali::Integration::BitmapResourceType& resourceType, uint8_t* buffer, size_t size) override;
/**
* @copydoc PlatformAbstraction::LoadShaderBinaryFile()
*/
- bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const override;
+ bool LoadShaderBinaryFile(const std::string& filename, Dali::Vector<unsigned char>& buffer) const override;
/**
* @copydoc PlatformAbstraction::SaveShaderBinaryFile()
*/
- virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const override { return true; }
+ virtual bool SaveShaderBinaryFile(const std::string& filename, const unsigned char* buffer, unsigned int numBytes) const override
+ {
+ return true;
+ }
/**
* @copydoc PlatformAbstraction::StartTimer()
*/
- uint32_t StartTimer( uint32_t milliseconds, CallbackBase* callback ) override;
+ uint32_t StartTimer(uint32_t milliseconds, CallbackBase* callback) override;
/*
* @copydoc PlatformAbstraction::CancelTimer()
*/
- void CancelTimer ( uint32_t timerId ) override;
+ void CancelTimer(uint32_t timerId) override;
public: // TEST FUNCTIONS
-
// Enumeration of Platform Abstraction methods
typedef enum
{
/** Call this every test */
void Initialize();
- inline void EnableTrace(bool enable) { mTrace.Enable(enable); }
- inline void ResetTrace() { mTrace.Reset(); }
- inline TraceCallStack& GetTrace() { return mTrace; }
+ inline void EnableTrace(bool enable)
+ {
+ mTrace.Enable(enable);
+ }
+ inline void ResetTrace()
+ {
+ mTrace.Reset();
+ }
+ inline TraceCallStack& GetTrace()
+ {
+ return mTrace;
+ }
/**
* @brief Checks if a platform function was called
* @brief Sets the value returned by GetClosestImageSize.
* @param[in] size The size that should be returned.
*/
- void SetClosestImageSize( const Vector2& size );
+ void SetClosestImageSize(const Vector2& size);
/**
* @brief Sets the result return by LoadFile.
* @param[in] result The value that LoadFile should return.
* @param[in] buffer The buffer of the loaded file.
*/
- void SetLoadFileResult( bool result, Dali::Vector< unsigned char >& buffer );
+ void SetLoadFileResult(bool result, Dali::Vector<unsigned char>& buffer);
/**
* @brief Sets the SaveFile result
* @param[in] result The value that SaveFile should return
*/
- void SetSaveFileResult( bool result );
+ void SetSaveFileResult(bool result);
/**
* @brief Sets the resource loaded by LoadResourceSynchronously
* @param[in] resource The loaded resource
*/
- void SetSynchronouslyLoadedResource( Integration::ResourcePointer resource );
+ void SetSynchronouslyLoadedResource(Integration::ResourcePointer resource);
/**
* @brief Sets the bitmap returned by DecodeBuffer()
* @param[in] bitmap The decoded bitmap
*/
- void SetDecodedBitmap( Integration::BitmapPtr bitmap );
+ void SetDecodedBitmap(Integration::BitmapPtr bitmap);
/**
* @brief Triggers the previously stored callback function
void TriggerTimer();
private:
-
- TestPlatformAbstraction( const TestPlatformAbstraction& ); ///< Undefined
- TestPlatformAbstraction& operator=( const TestPlatformAbstraction& ); ///< Undefined
+ TestPlatformAbstraction(const TestPlatformAbstraction&); ///< Undefined
+ TestPlatformAbstraction& operator=(const TestPlatformAbstraction&); ///< Undefined
private:
-
struct LoadFileResult
{
inline LoadFileResult()
: loadResult(false)
{
-
}
- bool loadResult;
- Dali::Vector< unsigned char> buffer;
+ bool loadResult;
+ Dali::Vector<unsigned char> buffer;
};
- mutable TraceCallStack mTrace;
- bool mIsLoadingResult;
- ImageDimensions mClosestSize;
+ mutable TraceCallStack mTrace;
+ bool mIsLoadingResult;
+ ImageDimensions mClosestSize;
- LoadFileResult mLoadFileResult;
- bool mSaveFileResult;
+ LoadFileResult mLoadFileResult;
+ bool mSaveFileResult;
- Integration::ResourcePointer mSynchronouslyLoadedResource;
- Integration::BitmapPtr mDecodedBitmap;
+ Integration::ResourcePointer mSynchronouslyLoadedResource;
+ Integration::BitmapPtr mDecodedBitmap;
- uint32_t mTimerId;
- CallbackBase* mCallbackFunction;
+ uint32_t mTimerId;
+ CallbackBase* mCallbackFunction;
};
-} // Dali
+} // namespace Dali
#endif /* DALI_TEST_PLATFORM_ABSTRACTION_H */
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace Dali
{
-
TestRenderController::TestRenderController()
{
Initialize();
{
}
-void TestRenderController::RequestUpdate( bool forceUpdate )
+void TestRenderController::RequestUpdate(bool forceUpdate)
{
mRequestUpdateCalled = true;
}
-void TestRenderController::RequestProcessEventsOnIdle( bool forceProcess )
+void TestRenderController::RequestProcessEventsOnIdle(bool forceProcess)
{
mRequestProcessEventsOnIdleCalled = true;
}
{
switch(func)
{
- case RequestUpdateFunc: return mRequestUpdateCalled;
- case RequestProcessEventsOnIdleFunc: return mRequestProcessEventsOnIdleCalled;
+ case RequestUpdateFunc:
+ return mRequestUpdateCalled;
+ case RequestProcessEventsOnIdleFunc:
+ return mRequestProcessEventsOnIdleCalled;
}
return false;
void TestRenderController::Initialize()
{
- mRequestUpdateCalled = false;
+ mRequestUpdateCalled = false;
mRequestProcessEventsOnIdleCalled = false;
}
-
-} // namespace dali
+} // namespace Dali
#define TEST_RENDER_CONTROLLER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
#include <dali/integration-api/render-controller.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali
{
-
class DALI_CORE_API TestRenderController : public Dali::Integration::RenderController
{
public:
TestRenderController();
~TestRenderController() override;
- void RequestUpdate( bool forceUpdate ) override;
- void RequestProcessEventsOnIdle( bool forceProcess ) override;
+ void RequestUpdate(bool forceUpdate) override;
+ void RequestProcessEventsOnIdle(bool forceProcess) override;
typedef enum
{
bool WasCalled(TestRenderControllerFuncEnum func);
void Initialize();
-
private:
bool mRequestUpdateCalled;
bool mRequestProcessEventsOnIdleCalled;
};
-} // Dali
+} // namespace Dali
#endif // TEST_RENDER_CONTROLLER_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
#include "test-trace-call-stack.h"
+
#include <sstream>
namespace Dali
{
-
std::string ToString(int x)
{
std::stringstream out;
/**
* Constructor
*/
-TraceCallStack::TraceCallStack() : mTraceActive(false) { }
+TraceCallStack::TraceCallStack()
+: mTraceActive(false)
+{
+}
/**
* Destructor
*/
-TraceCallStack::~TraceCallStack() { }
+TraceCallStack::~TraceCallStack()
+{
+}
/**
* Turn on / off tracing
*/
-void TraceCallStack::Enable(bool enable) { mTraceActive = enable; }
+void TraceCallStack::Enable(bool enable)
+{
+ mTraceActive = enable;
+}
-bool TraceCallStack::IsEnabled() { return mTraceActive; }
+bool TraceCallStack::IsEnabled()
+{
+ return mTraceActive;
+}
/**
* Push a call onto the stack if the trace is active
if(mTraceActive)
{
FunctionCall stackFrame(method, params);
- mCallStack.push_back( stackFrame );
+ mCallStack.push_back(stackFrame);
}
}
if(mTraceActive)
{
FunctionCall stackFrame(method, params, altParams);
- mCallStack.push_back( stackFrame );
+ mCallStack.push_back(stackFrame);
}
}
bool TraceCallStack::FindMethod(std::string method) const
{
bool found = false;
- for( size_t i=0; i < mCallStack.size(); i++ )
+ for(size_t i = 0; i < mCallStack.size(); i++)
{
- if( 0 == mCallStack[i].method.compare(method) )
+ if(0 == mCallStack[i].method.compare(method))
{
found = true;
break;
return found;
}
-bool TraceCallStack::FindMethodAndGetParameters(std::string method, std::string& params ) const
+bool TraceCallStack::FindMethodAndGetParameters(std::string method, std::string& params) const
{
bool found = false;
- for( size_t i=0; i < mCallStack.size(); i++ )
+ for(size_t i = 0; i < mCallStack.size(); i++)
{
- if( 0 == mCallStack[i].method.compare(method) )
+ if(0 == mCallStack[i].method.compare(method))
{
- found = true;
+ found = true;
params = mCallStack[i].paramList;
break;
}
int TraceCallStack::CountMethod(std::string method) const
{
int numCalls = 0;
- for( size_t i=0; i < mCallStack.size(); i++ )
+ for(size_t i = 0; i < mCallStack.size(); i++)
{
- if( 0 == mCallStack[i].method.compare(method) )
+ if(0 == mCallStack[i].method.compare(method))
{
numCalls++;
}
*/
bool TraceCallStack::FindMethodAndParams(std::string method, std::string params) const
{
- return FindIndexFromMethodAndParams( method, params ) > -1;
+ return FindIndexFromMethodAndParams(method, params) > -1;
}
bool TraceCallStack::FindMethodAndParams(std::string method, const NamedParams& params) const
{
- return FindIndexFromMethodAndParams( method, params ) > -1;
+ return FindIndexFromMethodAndParams(method, params) > -1;
}
-bool TraceCallStack::FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const
+bool TraceCallStack::FindMethodAndParamsFromStartIndex(std::string method, std::string params, size_t& startIndex) const
{
- for( size_t i = startIndex; i < mCallStack.size(); ++i )
+ for(size_t i = startIndex; i < mCallStack.size(); ++i)
{
- if( ( mCallStack[i].method.compare( method ) == 0 ) && ( mCallStack[i].paramList.compare( params ) == 0 ) )
+ if((mCallStack[i].method.compare(method) == 0) && (mCallStack[i].paramList.compare(params) == 0))
{
startIndex = i;
return true;
int32_t TraceCallStack::FindIndexFromMethodAndParams(std::string method, std::string params) const
{
int32_t index = -1;
- for( size_t i=0; i < mCallStack.size(); i++ )
+ for(size_t i = 0; i < mCallStack.size(); i++)
{
- if( 0 == mCallStack[i].method.compare(method) && 0 == mCallStack[i].paramList.compare(params) )
+ if(0 == mCallStack[i].method.compare(method) && 0 == mCallStack[i].paramList.compare(params))
{
- index = static_cast<int32_t>( i );
+ index = static_cast<int32_t>(i);
break;
}
}
int TraceCallStack::FindIndexFromMethodAndParams(std::string method, const TraceCallStack::NamedParams& params) const
{
int32_t index = -1;
- for( size_t i=0; i < mCallStack.size(); i++ )
+ for(size_t i = 0; i < mCallStack.size(); i++)
{
- if( 0 == mCallStack[i].method.compare(method) )
+ if(0 == mCallStack[i].method.compare(method))
{
// Test each of the passed in parameters:
bool match = true;
- for( NamedParams::const_iterator iter = params.begin() ; iter != params.end() ; ++iter )
+ for(NamedParams::const_iterator iter = params.begin(); iter != params.end(); ++iter)
{
NamedParams::const_iterator paramIter = mCallStack[i].namedParams.find(iter->first);
- if( paramIter == params.end() || paramIter->second.compare(iter->second) != 0 )
+ if(paramIter == params.end() || paramIter->second.compare(iter->second) != 0)
{
match = false;
break;
}
}
- if( match == true )
+ if(match == true)
{
- index = static_cast<int32_t>( i );
+ index = static_cast<int32_t>(i);
break;
}
}
return index;
}
-
/**
* Test if the given method and parameters are at a given index in the stack
* @param[in] index Index in the call stack
*/
bool TraceCallStack::TestMethodAndParams(int index, std::string method, std::string params) const
{
- return ( 0 == mCallStack[index].method.compare(method) && 0 == mCallStack[index].paramList.compare(params) );
+ return (0 == mCallStack[index].method.compare(method) && 0 == mCallStack[index].paramList.compare(params));
}
/**
mCallStack.clear();
}
-
} // namespace Dali
#define TEST_TRACE_CALL_STACK_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*
*/
-#include <string>
-#include <vector>
#include <map>
#include <sstream>
+#include <string>
+#include <vector>
namespace Dali
{
-
template<typename T>
std::string ToString(const T& x)
{
class TraceCallStack
{
public:
-
/// Typedef for passing and storing named parameters
- typedef std::map< std::string, std::string > NamedParams;
+ typedef std::map<std::string, std::string> NamedParams;
/**
* Constructor
* @param[out] params of the method
* @return true if the method was in the stack
*/
- bool FindMethodAndGetParameters(std::string method, std::string& params ) const;
+ bool FindMethodAndGetParameters(std::string method, std::string& params) const;
/**
* Count how many times a method was called
* calls can search for methods occuring after this one.
* @return True if the method was in the stack
*/
- bool FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const;
+ bool FindMethodAndParamsFromStartIndex(std::string method, std::string params, size_t& startIndex) const;
/**
* Search for a method in the stack with the given parameter list
std::string GetTraceString()
{
std::stringstream traceStream;
- std::size_t functionCount = mCallStack.size();
- for( std::size_t i = 0; i < functionCount; ++i )
+ std::size_t functionCount = mCallStack.size();
+ for(std::size_t i = 0; i < functionCount; ++i)
{
- Dali::TraceCallStack::FunctionCall functionCall = mCallStack[ i ];
+ Dali::TraceCallStack::FunctionCall functionCall = mCallStack[i];
traceStream << "StackTrace: Index:" << i << ", Function:" << functionCall.method << ", ParamList:" << functionCall.paramList << std::endl;
}
std::string method;
std::string paramList;
NamedParams namedParams;
- FunctionCall( const std::string& aMethod, const std::string& aParamList )
- : method( aMethod ), paramList( aParamList )
+ FunctionCall(const std::string& aMethod, const std::string& aParamList)
+ : method(aMethod),
+ paramList(aParamList)
{
}
- FunctionCall( const std::string& aMethod, const std::string& aParamList, const NamedParams& altParams )
- : method( aMethod ), paramList( aParamList ), namedParams( altParams )
+ FunctionCall(const std::string& aMethod, const std::string& aParamList, const NamedParams& altParams)
+ : method(aMethod),
+ paramList(aParamList),
+ namedParams(altParams)
{
}
};
- std::vector< FunctionCall > mCallStack; ///< The call stack
+ std::vector<FunctionCall> mCallStack; ///< The call stack
};
-} // namespace dali
+} // namespace Dali
#endif // TEST_TRACE_CALL_STACK_H
-#include <string.h>
#include <getopt.h>
#include <stdlib.h>
+#include <string.h>
#include <test-harness.h>
+
#include "tct-dali-adaptor-core.h"
-int main(int argc, char * const argv[])
+int main(int argc, char* const argv[])
{
int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT;
const char* optString = "sf";
- bool optRerunFailed(true);
- bool optRunSerially(false);
+ bool optRerunFailed(true);
+ bool optRunSerially(false);
int nextOpt = 0;
do
{
- nextOpt = getopt( argc, argv, optString );
+ nextOpt = getopt(argc, argv, optString);
switch(nextOpt)
{
case 'f':
exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT);
break;
}
- } while( nextOpt != -1 );
+ } while(nextOpt != -1);
- if( optind == argc ) // no testcase name in argument list
+ if(optind == argc) // no testcase name in argument list
{
- if( optRunSerially )
+ if(optRunSerially)
{
- result = TestHarness::RunAll( argv[0], tc_array );
+ result = TestHarness::RunAll(argv[0], tc_array);
}
else
{
- result = TestHarness::RunAllInParallel( argv[0], tc_array, optRerunFailed );
+ result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed);
}
}
else
*
*/
-#include <dali/dali.h>
#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
using namespace Dali;
namespace
{
-
struct MyTestApp : public ConnectionTracker
{
- MyTestApp( Application& app)
- : initCalled( false ),
- application( app )
+ MyTestApp(Application& app)
+ : initCalled(false),
+ application(app)
{
- application.InitSignal().Connect( this, &MyTestApp::Create );
+ application.InitSignal().Connect(this, &MyTestApp::Create);
}
void Create(Application& app)
}
// Data
- bool initCalled;
+ bool initCalled;
Application& application;
};
-void ApplicationSignalCallback( Application& app )
+void ApplicationSignalCallback(Application& app)
{
}
-void ApplicationControlSignalCallback(Application&, void *)
+void ApplicationControlSignalCallback(Application&, void*)
{
}
} // unnamed namespace
-void LowBatterySignalCallback( Dali::DeviceStatus::Battery::Status status )
+void LowBatterySignalCallback(Dali::DeviceStatus::Battery::Status status)
{
}
-void LowMemorySignalCallback( Dali::DeviceStatus::Memory::Status status )
+void LowMemorySignalCallback(Dali::DeviceStatus::Memory::Status status)
{
}
{
Application application = Application::New();
- MyTestApp testApp( application );
+ MyTestApp testApp(application);
- DALI_TEST_CHECK( application );
+ DALI_TEST_CHECK(application);
END_TEST;
}
int UtcDaliApplicationNew02(void)
{
- int argc( 1 );
- const char* argList[1] = { "program" };
- char** argv = const_cast<char**>(argList);
+ int argc(1);
+ const char* argList[1] = {"program"};
+ char** argv = const_cast<char**>(argList);
- Application application = Application::New( &argc, &argv );
+ Application application = Application::New(&argc, &argv);
- MyTestApp testApp( application );
+ MyTestApp testApp(application);
- DALI_TEST_CHECK( application );
+ DALI_TEST_CHECK(application);
END_TEST;
}
int UtcDaliApplicationNew03(void)
{
- int argc( 1 );
- const char* argList[1] = { "program" };
- char** argv = const_cast<char**>(argList);
+ int argc(1);
+ const char* argList[1] = {"program"};
+ char** argv = const_cast<char**>(argList);
- Application application = Application::New( &argc, &argv, "stylesheet" );
+ Application application = Application::New(&argc, &argv, "stylesheet");
- MyTestApp testApp( application );
+ MyTestApp testApp(application);
- DALI_TEST_CHECK( application );
+ DALI_TEST_CHECK(application);
END_TEST;
}
int UtcDaliApplicationNew04(void)
{
- int argc( 1 );
- const char* argList[1] = { "program" };
- char** argv = const_cast<char**>(argList);
+ int argc(1);
+ const char* argList[1] = {"program"};
+ char** argv = const_cast<char**>(argList);
- Application application = Application::New( &argc, &argv, "stylesheet", Application::TRANSPARENT );
+ Application application = Application::New(&argc, &argv, "stylesheet", Application::TRANSPARENT);
- MyTestApp testApp( application );
+ MyTestApp testApp(application);
- DALI_TEST_CHECK( application );
+ DALI_TEST_CHECK(application);
END_TEST;
}
int UtcDaliApplicationCopyAndAssignment(void)
{
Application application = Application::New();
- Application copy( application );
- DALI_TEST_CHECK( copy == application );
+ Application copy(application);
+ DALI_TEST_CHECK(copy == application);
Application assigned;
- DALI_TEST_CHECK( !assigned );
+ DALI_TEST_CHECK(!assigned);
assigned = application;
- DALI_TEST_CHECK( copy == assigned );
+ DALI_TEST_CHECK(copy == assigned);
END_TEST;
}
int UtcDaliApplicationMoveConstructor(void)
{
Application application = Application::New();
- DALI_TEST_CHECK( application );
- DALI_TEST_EQUALS( 1, application.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(application);
+ DALI_TEST_EQUALS(1, application.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- Application moved = std::move( application );
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !application );
+ Application moved = std::move(application);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!application);
END_TEST;
}
int UtcDaliApplicationMoveAssignment(void)
{
Application application = Application::New();
- DALI_TEST_CHECK( application );
- DALI_TEST_EQUALS( 1, application.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(application);
+ DALI_TEST_EQUALS(1, application.GetBaseObject().ReferenceCount(), TEST_LOCATION);
Application moved;
- moved = std::move( application );
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !application );
+ moved = std::move(application);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!application);
END_TEST;
}
try
{
application.MainLoop();
- DALI_TEST_CHECK( false ); // Should not get here
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
}
-
int UtcDaliApplicationLowerN(void)
{
Application application;
try
{
application.Lower();
- DALI_TEST_CHECK( false ); // Should not get here
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
application.Quit();
- DALI_TEST_CHECK( false ); // Should not get here
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
CallbackBase* callback = NULL;
- application.AddIdle( callback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.AddIdle(callback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
- (void) application.GetWindow();
- DALI_TEST_CHECK( false ); // Should not get here
+ (void)application.GetWindow();
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliApplicationInitSignalP(void)
{
Application application = Application::New();
- application.InitSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( application );
+ application.InitSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.InitSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.InitSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliApplicationTerminateSignalP(void)
{
Application application = Application::New();
- application.TerminateSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( application );
+ application.TerminateSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.TerminateSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.TerminateSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliApplicationPauseSignalP(void)
{
Application application = Application::New();
- application.PauseSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( application );
+ application.PauseSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.PauseSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.PauseSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliApplicationResumeSignalP(void)
{
Application application = Application::New();
- application.ResumeSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( application );
+ application.ResumeSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.ResumeSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.ResumeSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliApplicationResetSignalP(void)
{
Application application = Application::New();
- application.ResetSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( application );
+ application.ResetSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.ResetSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.ResetSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliApplicationlControlSignalP(void)
{
Application application = Application::New();
- application.AppControlSignal().Connect( &ApplicationControlSignalCallback );
- DALI_TEST_CHECK( application );
+ application.AppControlSignal().Connect(&ApplicationControlSignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.AppControlSignal().Connect( &ApplicationControlSignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.AppControlSignal().Connect(&ApplicationControlSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliApplicationLanguageChangedSignalP(void)
{
Application application = Application::New();
- application.LanguageChangedSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( application );
+ application.LanguageChangedSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.LanguageChangedSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.LanguageChangedSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliApplicationRegionChangedSignalP(void)
{
Application application = Application::New();
- application.RegionChangedSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( application );
+ application.RegionChangedSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.RegionChangedSignal().Connect( &ApplicationSignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.RegionChangedSignal().Connect(&ApplicationSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliApplicationLowBatterySignalP(void)
{
Application application = Application::New();
- application.LowBatterySignal().Connect( &LowBatterySignalCallback );
- DALI_TEST_CHECK( application );
+ application.LowBatterySignal().Connect(&LowBatterySignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.LowBatterySignal().Connect( &LowBatterySignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.LowBatterySignal().Connect(&LowBatterySignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliApplicationLowMemorySignalP(void)
{
Application application = Application::New();
- application.LowMemorySignal().Connect( &LowMemorySignalCallback );
- DALI_TEST_CHECK( application );
+ application.LowMemorySignal().Connect(&LowMemorySignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.LowMemorySignal().Connect( &LowMemorySignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.LowMemorySignal().Connect(&LowMemorySignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliApplicationGetResourcePathP(void)
{
Application application = Application::New();
- std::string result ("**invalid path**"); // Calling GetResourcePath should replace this with a system dependent path or "".
+ std::string result("**invalid path**"); // Calling GetResourcePath should replace this with a system dependent path or "".
result = application.GetResourcePath();
- DALI_TEST_CHECK( result !="**invalid path**" );
+ DALI_TEST_CHECK(result != "**invalid path**");
END_TEST;
}
Application application = Application::New();
std::string result;
result = application.GetRegion();
- DALI_TEST_CHECK( result == "NOT_SUPPORTED" ); // Not supported in UBUNTU
+ DALI_TEST_CHECK(result == "NOT_SUPPORTED"); // Not supported in UBUNTU
END_TEST;
}
Application application = Application::New();
std::string result;
result = application.GetLanguage();
- DALI_TEST_CHECK( result == "NOT_SUPPORTED" ); // Not supported in UBUNTU
+ DALI_TEST_CHECK(result == "NOT_SUPPORTED"); // Not supported in UBUNTU
END_TEST;
}
int UtcDaliApplicationGetObjectRegistryN(void)
{
Application application = Application::New();
- DALI_TEST_CHECK( !application.GetObjectRegistry() );
+ DALI_TEST_CHECK(!application.GetObjectRegistry());
END_TEST;
}
*
*/
-#include <dali/dali.h>
#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
#include <dali/devel-api/adaptor-framework/file-loader.h>
-
-
using namespace Dali;
-
void utc_dali_file_loader_startup(void)
{
test_return_value = TET_UNDEF;
int UtcDaliReadFileNew1(void)
{
- int errorCode;
+ int errorCode;
Dali::Vector<char> buffer;
//negative case
- errorCode = FileLoader::ReadFile( TEST_RESOURCE_DIR "/not_exist.txt", buffer, FileLoader::TEXT );
+ errorCode = FileLoader::ReadFile(TEST_RESOURCE_DIR "/not_exist.txt", buffer, FileLoader::TEXT);
- DALI_TEST_CHECK( errorCode == 0 );
+ DALI_TEST_CHECK(errorCode == 0);
- DALI_TEST_CHECK( buffer.Size() == 0 );
+ DALI_TEST_CHECK(buffer.Size() == 0);
//positive case
- errorCode = FileLoader::ReadFile( TEST_RESOURCE_DIR "/test.txt", buffer, FileLoader::TEXT );
+ errorCode = FileLoader::ReadFile(TEST_RESOURCE_DIR "/test.txt", buffer, FileLoader::TEXT);
- DALI_TEST_CHECK( errorCode != 0 );
+ DALI_TEST_CHECK(errorCode != 0);
- DALI_TEST_CHECK( buffer.Size() > 0 );
+ DALI_TEST_CHECK(buffer.Size() > 0);
END_TEST;
}
int UtcDaliReadFileNew2(void)
{
- int errorCode;
+ int errorCode;
Dali::Vector<char> buffer;
- std::streampos fileSize = 0;
+ std::streampos fileSize = 0;
//negative case
- errorCode = FileLoader::ReadFile( TEST_RESOURCE_DIR "/not_exist.txt", fileSize, buffer, FileLoader::TEXT );
+ errorCode = FileLoader::ReadFile(TEST_RESOURCE_DIR "/not_exist.txt", fileSize, buffer, FileLoader::TEXT);
- DALI_TEST_CHECK( errorCode == 0 );
+ DALI_TEST_CHECK(errorCode == 0);
- DALI_TEST_CHECK( buffer.Size() == 0 );
+ DALI_TEST_CHECK(buffer.Size() == 0);
- DALI_TEST_CHECK( fileSize == 0 );
+ DALI_TEST_CHECK(fileSize == 0);
//positive case
- errorCode = FileLoader::ReadFile( TEST_RESOURCE_DIR "/test.txt", fileSize, buffer, FileLoader::TEXT );
+ errorCode = FileLoader::ReadFile(TEST_RESOURCE_DIR "/test.txt", fileSize, buffer, FileLoader::TEXT);
- DALI_TEST_CHECK( errorCode != 0 );
+ DALI_TEST_CHECK(errorCode != 0);
- DALI_TEST_CHECK( buffer.Size() > 0 );
+ DALI_TEST_CHECK(buffer.Size() > 0);
- DALI_TEST_CHECK( fileSize != 0 );
+ DALI_TEST_CHECK(fileSize != 0);
END_TEST;
}
std::streampos fileSize = 0;
//negative case
- fileSize = FileLoader::GetFileSize( TEST_RESOURCE_DIR "/not_exist.txt" );
+ fileSize = FileLoader::GetFileSize(TEST_RESOURCE_DIR "/not_exist.txt");
- DALI_TEST_CHECK( fileSize == 0 );
+ DALI_TEST_CHECK(fileSize == 0);
//positive case
- fileSize = FileLoader::GetFileSize( TEST_RESOURCE_DIR "/test.txt" );
+ fileSize = FileLoader::GetFileSize(TEST_RESOURCE_DIR "/test.txt");
- DALI_TEST_CHECK( fileSize != 0 );
+ DALI_TEST_CHECK(fileSize != 0);
END_TEST;
}
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*
*/
-#include <stdlib.h>
-#include <dali/dali.h>
#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
#include <dali/devel-api/adaptor-framework/animated-image-loading.h>
+#include <stdlib.h>
using namespace Dali;
// this image if not exist, for negative test
static const char* gGifNonExist = "non-exist.gif";
-void VerifyLoad( std::vector<Dali::PixelData>& pixelDataList, Dali::Vector<uint32_t>& frameDelayList,
- uint32_t frameCount, uint32_t width, uint32_t height, uint32_t delay )
+void VerifyLoad(std::vector<Dali::PixelData>& pixelDataList, Dali::Vector<uint32_t>& frameDelayList, uint32_t frameCount, uint32_t width, uint32_t height, uint32_t delay)
{
- DALI_TEST_EQUALS( pixelDataList.size(), frameCount, TEST_LOCATION );
- DALI_TEST_EQUALS( frameDelayList.Size(), frameCount, TEST_LOCATION );
+ DALI_TEST_EQUALS(pixelDataList.size(), frameCount, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameDelayList.Size(), frameCount, TEST_LOCATION);
- for( uint32_t idx = 0; idx<frameCount; idx++ )
+ for(uint32_t idx = 0; idx < frameCount; idx++)
{
// Check the image size and delay of each frame
- DALI_TEST_EQUALS( pixelDataList[idx].GetWidth(), width, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelDataList[idx].GetHeight(), height, TEST_LOCATION );
- DALI_TEST_EQUALS( frameDelayList[idx], delay, TEST_LOCATION );
+ DALI_TEST_EQUALS(pixelDataList[idx].GetWidth(), width, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelDataList[idx].GetHeight(), height, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameDelayList[idx], delay, TEST_LOCATION);
}
}
-}
+} // namespace
void utc_dali_animated_image_loader_startup(void)
{
int UtcDaliAnimatedImageLoadingP(void)
{
std::vector<Dali::PixelData> pixelDataList;
- Dali::Vector<uint32_t> frameDelayList;
+ Dali::Vector<uint32_t> frameDelayList;
- Dali::AnimatedImageLoading animatedImageLoading = Dali::AnimatedImageLoading::New( gGif_100_None, true );
- bool succeed = animatedImageLoading.LoadNextNFrames( 0u, animatedImageLoading.GetImageCount(), pixelDataList );
+ Dali::AnimatedImageLoading animatedImageLoading = Dali::AnimatedImageLoading::New(gGif_100_None, true);
+ bool succeed = animatedImageLoading.LoadNextNFrames(0u, animatedImageLoading.GetImageCount(), pixelDataList);
frameDelayList.Clear();
- frameDelayList.Resize( animatedImageLoading.GetImageCount(), 0 );
- for( uint32_t i = 0; i < animatedImageLoading.GetImageCount(); ++i )
+ frameDelayList.Resize(animatedImageLoading.GetImageCount(), 0);
+ for(uint32_t i = 0; i < animatedImageLoading.GetImageCount(); ++i)
{
- frameDelayList[i] = animatedImageLoading.GetFrameInterval( i );
+ frameDelayList[i] = animatedImageLoading.GetFrameInterval(i);
}
// Check that the loading succeed
- DALI_TEST_CHECK( succeed );
- VerifyLoad( pixelDataList, frameDelayList, 5u, 100u, 100u, 1000u );
+ DALI_TEST_CHECK(succeed);
+ VerifyLoad(pixelDataList, frameDelayList, 5u, 100u, 100u, 1000u);
pixelDataList.clear();
- animatedImageLoading = Dali::AnimatedImageLoading::New( gGif_100_Prev, true );
- succeed = animatedImageLoading.LoadNextNFrames( 0u, animatedImageLoading.GetImageCount(), pixelDataList );
+ animatedImageLoading = Dali::AnimatedImageLoading::New(gGif_100_Prev, true);
+ succeed = animatedImageLoading.LoadNextNFrames(0u, animatedImageLoading.GetImageCount(), pixelDataList);
frameDelayList.Clear();
- frameDelayList.Resize( animatedImageLoading.GetImageCount(), 0 );
- for( uint32_t i = 0; i < animatedImageLoading.GetImageCount(); ++i )
+ frameDelayList.Resize(animatedImageLoading.GetImageCount(), 0);
+ for(uint32_t i = 0; i < animatedImageLoading.GetImageCount(); ++i)
{
- frameDelayList[i] = animatedImageLoading.GetFrameInterval( i );
+ frameDelayList[i] = animatedImageLoading.GetFrameInterval(i);
}
// Check that the loading succeed
- DALI_TEST_CHECK( succeed );
- VerifyLoad( pixelDataList, frameDelayList, 5u, 100u, 100u, 1000u );
+ DALI_TEST_CHECK(succeed);
+ VerifyLoad(pixelDataList, frameDelayList, 5u, 100u, 100u, 1000u);
pixelDataList.clear();
- animatedImageLoading = Dali::AnimatedImageLoading::New( gGif_100_Bgnd, true );
- succeed = animatedImageLoading.LoadNextNFrames( 0u, animatedImageLoading.GetImageCount(), pixelDataList );
+ animatedImageLoading = Dali::AnimatedImageLoading::New(gGif_100_Bgnd, true);
+ succeed = animatedImageLoading.LoadNextNFrames(0u, animatedImageLoading.GetImageCount(), pixelDataList);
frameDelayList.Clear();
- frameDelayList.Resize( animatedImageLoading.GetImageCount(), 0 );
- for( uint32_t i = 0; i < animatedImageLoading.GetImageCount(); ++i )
+ frameDelayList.Resize(animatedImageLoading.GetImageCount(), 0);
+ for(uint32_t i = 0; i < animatedImageLoading.GetImageCount(); ++i)
{
- frameDelayList[i] = animatedImageLoading.GetFrameInterval( i );
+ frameDelayList[i] = animatedImageLoading.GetFrameInterval(i);
}
// Check that the loading succeed
- DALI_TEST_CHECK( succeed );
- VerifyLoad( pixelDataList, frameDelayList, 5u, 100u, 100u, 1000u );
+ DALI_TEST_CHECK(succeed);
+ VerifyLoad(pixelDataList, frameDelayList, 5u, 100u, 100u, 1000u);
END_TEST;
}
int UtcDaliAnimatedImageLoadingN(void)
{
std::vector<Dali::PixelData> pixelDataList;
- Dali::Vector<uint32_t> frameDelayList;
+ Dali::Vector<uint32_t> frameDelayList;
- Dali::AnimatedImageLoading animatedImageLoading = Dali::AnimatedImageLoading::New( gGifNonExist, true );
- bool succeed = animatedImageLoading.LoadNextNFrames( 0u, animatedImageLoading.GetImageCount(), pixelDataList );
+ Dali::AnimatedImageLoading animatedImageLoading = Dali::AnimatedImageLoading::New(gGifNonExist, true);
+ bool succeed = animatedImageLoading.LoadNextNFrames(0u, animatedImageLoading.GetImageCount(), pixelDataList);
// Check that the loading failed
- DALI_TEST_CHECK( !succeed );
+ DALI_TEST_CHECK(!succeed);
// Check that both pixelDataList and frameDelayList are empty
- DALI_TEST_EQUALS( pixelDataList.size(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(pixelDataList.size(), 0u, TEST_LOCATION);
END_TEST;
}
int UtcDaliAnimatedImageLoadingGetImageSizeP(void)
{
- Dali::AnimatedImageLoading animatedImageLoading = Dali::AnimatedImageLoading::New( gGif_100_None, true );
- ImageDimensions imageSize = animatedImageLoading.GetImageSize();
+ Dali::AnimatedImageLoading animatedImageLoading = Dali::AnimatedImageLoading::New(gGif_100_None, true);
+ ImageDimensions imageSize = animatedImageLoading.GetImageSize();
// Check that the image size is [100, 100]
- DALI_TEST_EQUALS( imageSize.GetWidth(), 100u, TEST_LOCATION );
- DALI_TEST_EQUALS( imageSize.GetHeight(), 100u, TEST_LOCATION );
+ DALI_TEST_EQUALS(imageSize.GetWidth(), 100u, TEST_LOCATION);
+ DALI_TEST_EQUALS(imageSize.GetHeight(), 100u, TEST_LOCATION);
END_TEST;
}
int UtcDaliAnimatedImageLoadingGetImageSizeN(void)
{
- Dali::AnimatedImageLoading animatedImageLoading = Dali::AnimatedImageLoading::New( gGifNonExist, true );
- ImageDimensions imageSize = animatedImageLoading.GetImageSize();
+ Dali::AnimatedImageLoading animatedImageLoading = Dali::AnimatedImageLoading::New(gGifNonExist, true);
+ ImageDimensions imageSize = animatedImageLoading.GetImageSize();
// Check that it returns zero size when the animated image is not valid
- DALI_TEST_EQUALS( imageSize.GetWidth(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( imageSize.GetHeight(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(imageSize.GetWidth(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(imageSize.GetHeight(), 0u, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <stdlib.h>
-#include <dali/dali.h>
-#include <dali-test-suite-utils.h>
#include <dali-test-img-utils.h>
+#include <dali-test-suite-utils.h>
+
+#include <dali/dali.h>
#include <dali/devel-api/adaptor-framework/image-loading.h>
+#include <stdlib.h>
using namespace Dali;
// resolution: 50*64, pixel format: RGB888
const char* IMAGE_WIDTH_EVEN_EXIF8_RGB = TEST_RESOURCE_DIR "/f-even-exif-8.jpg";
-
// this is image is not exist, for negative test
const char* IMAGENONEXIST = "non-exist.jpg";
-}
+} // namespace
void utc_dali_load_image_startup(void)
{
int UtcDaliLoadImageP(void)
{
- Devel::PixelBuffer pixelBuffer = Dali::LoadImageFromFile( IMAGE_34_RGBA );
- DALI_TEST_CHECK( pixelBuffer );
- DALI_TEST_EQUALS( pixelBuffer.GetWidth(), 34u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBuffer.GetHeight(), 34u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBuffer.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION );
-
- Devel::PixelBuffer pixelBuffer2 = Dali::LoadImageFromFile( IMAGE_128_RGB );
- DALI_TEST_CHECK( pixelBuffer2 );
- DALI_TEST_EQUALS( pixelBuffer2.GetWidth(), 128u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBuffer2.GetHeight(), 128u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBuffer2.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
-
- Devel::PixelBuffer pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_LARGE_EXIF3_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 2000u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 2560u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
-
- Devel::PixelBuffer BufferJpeg1 = Dali::LoadImageFromFile( IMAGE_WIDTH_ODD_EXIF1_RGB );
- DALI_TEST_CHECK( BufferJpeg1 );
- DALI_TEST_EQUALS( BufferJpeg1.GetWidth(), 55u, TEST_LOCATION );
- DALI_TEST_EQUALS( BufferJpeg1.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( BufferJpeg1.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_ODD_EXIF2_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_ODD_EXIF3_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_ODD_EXIF4_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_ODD_EXIF5_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_ODD_EXIF6_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_ODD_EXIF7_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_ODD_EXIF8_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- BufferJpeg1 = Dali::LoadImageFromFile( IMAGE_WIDTH_EVEN_EXIF1_RGB );
- DALI_TEST_CHECK( BufferJpeg1 );
- DALI_TEST_EQUALS( BufferJpeg1.GetWidth(), 50u, TEST_LOCATION );
- DALI_TEST_EQUALS( BufferJpeg1.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( BufferJpeg1.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_EVEN_EXIF2_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_EVEN_EXIF3_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_EVEN_EXIF4_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_EVEN_EXIF5_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_EVEN_EXIF6_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_EVEN_EXIF7_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
-
- pixelBufferJpeg = Dali::LoadImageFromFile( IMAGE_WIDTH_EVEN_EXIF8_RGB );
- DALI_TEST_CHECK( pixelBufferJpeg );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
- DALI_IMAGE_TEST_EQUALS( BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+ Devel::PixelBuffer pixelBuffer = Dali::LoadImageFromFile(IMAGE_34_RGBA);
+ DALI_TEST_CHECK(pixelBuffer);
+ DALI_TEST_EQUALS(pixelBuffer.GetWidth(), 34u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBuffer.GetHeight(), 34u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBuffer.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION);
+
+ Devel::PixelBuffer pixelBuffer2 = Dali::LoadImageFromFile(IMAGE_128_RGB);
+ DALI_TEST_CHECK(pixelBuffer2);
+ DALI_TEST_EQUALS(pixelBuffer2.GetWidth(), 128u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBuffer2.GetHeight(), 128u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBuffer2.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+
+ Devel::PixelBuffer pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_LARGE_EXIF3_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 2000u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 2560u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+
+ Devel::PixelBuffer BufferJpeg1 = Dali::LoadImageFromFile(IMAGE_WIDTH_ODD_EXIF1_RGB);
+ DALI_TEST_CHECK(BufferJpeg1);
+ DALI_TEST_EQUALS(BufferJpeg1.GetWidth(), 55u, TEST_LOCATION);
+ DALI_TEST_EQUALS(BufferJpeg1.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(BufferJpeg1.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_ODD_EXIF2_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_ODD_EXIF3_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_ODD_EXIF4_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_ODD_EXIF5_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_ODD_EXIF6_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_ODD_EXIF7_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_ODD_EXIF8_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 55u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ BufferJpeg1 = Dali::LoadImageFromFile(IMAGE_WIDTH_EVEN_EXIF1_RGB);
+ DALI_TEST_CHECK(BufferJpeg1);
+ DALI_TEST_EQUALS(BufferJpeg1.GetWidth(), 50u, TEST_LOCATION);
+ DALI_TEST_EQUALS(BufferJpeg1.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(BufferJpeg1.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_EVEN_EXIF2_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_EVEN_EXIF3_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_EVEN_EXIF4_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_EVEN_EXIF5_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_EVEN_EXIF6_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_EVEN_EXIF7_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
+
+ pixelBufferJpeg = Dali::LoadImageFromFile(IMAGE_WIDTH_EVEN_EXIF8_RGB);
+ DALI_TEST_CHECK(pixelBufferJpeg);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetWidth(), 50u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetHeight(), 64u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBufferJpeg.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
+ DALI_IMAGE_TEST_EQUALS(BufferJpeg1, pixelBufferJpeg, 8, TEST_LOCATION);
END_TEST;
}
int UtcDaliLoadImageN(void)
{
- Devel::PixelBuffer pixelBuffer = Dali::LoadImageFromFile( IMAGENONEXIST );
- DALI_TEST_CHECK( !pixelBuffer );
+ Devel::PixelBuffer pixelBuffer = Dali::LoadImageFromFile(IMAGENONEXIST);
+ DALI_TEST_CHECK(!pixelBuffer);
END_TEST;
}
-
int UtcDaliDownloadImageP(void)
{
std::string url("file://");
- url.append( IMAGE_34_RGBA );
+ url.append(IMAGE_34_RGBA);
std::string url2("file://");
- url2.append( IMAGE_128_RGB );
+ url2.append(IMAGE_128_RGB);
- Devel::PixelBuffer pixelBuffer = Dali::DownloadImageSynchronously( url );
- DALI_TEST_CHECK( pixelBuffer );
- DALI_TEST_EQUALS( pixelBuffer.GetWidth(), 34u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBuffer.GetHeight(), 34u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBuffer.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION );
+ Devel::PixelBuffer pixelBuffer = Dali::DownloadImageSynchronously(url);
+ DALI_TEST_CHECK(pixelBuffer);
+ DALI_TEST_EQUALS(pixelBuffer.GetWidth(), 34u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBuffer.GetHeight(), 34u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBuffer.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION);
- Devel::PixelBuffer pixelBuffer2 = Dali::DownloadImageSynchronously( url2 );
- DALI_TEST_CHECK( pixelBuffer2 );
- DALI_TEST_EQUALS( pixelBuffer2.GetWidth(), 128u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBuffer2.GetHeight(), 128u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBuffer2.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION );
+ Devel::PixelBuffer pixelBuffer2 = Dali::DownloadImageSynchronously(url2);
+ DALI_TEST_CHECK(pixelBuffer2);
+ DALI_TEST_EQUALS(pixelBuffer2.GetWidth(), 128u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBuffer2.GetHeight(), 128u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBuffer2.GetPixelFormat(), Pixel::RGB888, TEST_LOCATION);
END_TEST;
}
int UtcDaliDownloadImageN(void)
{
- Devel::PixelBuffer pixelBuffer = Dali::DownloadImageSynchronously( IMAGENONEXIST );
- DALI_TEST_CHECK( !pixelBuffer );
+ Devel::PixelBuffer pixelBuffer = Dali::DownloadImageSynchronously(IMAGENONEXIST);
+ DALI_TEST_CHECK(!pixelBuffer);
END_TEST;
}
-
int UtcDaliDownloadRemoteChunkedImage(void)
{
std::string url("http://d2k43l0oslhof9.cloudfront.net/platform/image/contents/vc/20/01/58/20170629100630071189_0bf6b911-a847-cba4-e518-be40fe2f579420170629192203240.jpg");
- Devel::PixelBuffer pixelBuffer = Dali::DownloadImageSynchronously( url );
- DALI_TEST_CHECK( pixelBuffer );
- DALI_TEST_EQUALS( pixelBuffer.GetWidth(), 279u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBuffer.GetHeight(), 156u, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelBuffer.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION );
+ Devel::PixelBuffer pixelBuffer = Dali::DownloadImageSynchronously(url);
+ DALI_TEST_CHECK(pixelBuffer);
+ DALI_TEST_EQUALS(pixelBuffer.GetWidth(), 279u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBuffer.GetHeight(), 156u, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelBuffer.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION);
END_TEST;
}
*/
// EXTERNAL INCLUDES
-#include <map>
#include <string.h>
#include <iostream>
+#include <map>
// CLASS HEADER
-#include <stdlib.h>
-#include <iostream>
+#include <dali-test-suite-utils.h>
#include <dali.h>
#include <dali/devel-api/events/key-event-devel.h>
-#include <dali-test-suite-utils.h>
+#include <stdlib.h>
+#include <iostream>
using namespace Dali;
// Copied from key-impl.h
struct KeyLookup
{
- const char* keyName; ///< XF86 key name
+ const char* keyName; ///< XF86 key name
const Dali::KEY daliKeyCode; ///< Dali key code
- const bool deviceButton; ///< Whether the key is from a button on the device
+ const bool deviceButton; ///< Whether the key is from a button on the device
};
// Common keys for all platforms
-KeyLookup KeyLookupTable[]=
-{
- { "Escape", DALI_KEY_ESCAPE, false }, // item not defined in utilX
- { "Menu", DALI_KEY_MENU, false }, // item not defined in utilX
+KeyLookup KeyLookupTable[] =
+ {
+ {"Escape", DALI_KEY_ESCAPE, false}, // item not defined in utilX
+ {"Menu", DALI_KEY_MENU, false}, // item not defined in utilX
- // Now the key names are used as literal string not defined symbols,
- // since these definition in utilX.h is deprecated and we're guided not to use them
- { "XF86Camera", DALI_KEY_CAMERA, false },
- { "XF86Camera_Full", DALI_KEY_CONFIG, false },
- { "XF86PowerOff", DALI_KEY_POWER, true },
- { "XF86Standby", DALI_KEY_PAUSE, false },
- { "Cancel", DALI_KEY_CANCEL, false },
- { "XF86AudioPlay", DALI_KEY_PLAY_CD, false },
- { "XF86AudioStop", DALI_KEY_STOP_CD, false },
- { "XF86AudioPause", DALI_KEY_PAUSE_CD, false },
- { "XF86AudioNext", DALI_KEY_NEXT_SONG, false },
- { "XF86AudioPrev", DALI_KEY_PREVIOUS_SONG, false },
- { "XF86AudioRewind", DALI_KEY_REWIND, false },
- { "XF86AudioForward", DALI_KEY_FASTFORWARD, false },
- { "XF86AudioMedia", DALI_KEY_MEDIA, false },
- { "XF86AudioPlayPause", DALI_KEY_PLAY_PAUSE, false },
- { "XF86AudioMute", DALI_KEY_MUTE, false },
- { "XF86Menu", DALI_KEY_MENU, true },
- { "XF86Home", DALI_KEY_HOME, true },
- { "XF86Back", DALI_KEY_BACK, true },
- { "XF86Send", DALI_KEY_MENU, true },
- { "XF86Phone", DALI_KEY_HOME, true },
- { "XF86Stop", DALI_KEY_BACK, true },
- { "XF86HomePage", DALI_KEY_HOMEPAGE, false },
- { "XF86WWW", DALI_KEY_WEBPAGE, false },
- { "XF86Mail", DALI_KEY_MAIL, false },
- { "XF86ScreenSaver", DALI_KEY_SCREENSAVER, false },
- { "XF86MonBrightnessUp", DALI_KEY_BRIGHTNESS_UP, false },
- { "XF86MonBrightnessDown", DALI_KEY_BRIGHTNESS_DOWN, false },
- { "XF86SoftKBD", DALI_KEY_SOFT_KBD, false },
- { "XF86QuickPanel", DALI_KEY_QUICK_PANEL, false },
- { "XF86TaskPane", DALI_KEY_TASK_SWITCH, false },
- { "XF86Apps", DALI_KEY_APPS, false },
- { "XF86Search", DALI_KEY_SEARCH, false },
- { "XF86Voice", DALI_KEY_VOICE, false },
- { "Hangul", DALI_KEY_LANGUAGE, false },
- { "XF86AudioRaiseVolume", DALI_KEY_VOLUME_UP, true },
- { "XF86AudioLowerVolume", DALI_KEY_VOLUME_DOWN, true },
+ // Now the key names are used as literal string not defined symbols,
+ // since these definition in utilX.h is deprecated and we're guided not to use them
+ {"XF86Camera", DALI_KEY_CAMERA, false},
+ {"XF86Camera_Full", DALI_KEY_CONFIG, false},
+ {"XF86PowerOff", DALI_KEY_POWER, true},
+ {"XF86Standby", DALI_KEY_PAUSE, false},
+ {"Cancel", DALI_KEY_CANCEL, false},
+ {"XF86AudioPlay", DALI_KEY_PLAY_CD, false},
+ {"XF86AudioStop", DALI_KEY_STOP_CD, false},
+ {"XF86AudioPause", DALI_KEY_PAUSE_CD, false},
+ {"XF86AudioNext", DALI_KEY_NEXT_SONG, false},
+ {"XF86AudioPrev", DALI_KEY_PREVIOUS_SONG, false},
+ {"XF86AudioRewind", DALI_KEY_REWIND, false},
+ {"XF86AudioForward", DALI_KEY_FASTFORWARD, false},
+ {"XF86AudioMedia", DALI_KEY_MEDIA, false},
+ {"XF86AudioPlayPause", DALI_KEY_PLAY_PAUSE, false},
+ {"XF86AudioMute", DALI_KEY_MUTE, false},
+ {"XF86Menu", DALI_KEY_MENU, true},
+ {"XF86Home", DALI_KEY_HOME, true},
+ {"XF86Back", DALI_KEY_BACK, true},
+ {"XF86Send", DALI_KEY_MENU, true},
+ {"XF86Phone", DALI_KEY_HOME, true},
+ {"XF86Stop", DALI_KEY_BACK, true},
+ {"XF86HomePage", DALI_KEY_HOMEPAGE, false},
+ {"XF86WWW", DALI_KEY_WEBPAGE, false},
+ {"XF86Mail", DALI_KEY_MAIL, false},
+ {"XF86ScreenSaver", DALI_KEY_SCREENSAVER, false},
+ {"XF86MonBrightnessUp", DALI_KEY_BRIGHTNESS_UP, false},
+ {"XF86MonBrightnessDown", DALI_KEY_BRIGHTNESS_DOWN, false},
+ {"XF86SoftKBD", DALI_KEY_SOFT_KBD, false},
+ {"XF86QuickPanel", DALI_KEY_QUICK_PANEL, false},
+ {"XF86TaskPane", DALI_KEY_TASK_SWITCH, false},
+ {"XF86Apps", DALI_KEY_APPS, false},
+ {"XF86Search", DALI_KEY_SEARCH, false},
+ {"XF86Voice", DALI_KEY_VOICE, false},
+ {"Hangul", DALI_KEY_LANGUAGE, false},
+ {"XF86AudioRaiseVolume", DALI_KEY_VOLUME_UP, true},
+ {"XF86AudioLowerVolume", DALI_KEY_VOLUME_DOWN, true},
};
-const std::size_t KEY_LOOKUP_COUNT = (sizeof( KeyLookupTable))/ (sizeof(KeyLookup));
-
+const std::size_t KEY_LOOKUP_COUNT = (sizeof(KeyLookupTable)) / (sizeof(KeyLookup));
// Generate a KeyPressEvent to send to Core
-Dali::KeyEvent GenerateKeyPress( const std::string& keyName )
+Dali::KeyEvent GenerateKeyPress(const std::string& keyName)
{
- Dali::KeyEvent keyPress = DevelKeyEvent::New(keyName, "", "", -1, 0, 0lu, Dali::KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
+ Dali::KeyEvent keyPress = DevelKeyEvent::New(keyName, "", "", -1, 0, 0lu, Dali::KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
return keyPress;
}
{
TestApplication application;
- for ( std::size_t i = 0; i < KEY_LOOKUP_COUNT; ++i )
+ for(std::size_t i = 0; i < KEY_LOOKUP_COUNT; ++i)
{
- tet_printf( "Checking %s", KeyLookupTable[i].keyName );
- DALI_TEST_CHECK( IsKey( GenerateKeyPress( KeyLookupTable[i].keyName ), KeyLookupTable[i].daliKeyCode ) );
+ tet_printf("Checking %s", KeyLookupTable[i].keyName);
+ DALI_TEST_CHECK(IsKey(GenerateKeyPress(KeyLookupTable[i].keyName), KeyLookupTable[i].daliKeyCode));
}
END_TEST;
}
TestApplication application;
// Random value
- DALI_TEST_CHECK( IsKey( GenerateKeyPress( "invalid-key-name" ), DALI_KEY_MUTE ) == false );
+ DALI_TEST_CHECK(IsKey(GenerateKeyPress("invalid-key-name"), DALI_KEY_MUTE) == false);
// Compare with another key value
- for ( std::size_t i = 0; i < KEY_LOOKUP_COUNT; ++i )
+ for(std::size_t i = 0; i < KEY_LOOKUP_COUNT; ++i)
{
- tet_printf( "Checking %s", KeyLookupTable[i].keyName );
- DALI_TEST_CHECK( IsKey( GenerateKeyPress( KeyLookupTable[i].keyName ), KeyLookupTable[ ( i + 1 ) % KEY_LOOKUP_COUNT ].daliKeyCode ) == false );
+ tet_printf("Checking %s", KeyLookupTable[i].keyName);
+ DALI_TEST_CHECK(IsKey(GenerateKeyPress(KeyLookupTable[i].keyName), KeyLookupTable[(i + 1) % KEY_LOOKUP_COUNT].daliKeyCode) == false);
}
END_TEST;
}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// EXTERNAL INCLUDES
-#include <map>
#include <string.h>
#include <iostream>
+#include <map>
// CLASS HEADER
-#include <stdlib.h>
-#include <iostream>
-#include <dali.h>
#include <dali-test-suite-utils.h>
+#include <dali.h>
#include <dali/public-api/adaptor-framework/key-grab.h>
+#include <stdlib.h>
+#include <iostream>
-extern int gArgc;
-extern char ** gArgv;
+extern int gArgc;
+extern char** gArgv;
using namespace Dali;
};
// Taken from key-impl.cpp
-KeyLookup TestKeyLookupTable[]=
-{
- { "Escape", DALI_KEY_ESCAPE, false }, // item not defined in utilX
- { "Menu", DALI_KEY_MENU, false }, // item not defined in utilX
-
- // Now the key names are used as literal string not defined symbols,
- // since these definition in utilX.h is deprecated and we're guided not to use them
- { "XF86Camera", DALI_KEY_CAMERA, false },
- { "XF86Camera_Full", DALI_KEY_CONFIG, false },
- { "XF86PowerOff", DALI_KEY_POWER, true },
- { "Cancel", DALI_KEY_CANCEL, false },
- { "XF86AudioPlay", DALI_KEY_PLAY_CD, false },
- { "XF86AudioStop", DALI_KEY_STOP_CD, false },
- { "XF86AudioPause", DALI_KEY_PAUSE_CD, false },
- { "XF86AudioNext", DALI_KEY_NEXT_SONG, false },
- { "XF86AudioPrev", DALI_KEY_PREVIOUS_SONG, false },
- { "XF86AudioRewind", DALI_KEY_REWIND, false },
- { "XF86AudioForward", DALI_KEY_FASTFORWARD, false },
- { "XF86AudioMedia", DALI_KEY_MEDIA, false },
- { "XF86AudioPlayPause", DALI_KEY_PLAY_PAUSE, false },
- { "XF86AudioMute", DALI_KEY_MUTE, false },
- { "XF86Menu", DALI_KEY_MENU, true },
- { "XF86Send", DALI_KEY_MENU, true },
- { "XF86HomePage", DALI_KEY_HOMEPAGE, false },
- { "XF86WWW", DALI_KEY_WEBPAGE, false },
- { "XF86Mail", DALI_KEY_MAIL, false },
- { "XF86ScreenSaver", DALI_KEY_SCREENSAVER, false },
- { "XF86MonBrightnessUp", DALI_KEY_BRIGHTNESS_UP, false },
- { "XF86MonBrightnessDown", DALI_KEY_BRIGHTNESS_DOWN, false },
- { "XF86SoftKBD", DALI_KEY_SOFT_KBD, false },
- { "XF86QuickPanel", DALI_KEY_QUICK_PANEL, false },
- { "XF86TaskPane", DALI_KEY_TASK_SWITCH, false },
- { "XF86Apps", DALI_KEY_APPS, false },
- { "XF86Search", DALI_KEY_SEARCH, false },
- { "XF86Voice", DALI_KEY_VOICE, false },
- { "Hangul", DALI_KEY_LANGUAGE, false },
- { "XF86AudioRaiseVolume", DALI_KEY_VOLUME_UP, true },
- { "XF86AudioLowerVolume", DALI_KEY_VOLUME_DOWN, true },
-
- { "BackSpace", DALI_KEY_BACKSPACE, false },
- { "Left", DALI_KEY_CURSOR_LEFT, false },
- { "Right", DALI_KEY_CURSOR_RIGHT, false }
-};
-
-const std::size_t KEY_LOOKUP_COUNT = (sizeof( TestKeyLookupTable))/ (sizeof(KeyLookup));
+KeyLookup TestKeyLookupTable[] =
+ {
+ {"Escape", DALI_KEY_ESCAPE, false}, // item not defined in utilX
+ {"Menu", DALI_KEY_MENU, false}, // item not defined in utilX
+
+ // Now the key names are used as literal string not defined symbols,
+ // since these definition in utilX.h is deprecated and we're guided not to use them
+ {"XF86Camera", DALI_KEY_CAMERA, false},
+ {"XF86Camera_Full", DALI_KEY_CONFIG, false},
+ {"XF86PowerOff", DALI_KEY_POWER, true},
+ {"Cancel", DALI_KEY_CANCEL, false},
+ {"XF86AudioPlay", DALI_KEY_PLAY_CD, false},
+ {"XF86AudioStop", DALI_KEY_STOP_CD, false},
+ {"XF86AudioPause", DALI_KEY_PAUSE_CD, false},
+ {"XF86AudioNext", DALI_KEY_NEXT_SONG, false},
+ {"XF86AudioPrev", DALI_KEY_PREVIOUS_SONG, false},
+ {"XF86AudioRewind", DALI_KEY_REWIND, false},
+ {"XF86AudioForward", DALI_KEY_FASTFORWARD, false},
+ {"XF86AudioMedia", DALI_KEY_MEDIA, false},
+ {"XF86AudioPlayPause", DALI_KEY_PLAY_PAUSE, false},
+ {"XF86AudioMute", DALI_KEY_MUTE, false},
+ {"XF86Menu", DALI_KEY_MENU, true},
+ {"XF86Send", DALI_KEY_MENU, true},
+ {"XF86HomePage", DALI_KEY_HOMEPAGE, false},
+ {"XF86WWW", DALI_KEY_WEBPAGE, false},
+ {"XF86Mail", DALI_KEY_MAIL, false},
+ {"XF86ScreenSaver", DALI_KEY_SCREENSAVER, false},
+ {"XF86MonBrightnessUp", DALI_KEY_BRIGHTNESS_UP, false},
+ {"XF86MonBrightnessDown", DALI_KEY_BRIGHTNESS_DOWN, false},
+ {"XF86SoftKBD", DALI_KEY_SOFT_KBD, false},
+ {"XF86QuickPanel", DALI_KEY_QUICK_PANEL, false},
+ {"XF86TaskPane", DALI_KEY_TASK_SWITCH, false},
+ {"XF86Apps", DALI_KEY_APPS, false},
+ {"XF86Search", DALI_KEY_SEARCH, false},
+ {"XF86Voice", DALI_KEY_VOICE, false},
+ {"Hangul", DALI_KEY_LANGUAGE, false},
+ {"XF86AudioRaiseVolume", DALI_KEY_VOLUME_UP, true},
+ {"XF86AudioLowerVolume", DALI_KEY_VOLUME_DOWN, true},
+
+ {"BackSpace", DALI_KEY_BACKSPACE, false},
+ {"Left", DALI_KEY_CURSOR_LEFT, false},
+ {"Right", DALI_KEY_CURSOR_RIGHT, false}};
+
+const std::size_t KEY_LOOKUP_COUNT = (sizeof(TestKeyLookupTable)) / (sizeof(KeyLookup));
enum TEST_TYPE
{
struct MyTestApp : public ConnectionTracker
{
- MyTestApp( Application& app, int type )
- : mApplication( app ),
- mTestType( type )
+ MyTestApp(Application& app, int type)
+ : mApplication(app),
+ mTestType(type)
{
- mApplication.InitSignal().Connect( this, &MyTestApp::OnInit );
+ mApplication.InitSignal().Connect(this, &MyTestApp::OnInit);
}
void OnInit(Application& app)
{
- mTimer = Timer::New( 500 );
- mTimer.TickSignal().Connect( this, &MyTestApp::Tick );
+ mTimer = Timer::New(500);
+ mTimer.TickSignal().Connect(this, &MyTestApp::Tick);
mTimer.Start();
ExcuteTest();
void ExcuteTest()
{
- switch (mTestType)
+ switch(mTestType)
{
case GRAB_KEY_TOPMOST_P:
TestGrabKeyTopmostP();
void TestGrabKeyTopmostP()
{
- for ( std::size_t i = 0; i < KEY_LOOKUP_COUNT; ++i )
+ for(std::size_t i = 0; i < KEY_LOOKUP_COUNT; ++i)
{
- DALI_TEST_CHECK( KeyGrab::GrabKeyTopmost( mApplication.GetWindow(), TestKeyLookupTable[i].daliKeyCode ) );
+ DALI_TEST_CHECK(KeyGrab::GrabKeyTopmost(mApplication.GetWindow(), TestKeyLookupTable[i].daliKeyCode));
}
}
void TestUngrabKeyTopmostP()
{
- for ( std::size_t i = 0; i < KEY_LOOKUP_COUNT; ++i )
+ for(std::size_t i = 0; i < KEY_LOOKUP_COUNT; ++i)
{
- DALI_TEST_CHECK( KeyGrab::GrabKeyTopmost( mApplication.GetWindow(), TestKeyLookupTable[i].daliKeyCode ) );
- DALI_TEST_CHECK( KeyGrab::UngrabKeyTopmost( mApplication.GetWindow(), TestKeyLookupTable[i].daliKeyCode ) );
+ DALI_TEST_CHECK(KeyGrab::GrabKeyTopmost(mApplication.GetWindow(), TestKeyLookupTable[i].daliKeyCode));
+ DALI_TEST_CHECK(KeyGrab::UngrabKeyTopmost(mApplication.GetWindow(), TestKeyLookupTable[i].daliKeyCode));
}
}
// Data
Application& mApplication;
- int mTestType;
- Timer mTimer;
+ int mTestType;
+ Timer mTimer;
};
int UtcDaliKeyGrabGrabKeyTopmostP(void)
{
- Application application = Application::New( &gArgc, &gArgv );
- MyTestApp testApp( application, GRAB_KEY_TOPMOST_P );
+ Application application = Application::New(&gArgc, &gArgv);
+ MyTestApp testApp(application, GRAB_KEY_TOPMOST_P);
application.MainLoop();
END_TEST;
}
int UtcDaliKeyGrabUngrabKeyTopmostP(void)
{
- Application application = Application::New( &gArgc, &gArgv );
- MyTestApp testApp( application, UNGRAB_KEY_TOPMOST_P );
+ Application application = Application::New(&gArgc, &gArgv);
+ MyTestApp testApp(application, UNGRAB_KEY_TOPMOST_P);
application.MainLoop();
END_TEST;
}
*
*/
-#include <dali/dali.h>
#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
using namespace Dali;
-
void utc_dali_native_image_source_startup(void)
{
test_return_value = TET_UNDEF;
int UtcDaliNativeImageSourceNewN(void)
{
- unsigned int width = 256u;
+ unsigned int width = 256u;
unsigned int heigth = 256u;
try
{
- NativeImageSourcePtr nativeImageSource = NativeImageSource::New(width, heigth, NativeImageSource::COLOR_DEPTH_DEFAULT );
+ NativeImageSourcePtr nativeImageSource = NativeImageSource::New(width, heigth, NativeImageSource::COLOR_DEPTH_DEFAULT);
}
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);
}
* limitations under the License.
*/
-#include <dali/dali.h>
#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
#include "mesh-builder.h"
using namespace Dali;
{
TestApplication application;
- unsigned int width = 20u;
- unsigned int height = 20u;
- Devel::PixelBuffer imageData = Devel::PixelBuffer::New( width, height, Pixel::RGB888 );
+ unsigned int width = 20u;
+ unsigned int height = 20u;
+ Devel::PixelBuffer imageData = Devel::PixelBuffer::New(width, height, Pixel::RGB888);
PixelData pixelData = imageData.CreatePixelData();
- DALI_TEST_EQUALS( true, (bool)pixelData, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, (bool)pixelData, TEST_LOCATION);
END_TEST;
}
-
-void Mask1stQuadrant( Devel::PixelBuffer maskData )
+void Mask1stQuadrant(Devel::PixelBuffer maskData)
{
- int width = maskData.GetWidth();
- int height = maskData.GetHeight();
+ int width = maskData.GetWidth();
+ int height = maskData.GetHeight();
Pixel::Format pixelFormat = maskData.GetPixelFormat();
- int bpp = Pixel::GetBytesPerPixel(pixelFormat);
+ int bpp = Pixel::GetBytesPerPixel(pixelFormat);
unsigned char* maskBuffer = maskData.GetBuffer();
- memset( maskBuffer, 0, width*height*bpp );
- int offset=0;
- for( int x=0; x<width; ++x)
+ memset(maskBuffer, 0, width * height * bpp);
+ int offset = 0;
+ for(int x = 0; x < width; ++x)
{
- for( int y=0; y<height; ++y)
+ for(int y = 0; y < height; ++y)
{
- if(x>=width/2 || y>=height/2)
+ if(x >= width / 2 || y >= height / 2)
{
- for(int b=0;b<bpp;++b)
+ for(int b = 0; b < bpp; ++b)
{
- maskBuffer[offset+b] = 0xff;
+ maskBuffer[offset + b] = 0xff;
}
}
- offset+=bpp;
+ offset += bpp;
}
}
}
-void MaskCenterSquare( Devel::PixelBuffer maskData )
+void MaskCenterSquare(Devel::PixelBuffer maskData)
{
- int width = maskData.GetWidth();
- int height = maskData.GetHeight();
+ int width = maskData.GetWidth();
+ int height = maskData.GetHeight();
Pixel::Format pixelFormat = maskData.GetPixelFormat();
- int bpp = Pixel::GetBytesPerPixel(pixelFormat);
+ int bpp = Pixel::GetBytesPerPixel(pixelFormat);
unsigned char* maskBuffer = maskData.GetBuffer();
- memset( maskBuffer, 0, width*height*bpp );
- int offset=0;
- for( int y=0; y<height; ++y)
+ memset(maskBuffer, 0, width * height * bpp);
+ int offset = 0;
+ for(int y = 0; y < height; ++y)
{
- for( int x=0; x<width; ++x)
+ for(int x = 0; x < width; ++x)
{
- if(x>=width/4 && x<3*width/4 &&
- y>=height/4 && y<3*height/4 )
+ if(x >= width / 4 && x < 3 * width / 4 &&
+ y >= height / 4 && y < 3 * height / 4)
{
- for(int b=0;b<bpp;++b)
+ for(int b = 0; b < bpp; ++b)
{
- maskBuffer[offset+b] = 0xff;
+ maskBuffer[offset + b] = 0xff;
}
}
- offset+=bpp;
+ offset += bpp;
}
}
}
-void AlternateQuadrants( Devel::PixelBuffer buffer )
+void AlternateQuadrants(Devel::PixelBuffer buffer)
{
- int width = buffer.GetWidth();
- int height = buffer.GetHeight();
+ int width = buffer.GetWidth();
+ int height = buffer.GetHeight();
Pixel::Format pixelFormat = buffer.GetPixelFormat();
- int bpp = Pixel::GetBytesPerPixel(pixelFormat);
- int stride=width*bpp;
+ int bpp = Pixel::GetBytesPerPixel(pixelFormat);
+ int stride = width * bpp;
unsigned char* pixels = buffer.GetBuffer();
- memset( pixels, 0, width*height*bpp );
+ memset(pixels, 0, width * height * bpp);
- for( int x=0; x<width; ++x)
+ for(int x = 0; x < width; ++x)
{
- for( int y=0; y<height; ++y)
+ for(int y = 0; y < height; ++y)
{
- if( ( x < width/2 && y >= height/2 ) ||
- ( x >= width/2 && y < height/2 ) )
+ if((x < width / 2 && y >= height / 2) ||
+ (x >= width / 2 && y < height / 2))
{
- for(int b=0;b<bpp;++b)
+ for(int b = 0; b < bpp; ++b)
{
- pixels[y*stride+x*bpp+b] = 0xff;
+ pixels[y * stride + x * bpp + b] = 0xff;
}
}
}
}
}
-
-void FillCheckerboard( Devel::PixelBuffer imageData )
+void FillCheckerboard(Devel::PixelBuffer imageData)
{
- int width = imageData.GetWidth();
- int height = imageData.GetHeight();
+ int width = imageData.GetWidth();
+ int height = imageData.GetHeight();
Pixel::Format pixelFormat = imageData.GetPixelFormat();
- int bpp = Pixel::GetBytesPerPixel(pixelFormat);
+ int bpp = Pixel::GetBytesPerPixel(pixelFormat);
unsigned char* imageBuffer = imageData.GetBuffer();
- memset( imageBuffer, 0, width*height*bpp );
- int offset=0;
- for( int x=0; x<width; ++x)
+ memset(imageBuffer, 0, width * height * bpp);
+ int offset = 0;
+ for(int x = 0; x < width; ++x)
{
- for( int y=0; y<height; ++y)
+ for(int y = 0; y < height; ++y)
{
// on even lines, odd pixels, or on odd lines, even pixels
- if( (x%2 && y%2==0) || (x%2==0 && y%2) )
+ if((x % 2 && y % 2 == 0) || (x % 2 == 0 && y % 2))
{
switch(pixelFormat)
{
case Pixel::RGBA5551:
- imageBuffer[offset] = 0xFF;
- imageBuffer[offset+1] = 0xFF;
+ imageBuffer[offset] = 0xFF;
+ imageBuffer[offset + 1] = 0xFF;
break;
case Pixel::RGBA4444:
- imageBuffer[offset] = 0xFF;
- imageBuffer[offset+1] = 0xFF;
+ imageBuffer[offset] = 0xFF;
+ imageBuffer[offset + 1] = 0xFF;
break;
case Pixel::RGB565:
- imageBuffer[offset] = 0xFF;
- imageBuffer[offset+1] = 0xFF;
+ imageBuffer[offset] = 0xFF;
+ imageBuffer[offset + 1] = 0xFF;
break;
case Pixel::RGB888:
- imageBuffer[offset] = 0xFF;
- imageBuffer[offset+1] = 0xFF;
- imageBuffer[offset+2] = 0xFF;
+ imageBuffer[offset] = 0xFF;
+ imageBuffer[offset + 1] = 0xFF;
+ imageBuffer[offset + 2] = 0xFF;
break;
case Pixel::RGBA8888:
- imageBuffer[offset] = 0xFF;
- imageBuffer[offset+1] = 0xFF;
- imageBuffer[offset+2] = 0xFF;
- imageBuffer[offset+3] = 0xFF;
+ imageBuffer[offset] = 0xFF;
+ imageBuffer[offset + 1] = 0xFF;
+ imageBuffer[offset + 2] = 0xFF;
+ imageBuffer[offset + 3] = 0xFF;
break;
default:
break;
}
}
- offset+=bpp;
+ offset += bpp;
}
}
}
-int GetAlphaAt( Devel::PixelBuffer buffer, int x, int y )
+int GetAlphaAt(Devel::PixelBuffer buffer, int x, int y)
{
unsigned char* pixels = buffer.GetBuffer();
- int bpp = Pixel::GetBytesPerPixel(buffer.GetPixelFormat());
- int stride = buffer.GetWidth() * bpp;
- int byteOffset;
- int bitMask;
- GetAlphaOffsetAndMask( buffer.GetPixelFormat(), byteOffset, bitMask );
- return int(pixels[stride * y + x*bpp + byteOffset]) & bitMask;
+ int bpp = Pixel::GetBytesPerPixel(buffer.GetPixelFormat());
+ int stride = buffer.GetWidth() * bpp;
+ int byteOffset;
+ int bitMask;
+ GetAlphaOffsetAndMask(buffer.GetPixelFormat(), byteOffset, bitMask);
+ return int(pixels[stride * y + x * bpp + byteOffset]) & bitMask;
}
int UtcDaliPixelBufferNew01P(void)
{
- TestApplication application;
- Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New( 10, 10, Pixel::RGBA8888 );
- DALI_TEST_CHECK( pixbuf );
- DALI_TEST_CHECK( pixbuf.GetBuffer() != NULL );
+ TestApplication application;
+ Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New(10, 10, Pixel::RGBA8888);
+ DALI_TEST_CHECK(pixbuf);
+ DALI_TEST_CHECK(pixbuf.GetBuffer() != NULL);
END_TEST;
}
int UtcDaliPixelBufferNew01N(void)
{
- TestApplication application;
- Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New( 0, 0, Pixel::RGBA8888 );
- DALI_TEST_CHECK( pixbuf );
- DALI_TEST_CHECK( pixbuf.GetBuffer() == NULL );
+ TestApplication application;
+ Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New(0, 0, Pixel::RGBA8888);
+ DALI_TEST_CHECK(pixbuf);
+ DALI_TEST_CHECK(pixbuf.GetBuffer() == NULL);
END_TEST;
}
int UtcDaliPixelBufferConvert(void)
{
- TestApplication application;
- TestGlAbstraction& gl=application.GetGlAbstraction();
- TraceCallStack& textureTrace=gl.GetTextureTrace();
+ TestApplication application;
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
textureTrace.Enable(true);
- Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New( 10, 10, Pixel::RGB565 );
+ Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New(10, 10, Pixel::RGB565);
FillCheckerboard(pixbuf);
{
Devel::PixelBuffer pixbufPrime = pixbuf; // store a second handle to the data
- Dali::PixelData pixelData = Devel::PixelBuffer::Convert( pixbuf );
- DALI_TEST_CHECK( !pixbuf );
+ Dali::PixelData pixelData = Devel::PixelBuffer::Convert(pixbuf);
+ DALI_TEST_CHECK(!pixbuf);
// check the buffer in the second handle is empty
- DALI_TEST_CHECK( pixbufPrime.GetBuffer() == NULL );
+ DALI_TEST_CHECK(pixbufPrime.GetBuffer() == NULL);
- DALI_TEST_CHECK( pixelData );
- DALI_TEST_EQUALS( pixelData.GetWidth(), 10, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelData.GetHeight(), 10, TEST_LOCATION );
- DALI_TEST_EQUALS( pixelData.GetPixelFormat(), Pixel::RGB565, TEST_LOCATION );
+ DALI_TEST_CHECK(pixelData);
+ DALI_TEST_EQUALS(pixelData.GetWidth(), 10, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelData.GetHeight(), 10, TEST_LOCATION);
+ DALI_TEST_EQUALS(pixelData.GetPixelFormat(), Pixel::RGB565, TEST_LOCATION);
// Try drawing it
Texture t = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB565, 10, 10);
- t.Upload( pixelData );
+ t.Upload(pixelData);
TextureSet ts = TextureSet::New();
ts.SetTexture(0, t);
Geometry g = CreateQuadGeometry();
- Shader s = Shader::New("v", "f");
- Renderer r = Renderer::New( g, s );
+ Shader s = Shader::New("v", "f");
+ Renderer r = Renderer::New(g, s);
r.SetTextures(ts);
Actor a = Actor::New();
a.AddRenderer(r);
- a.SetProperty( Actor::Property::SIZE, Vector2(10, 10) );
- a.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ a.SetProperty(Actor::Property::SIZE, Vector2(10, 10));
+ a.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
application.GetScene().Add(a);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION);
// Let secondary scope destroy pixbufPrime
}
int UtcDaliPixelBufferGetWidth(void)
{
- TestApplication application;
- Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New( 10, 10, Pixel::RGB565 );
+ TestApplication application;
+ Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New(10, 10, Pixel::RGB565);
FillCheckerboard(pixbuf);
- DALI_TEST_EQUALS( pixbuf.GetWidth(), 10, TEST_LOCATION ) ;
+ DALI_TEST_EQUALS(pixbuf.GetWidth(), 10, TEST_LOCATION);
END_TEST;
}
int UtcDaliPixelBufferGetHeight(void)
{
- TestApplication application;
- Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New( 10, 10, Pixel::RGB565 );
+ TestApplication application;
+ Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New(10, 10, Pixel::RGB565);
FillCheckerboard(pixbuf);
- DALI_TEST_EQUALS( pixbuf.GetHeight(), 10, TEST_LOCATION ) ;
+ DALI_TEST_EQUALS(pixbuf.GetHeight(), 10, TEST_LOCATION);
END_TEST;
}
int UtcDaliPixelBufferGetPixelFormat(void)
{
- TestApplication application;
- Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New( 10, 10, Pixel::RGB565 );
+ TestApplication application;
+ Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New(10, 10, Pixel::RGB565);
FillCheckerboard(pixbuf);
- DALI_TEST_EQUALS( pixbuf.GetPixelFormat(), Pixel::RGB565, TEST_LOCATION ) ;
+ DALI_TEST_EQUALS(pixbuf.GetPixelFormat(), Pixel::RGB565, TEST_LOCATION);
END_TEST;
}
-
-
int UtcDaliPixelBufferMask01(void)
{
TestApplication application;
- unsigned int width = 10u;
- unsigned int height = 10u;
- Pixel::Format pixelFormat = Pixel::L8;
- Devel::PixelBuffer maskData = Devel::PixelBuffer::New( width, height, pixelFormat );
+ unsigned int width = 10u;
+ unsigned int height = 10u;
+ Pixel::Format pixelFormat = Pixel::L8;
+ Devel::PixelBuffer maskData = Devel::PixelBuffer::New(width, height, pixelFormat);
Mask1stQuadrant(maskData);
- width = 20u;
- height = 20u;
+ width = 20u;
+ height = 20u;
pixelFormat = Pixel::RGBA5551;
- Devel::PixelBuffer imageData = Devel::PixelBuffer::New( width, height, pixelFormat );
+ Devel::PixelBuffer imageData = Devel::PixelBuffer::New(width, height, pixelFormat);
FillCheckerboard(imageData);
- imageData.ApplyMask( maskData, 1.0f, false );
+ imageData.ApplyMask(maskData, 1.0f, false);
// Test that the pixel format has been promoted to RGBA8888
- DALI_TEST_EQUALS( imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION );
+ DALI_TEST_EQUALS(imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION);
// Test that a pixel in the first quadrant has no alpha value
unsigned char* buffer = imageData.GetBuffer();
- DALI_TEST_EQUALS( buffer[3], 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( buffer[7], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[3], 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(buffer[7], 0x00u, TEST_LOCATION);
// Test that an even pixel in the second quadrant has a full alpha value
- DALI_TEST_EQUALS( buffer[43], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[43], 0x00u, TEST_LOCATION);
// Test that an odd pixel in the second quadrant has full alpha value
- DALI_TEST_EQUALS( buffer[47], 0xffu, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[47], 0xffu, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliPixelBufferMask02(void)
{
TestApplication application;
- unsigned int width = 10u;
- unsigned int height = 10u;
- Pixel::Format pixelFormat = Pixel::L8;
- Devel::PixelBuffer maskData = Devel::PixelBuffer::New( width, height, pixelFormat );
+ unsigned int width = 10u;
+ unsigned int height = 10u;
+ Pixel::Format pixelFormat = Pixel::L8;
+ Devel::PixelBuffer maskData = Devel::PixelBuffer::New(width, height, pixelFormat);
Mask1stQuadrant(maskData);
- width = 20u;
- height = 20u;
+ width = 20u;
+ height = 20u;
pixelFormat = Pixel::RGBA4444;
- Devel::PixelBuffer imageData = Devel::PixelBuffer::New( width, height, pixelFormat );
+ Devel::PixelBuffer imageData = Devel::PixelBuffer::New(width, height, pixelFormat);
FillCheckerboard(imageData);
- imageData.ApplyMask( maskData, 1.0f, false );
+ imageData.ApplyMask(maskData, 1.0f, false);
// Test that the pixel format has been promoted to RGBA8888
- DALI_TEST_EQUALS( imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION );
+ DALI_TEST_EQUALS(imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION);
// Test that a pixel in the first quadrant has no alpha value
unsigned char* buffer = imageData.GetBuffer();
- DALI_TEST_EQUALS( buffer[3], 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( buffer[7], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[3], 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(buffer[7], 0x00u, TEST_LOCATION);
// Test that an even pixel in the second quadrant has no alpha value
- DALI_TEST_EQUALS( buffer[43], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[43], 0x00u, TEST_LOCATION);
// Test that an odd pixel in the second quadrant has full alpha value
- DALI_TEST_EQUALS( buffer[47], 0xffu, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[47], 0xffu, TEST_LOCATION);
END_TEST;
}
TestApplication application;
tet_infoline("Test application of alpha mask to smaller RGB565 image");
- unsigned int width = 20u;
- unsigned int height = 20u;
- Devel::PixelBuffer maskData = Devel::PixelBuffer::New( width, height, Pixel::L8 );
+ unsigned int width = 20u;
+ unsigned int height = 20u;
+ Devel::PixelBuffer maskData = Devel::PixelBuffer::New(width, height, Pixel::L8);
Mask1stQuadrant(maskData);
- width = 10u;
- height = 10u;
- Pixel::Format format = Pixel::RGB565;
- Devel::PixelBuffer imageData = Devel::PixelBuffer::New( width, height, format );
+ width = 10u;
+ height = 10u;
+ Pixel::Format format = Pixel::RGB565;
+ Devel::PixelBuffer imageData = Devel::PixelBuffer::New(width, height, format);
FillCheckerboard(imageData);
- imageData.ApplyMask( maskData, 1.0f, false );
+ imageData.ApplyMask(maskData, 1.0f, false);
// Test that the pixel format has been promoted to RGBA8888
- DALI_TEST_EQUALS( imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION );
+ DALI_TEST_EQUALS(imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION);
// Test that a pixel in the first quadrant has no alpha value
unsigned char* buffer = imageData.GetBuffer();
- DALI_TEST_EQUALS( buffer[3], 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( buffer[7], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[3], 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(buffer[7], 0x00u, TEST_LOCATION);
// Test that an odd pixel in the fourth quadrant has full alpha value
- DALI_TEST_EQUALS( buffer[(6*10+7)*4+3], 0xffu, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[(6 * 10 + 7) * 4 + 3], 0xffu, TEST_LOCATION);
// Test that an even pixel in the fourth quadrant has full alpha value
- DALI_TEST_EQUALS( buffer[(6*10+8)*4+3], 0xffu, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[(6 * 10 + 8) * 4 + 3], 0xffu, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliPixelBufferMask04(void)
{
TestApplication application;
tet_infoline("Test application of alpha mask to larger RGBA8888 image");
- unsigned int width = 10u;
- unsigned int height = 10u;
- Devel::PixelBuffer maskData = Devel::PixelBuffer::New( width, height, Pixel::L8 );
+ unsigned int width = 10u;
+ unsigned int height = 10u;
+ Devel::PixelBuffer maskData = Devel::PixelBuffer::New(width, height, Pixel::L8);
Mask1stQuadrant(maskData);
- width = 20u;
- height = 20u;
- Devel::PixelBuffer imageData = Devel::PixelBuffer::New( width, height, Pixel::RGBA8888 );
+ width = 20u;
+ height = 20u;
+ Devel::PixelBuffer imageData = Devel::PixelBuffer::New(width, height, Pixel::RGBA8888);
FillCheckerboard(imageData);
- imageData.ApplyMask( maskData, 1.0f, false );
+ imageData.ApplyMask(maskData, 1.0f, false);
// Test that the pixel format has been promoted to RGBA8888
- DALI_TEST_EQUALS( imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION );
+ DALI_TEST_EQUALS(imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION);
// Test that a pixel in the first quadrant has no alpha value
unsigned char* buffer = imageData.GetBuffer();
- DALI_TEST_EQUALS( buffer[3], 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( buffer[7], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[3], 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(buffer[7], 0x00u, TEST_LOCATION);
// Test that an even pixel in the second quadrant has no alpha value
- DALI_TEST_EQUALS( buffer[43], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[43], 0x00u, TEST_LOCATION);
// Test that an odd pixel in the second quadrant has full alpha value
- DALI_TEST_EQUALS( buffer[47], 0xffu, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[47], 0xffu, TEST_LOCATION);
END_TEST;
}
TestApplication application;
tet_infoline("Test application of alpha mask to smaller RGBA8888 image");
- unsigned int width = 20u;
- unsigned int height = 20u;
- Devel::PixelBuffer maskData = Devel::PixelBuffer::New( width, height, Pixel::RGBA8888 );
+ unsigned int width = 20u;
+ unsigned int height = 20u;
+ Devel::PixelBuffer maskData = Devel::PixelBuffer::New(width, height, Pixel::RGBA8888);
Mask1stQuadrant(maskData);
- width = 10u;
- height = 10u;
- Devel::PixelBuffer imageData = Devel::PixelBuffer::New( width, height, Pixel::RGBA8888 );
+ width = 10u;
+ height = 10u;
+ Devel::PixelBuffer imageData = Devel::PixelBuffer::New(width, height, Pixel::RGBA8888);
FillCheckerboard(imageData);
- imageData.ApplyMask( maskData, 1.0f, false );
+ imageData.ApplyMask(maskData, 1.0f, false);
// Test that the pixel format has been promoted to RGBA8888
- DALI_TEST_EQUALS( imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION );
+ DALI_TEST_EQUALS(imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION);
// Test that a pixel in the first quadrant has no alpha value
unsigned char* buffer = imageData.GetBuffer();
- DALI_TEST_EQUALS( buffer[3], 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( buffer[7], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[3], 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(buffer[7], 0x00u, TEST_LOCATION);
// Test that an odd pixel in the second quadrant has full alpha value
- DALI_TEST_EQUALS( buffer[39], 0xffu, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[39], 0xffu, TEST_LOCATION);
// Test that an even pixel in the second quadrant has no alpha value
- DALI_TEST_EQUALS( buffer[27], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[27], 0x00u, TEST_LOCATION);
END_TEST;
}
TestApplication application;
tet_infoline("Test application of alpha mask to same size RGBA8888 image");
- unsigned int width = 10u;
- unsigned int height = 10u;
- Devel::PixelBuffer maskData = Devel::PixelBuffer::New( width, height, Pixel::RGBA8888 );
+ unsigned int width = 10u;
+ unsigned int height = 10u;
+ Devel::PixelBuffer maskData = Devel::PixelBuffer::New(width, height, Pixel::RGBA8888);
Mask1stQuadrant(maskData);
- width = 10u;
- height = 10u;
- Devel::PixelBuffer imageData = Devel::PixelBuffer::New( width, height, Pixel::RGBA8888 );
+ width = 10u;
+ height = 10u;
+ Devel::PixelBuffer imageData = Devel::PixelBuffer::New(width, height, Pixel::RGBA8888);
FillCheckerboard(imageData);
- imageData.ApplyMask( maskData, 1.0f, false );
+ imageData.ApplyMask(maskData, 1.0f, false);
// Test that the pixel format has been promoted to RGBA8888
- DALI_TEST_EQUALS( imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION );
+ DALI_TEST_EQUALS(imageData.GetPixelFormat(), Pixel::RGBA8888, TEST_LOCATION);
// Test that a pixel in the first quadrant has no alpha value
unsigned char* buffer = imageData.GetBuffer();
- DALI_TEST_EQUALS( buffer[3], 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( buffer[7], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[3], 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(buffer[7], 0x00u, TEST_LOCATION);
// Test that an odd pixel in the second quadrant has full alpha value
- DALI_TEST_EQUALS( buffer[39], 0xffu, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[39], 0xffu, TEST_LOCATION);
// Test that an even pixel in the second quadrant has no alpha value
- DALI_TEST_EQUALS( buffer[27], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[27], 0x00u, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliPixelBufferMask07(void)
{
TestApplication application;
- tet_infoline("Test scaling of source image to match alpha mask" );
+ tet_infoline("Test scaling of source image to match alpha mask");
- unsigned int width = 20u;
- unsigned int height = 20u;
- Devel::PixelBuffer maskData = Devel::PixelBuffer::New( width, height, Pixel::RGBA8888 );
+ unsigned int width = 20u;
+ unsigned int height = 20u;
+ Devel::PixelBuffer maskData = Devel::PixelBuffer::New(width, height, Pixel::RGBA8888);
MaskCenterSquare(maskData);
// +----------+
// | XXXXXX |
// *----------+
- width = 10u;
- height = 10u;
- Devel::PixelBuffer imageData = Devel::PixelBuffer::New( width, height, Pixel::RGBA8888 );
- AlternateQuadrants( imageData );
+ width = 10u;
+ height = 10u;
+ Devel::PixelBuffer imageData = Devel::PixelBuffer::New(width, height, Pixel::RGBA8888);
+ AlternateQuadrants(imageData);
// +-----XXXXX+
// | XXXXX|
// |XXXXX |
// *XXXXX-----+
- imageData.ApplyMask( maskData, 2.0f, true );
+ imageData.ApplyMask(maskData, 2.0f, true);
// +----------+
// | XXX |
// | XXX |
// *----------+
- tet_infoline("Test that the image has been scaled to match the alpha mask" );
- DALI_TEST_EQUALS( imageData.GetWidth(), 20, TEST_LOCATION );
- DALI_TEST_EQUALS( imageData.GetHeight(), 20, TEST_LOCATION );
+ tet_infoline("Test that the image has been scaled to match the alpha mask");
+ DALI_TEST_EQUALS(imageData.GetWidth(), 20, TEST_LOCATION);
+ DALI_TEST_EQUALS(imageData.GetHeight(), 20, TEST_LOCATION);
- tet_infoline( "Test that pixels in the outer eighths have no alpha\n" );
+ tet_infoline("Test that pixels in the outer eighths have no alpha\n");
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 0, 0), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 9, 4), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 15, 4), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 19, 4), 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 0, 0), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 9, 4), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 15, 4), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 19, 4), 0x00u, TEST_LOCATION);
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 0, 19), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 8, 18), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 15,17), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 19,16), 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 0, 19), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 8, 18), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 15, 17), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 19, 16), 0x00u, TEST_LOCATION);
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 0, 1), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 1, 7), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 2, 10), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 3, 19), 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 0, 1), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 1, 7), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 2, 10), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 3, 19), 0x00u, TEST_LOCATION);
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 19, 1), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 18, 7), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 17, 10), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 16, 19), 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 19, 1), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 18, 7), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 17, 10), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 16, 19), 0x00u, TEST_LOCATION);
- tet_infoline( "Test that pixels in the center have full alpha\n" );
+ tet_infoline("Test that pixels in the center have full alpha\n");
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 12, 8), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 8, 12), 0xffu, TEST_LOCATION );
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 12, 8), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 8, 12), 0xffu, TEST_LOCATION);
END_TEST;
}
int UtcDaliPixelBufferMask08(void)
{
TestApplication application;
- tet_infoline("Test scaling of source image to larger than the alpha mask" );
+ tet_infoline("Test scaling of source image to larger than the alpha mask");
- unsigned int width = 32u;
- unsigned int height = 20u;
- Devel::PixelBuffer maskData = Devel::PixelBuffer::New( width, height, Pixel::RGBA8888 );
- AlternateQuadrants( maskData );
+ unsigned int width = 32u;
+ unsigned int height = 20u;
+ Devel::PixelBuffer maskData = Devel::PixelBuffer::New(width, height, Pixel::RGBA8888);
+ AlternateQuadrants(maskData);
// +-----XXXXX+
// | XXXXX|
// |XXXXX |
// *XXXXX-----+
- width = 20u;
- height = 16u;
- Devel::PixelBuffer imageData = Devel::PixelBuffer::New( width, height, Pixel::RGBA8888 );
+ width = 20u;
+ height = 16u;
+ Devel::PixelBuffer imageData = Devel::PixelBuffer::New(width, height, Pixel::RGBA8888);
MaskCenterSquare(imageData);
// +----------+
// | XXXXXX |
// *----------+
- imageData.ApplyMask( maskData, 4.0f, true );
+ imageData.ApplyMask(maskData, 4.0f, true);
// +-----XXXXX+ quadrant
// | XXXXX| 1 2
// |XXXXX |
// *XXXXX-----+
- tet_infoline("Test that the image has been scaled and cropped to match the alpha mask" );
- DALI_TEST_EQUALS( imageData.GetWidth(), 32, TEST_LOCATION );
- DALI_TEST_EQUALS( imageData.GetHeight(), 20, TEST_LOCATION );
-
- tet_infoline( "Test that the image has been resized (the center square should now fill the image)\n");
- tet_infoline( "Test that the first quadrant has no alpha");
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 0, 0), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 5, 4), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 5, 8), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 14, 8), 0x00u, TEST_LOCATION );
-
- tet_infoline( "Test that the second quadrant has alpha and data");
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 18, 0), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 30, 1), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 30, 8), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 19, 8), 0xffu, TEST_LOCATION );
-
- tet_infoline( "Test that the third quadrant has no alpha");
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 18, 12), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 31, 12), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 31, 19), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 18, 19), 0x00u, TEST_LOCATION );
-
- tet_infoline( "Test that the fourth quadrant has alpha and data");
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 1, 12), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 7, 12), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 7, 19), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 1, 19), 0xffu, TEST_LOCATION );
+ tet_infoline("Test that the image has been scaled and cropped to match the alpha mask");
+ DALI_TEST_EQUALS(imageData.GetWidth(), 32, TEST_LOCATION);
+ DALI_TEST_EQUALS(imageData.GetHeight(), 20, TEST_LOCATION);
+
+ tet_infoline("Test that the image has been resized (the center square should now fill the image)\n");
+ tet_infoline("Test that the first quadrant has no alpha");
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 0, 0), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 5, 4), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 5, 8), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 14, 8), 0x00u, TEST_LOCATION);
+
+ tet_infoline("Test that the second quadrant has alpha and data");
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 18, 0), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 30, 1), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 30, 8), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 19, 8), 0xffu, TEST_LOCATION);
+
+ tet_infoline("Test that the third quadrant has no alpha");
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 18, 12), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 31, 12), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 31, 19), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 18, 19), 0x00u, TEST_LOCATION);
+
+ tet_infoline("Test that the fourth quadrant has alpha and data");
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 1, 12), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 7, 12), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 7, 19), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 1, 19), 0xffu, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliPixelBufferMask09(void)
{
TestApplication application;
- tet_infoline("Test scaling of large source image to larger than the alpha mask" );
+ tet_infoline("Test scaling of large source image to larger than the alpha mask");
- unsigned int width = 32u;
- unsigned int height = 20u;
- Devel::PixelBuffer maskData = Devel::PixelBuffer::New( width, height, Pixel::RGBA8888 );
- AlternateQuadrants( maskData );
+ unsigned int width = 32u;
+ unsigned int height = 20u;
+ Devel::PixelBuffer maskData = Devel::PixelBuffer::New(width, height, Pixel::RGBA8888);
+ AlternateQuadrants(maskData);
// +-----XXXXX+
// | XXXXX|
// |XXXXX |
// *XXXXX-----+
- width = 40u;
- height = 50u;
- Devel::PixelBuffer imageData = Devel::PixelBuffer::New( width, height, Pixel::RGBA8888 );
+ width = 40u;
+ height = 50u;
+ Devel::PixelBuffer imageData = Devel::PixelBuffer::New(width, height, Pixel::RGBA8888);
MaskCenterSquare(imageData);
// +----------+
// | XXXXXX |
// *----------+
- imageData.ApplyMask( maskData, 1.6f, true );
+ imageData.ApplyMask(maskData, 1.6f, true);
// +-----XXXXX+ quadrant
// | XXXXX| 1 2
// |XXXXX |
// *XXXXX-----+
- tet_infoline("Test that the image has been scaled and cropped to match the alpha mask" );
- DALI_TEST_EQUALS( imageData.GetWidth(), 32, TEST_LOCATION );
- DALI_TEST_EQUALS( imageData.GetHeight(), 20, TEST_LOCATION );
-
- tet_infoline( "Test that the image has been resized (the center square should now fill the image)\n");
- tet_infoline( "Test that the first quadrant has no alpha");
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 0, 0), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 5, 4), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 5, 8), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 14, 8), 0x00u, TEST_LOCATION );
-
- tet_infoline( "Test that the second quadrant has alpha and data");
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 18, 0), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 30, 1), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 30, 8), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 19, 8), 0xffu, TEST_LOCATION );
-
- tet_infoline( "Test that the third quadrant has no alpha");
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 18, 12), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 31, 12), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 31, 19), 0x00u, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 18, 19), 0x00u, TEST_LOCATION );
-
- tet_infoline( "Test that the fourth quadrant has alpha and data");
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 1, 12), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 7, 12), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 7, 19), 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( GetAlphaAt(imageData, 1, 19), 0xffu, TEST_LOCATION );
+ tet_infoline("Test that the image has been scaled and cropped to match the alpha mask");
+ DALI_TEST_EQUALS(imageData.GetWidth(), 32, TEST_LOCATION);
+ DALI_TEST_EQUALS(imageData.GetHeight(), 20, TEST_LOCATION);
+
+ tet_infoline("Test that the image has been resized (the center square should now fill the image)\n");
+ tet_infoline("Test that the first quadrant has no alpha");
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 0, 0), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 5, 4), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 5, 8), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 14, 8), 0x00u, TEST_LOCATION);
+
+ tet_infoline("Test that the second quadrant has alpha and data");
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 18, 0), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 30, 1), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 30, 8), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 19, 8), 0xffu, TEST_LOCATION);
+
+ tet_infoline("Test that the third quadrant has no alpha");
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 18, 12), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 31, 12), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 31, 19), 0x00u, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 18, 19), 0x00u, TEST_LOCATION);
+
+ tet_infoline("Test that the fourth quadrant has alpha and data");
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 1, 12), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 7, 12), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 7, 19), 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetAlphaAt(imageData, 1, 19), 0xffu, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Devel::PixelBuffer imageData = Devel::PixelBuffer::New( 10, 10, Pixel::RGBA8888 );
+ Devel::PixelBuffer imageData = Devel::PixelBuffer::New(10, 10, Pixel::RGBA8888);
FillCheckerboard(imageData);
- DALI_TEST_EQUALS( imageData.GetWidth(), 10, TEST_LOCATION ) ;
- DALI_TEST_EQUALS( imageData.GetHeight(), 10, TEST_LOCATION ) ;
+ DALI_TEST_EQUALS(imageData.GetWidth(), 10, TEST_LOCATION);
+ DALI_TEST_EQUALS(imageData.GetHeight(), 10, TEST_LOCATION);
unsigned char* buffer = imageData.GetBuffer();
// Test that an even pixel in the odd row has full alpha value
- DALI_TEST_EQUALS( buffer[43], 0xffu, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[43], 0xffu, TEST_LOCATION);
// Test that an even pixel in the even row has no alpha value
- DALI_TEST_EQUALS( buffer[55], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[55], 0x00u, TEST_LOCATION);
- imageData.ApplyGaussianBlur( 0.0f );
+ imageData.ApplyGaussianBlur(0.0f);
// Test that the pixels' alpha values are not changed because there is no blur
- DALI_TEST_EQUALS( buffer[43], 0xffu, TEST_LOCATION );
- DALI_TEST_EQUALS( buffer[55], 0x00u, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[43], 0xffu, TEST_LOCATION);
+ DALI_TEST_EQUALS(buffer[55], 0x00u, TEST_LOCATION);
- imageData.ApplyGaussianBlur( 1.0f );
+ imageData.ApplyGaussianBlur(1.0f);
// Test that the pixels' alpha values are changed after applying gaussian blur
- DALI_TEST_EQUALS( buffer[43], 0x7Au, TEST_LOCATION );
- DALI_TEST_EQUALS( buffer[55], 0x7Eu, TEST_LOCATION );
+ DALI_TEST_EQUALS(buffer[43], 0x7Au, TEST_LOCATION);
+ DALI_TEST_EQUALS(buffer[55], 0x7Eu, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-#include <stdlib.h>
-#include <stdint.h>
+#include <adaptor-test-application.h>
+#include <dali-test-suite-utils.h>
#include <dali/dali.h>
#include <dali/internal/system/linux/dali-ecore.h>
-#include <dali-test-suite-utils.h>
-#include <adaptor-test-application.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <iostream>
using namespace Dali;
namespace
{
-bool ecore_timer_running = false;
-Ecore_Task_Cb timer_callback_func=NULL;
-const void* timer_callback_data=NULL;
-bool main_loop_can_run = false;
-intptr_t timerId = 0; // intptr_t has the same size as a pointer and is platform independent so this can be returned as a pointer in ecore_timer_add below without compilation warnings
-}// anon namespace
+bool ecore_timer_running = false;
+Ecore_Task_Cb timer_callback_func = NULL;
+const void* timer_callback_data = NULL;
+bool main_loop_can_run = false;
+intptr_t timerId = 0; // intptr_t has the same size as a pointer and is platform independent so this can be returned as a pointer in ecore_timer_add below without compilation warnings
+} // namespace
extern "C"
{
-Ecore_Timer* ecore_timer_add(double in,
- Ecore_Task_Cb func,
- const void *data)
-{
- ecore_timer_running = true;
- timer_callback_func = func;
- timer_callback_data = data;
- timerId+=8;
- return (Ecore_Timer*)timerId;
-}
-
-void* ecore_timer_del(Ecore_Timer *timer)
-{
- ecore_timer_running = false;
- timer_callback_func = NULL;
- return NULL;
-}
+ Ecore_Timer* ecore_timer_add(double in,
+ Ecore_Task_Cb func,
+ const void* data)
+ {
+ ecore_timer_running = true;
+ timer_callback_func = func;
+ timer_callback_data = data;
+ timerId += 8;
+ return (Ecore_Timer*)timerId;
+ }
+ void* ecore_timer_del(Ecore_Timer* timer)
+ {
+ ecore_timer_running = false;
+ timer_callback_func = NULL;
+ return NULL;
+ }
}
namespace
{
-
void test_ecore_main_loop_begin()
{
if(timer_callback_func != NULL)
{
main_loop_can_run = true;
- while( main_loop_can_run )
+ while(main_loop_can_run)
{
- if( ! timer_callback_func(const_cast<void*>(timer_callback_data)) )
+ if(!timer_callback_func(const_cast<void*>(timer_callback_data)))
break;
}
}
void test_ecore_main_loop_quit()
{
timer_callback_func = NULL;
- main_loop_can_run = false;
+ main_loop_can_run = false;
}
-
/**
* small class to test timer signal
*/
class TimerTestClass : public ConnectionTracker
{
public:
-
- TimerTestClass(bool repeat):mTimerCalled(false),mReturnContiune(repeat) {}
+ TimerTestClass(bool repeat)
+ : mTimerCalled(false),
+ mReturnContiune(repeat)
+ {
+ }
bool Tick()
{
}
bool mTimerCalled; // whether tick has been called or not
bool mReturnContiune; // whether to return true / false to continue
-
};
-} // anon namespace
-
+} // namespace
// Positive test case for a method
int UtcDaliTimerCreation(void)
tet_printf("timer creation \n");
Timer timer = Timer::New(300);
- DALI_TEST_CHECK( timer );
+ DALI_TEST_CHECK(timer);
- DALI_TEST_CHECK( timer.GetInterval() == 300);
+ DALI_TEST_CHECK(timer.GetInterval() == 300);
END_TEST;
}
tet_printf("unintialized timer start \n");
- Timer *timer = new Timer;
+ Timer* timer = new Timer;
DALI_TEST_CHECK(timer != NULL);
try
tet_printf("unintialized timer stop \n");
- Timer *timer = new Timer;
+ Timer* timer = new Timer;
DALI_TEST_CHECK(timer != NULL);
try
tet_printf("unintialized get interval \n");
- Timer *timer = new Timer;
+ Timer* timer = new Timer;
DALI_TEST_CHECK(timer != NULL);
try
tet_printf("unintialized set interval \n");
- Timer *timer = new Timer;
+ Timer* timer = new Timer;
DALI_TEST_CHECK(timer != NULL);
try
tet_printf("unintialized is running \n");
- Timer *timer = new Timer;
+ Timer* timer = new Timer;
DALI_TEST_CHECK(timer != NULL);
try
END_TEST;
}
-
int UtcDaliTimerUnitializedSignalTick(void)
{
AdaptorTestApplication application;
tet_printf("unintialized SignalTick \n");
- Timer *timer = new Timer;
+ Timer* timer = new Timer;
DALI_TEST_CHECK(timer != NULL);
try
{
- TimerTestClass testClass(true);// = new TimerTestClass(true);
+ TimerTestClass testClass(true); // = new TimerTestClass(true);
timer->TickSignal().Connect(&testClass, &TimerTestClass::Tick);
}
tet_printf("timer set interval \n");
Timer timer = Timer::New(10);
- DALI_TEST_CHECK( timer.GetInterval() == 10);
+ DALI_TEST_CHECK(timer.GetInterval() == 10);
timer.SetInterval(5000);
- DALI_TEST_CHECK( timer.GetInterval() == 5000);
+ DALI_TEST_CHECK(timer.GetInterval() == 5000);
END_TEST;
}
Timer timer = Timer::New(10);
timer.SetInterval(20);
- DALI_TEST_CHECK( timer.GetInterval() == 20 );
- DALI_TEST_CHECK( timer.IsRunning() == true );
+ DALI_TEST_CHECK(timer.GetInterval() == 20);
+ DALI_TEST_CHECK(timer.IsRunning() == true);
timer.SetInterval(5000, false);
- DALI_TEST_CHECK( timer.GetInterval() == 5000 );
- DALI_TEST_CHECK( timer.IsRunning() == false );
+ DALI_TEST_CHECK(timer.GetInterval() == 5000);
+ DALI_TEST_CHECK(timer.IsRunning() == false);
END_TEST;
}
Timer timer = Timer::New(10);
timer.SetInterval(20);
- DALI_TEST_CHECK( timer.GetInterval() == 20 );
- DALI_TEST_CHECK( timer.IsRunning() == true );
+ DALI_TEST_CHECK(timer.GetInterval() == 20);
+ DALI_TEST_CHECK(timer.IsRunning() == true);
timer.SetInterval(5000, true);
- DALI_TEST_CHECK( timer.GetInterval() == 5000 );
- DALI_TEST_CHECK( timer.IsRunning() == true );
+ DALI_TEST_CHECK(timer.GetInterval() == 5000);
+ DALI_TEST_CHECK(timer.IsRunning() == true);
END_TEST;
}
tet_printf("timer copy constructor \n");
Timer timer = Timer::New(10);
- Timer anotherTimer( timer );
+ Timer anotherTimer(timer);
- DALI_TEST_CHECK( anotherTimer.GetInterval() == 10);
+ DALI_TEST_CHECK(anotherTimer.GetInterval() == 10);
END_TEST;
}
Timer timer = Timer::New(10);
- DALI_TEST_CHECK( timer );
+ DALI_TEST_CHECK(timer);
Timer anotherTimer = Timer::New(40);
DALI_TEST_CHECK(anotherTimer.GetInterval() == 40);
- tet_printf("timer 1 interval %d, \n",anotherTimer.GetInterval());
- tet_printf("timer 2 interval %d, \n",timer.GetInterval());
+ tet_printf("timer 1 interval %d, \n", anotherTimer.GetInterval());
+ tet_printf("timer 2 interval %d, \n", timer.GetInterval());
DALI_TEST_CHECK(timer != anotherTimer);
DALI_TEST_CHECK(timer == anotherTimer);
- tet_printf("timer 1 interval %d, \n",timer.GetInterval());
- tet_printf("timer 2 interval %d, \n",anotherTimer.GetInterval());
+ tet_printf("timer 1 interval %d, \n", timer.GetInterval());
+ tet_printf("timer 2 interval %d, \n", anotherTimer.GetInterval());
DALI_TEST_CHECK(timer.GetInterval() == 40);
{
AdaptorTestApplication application;
- Timer timer = Timer::New( 40 );
- DALI_TEST_CHECK( timer );
- DALI_TEST_EQUALS( 1, timer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( timer.GetInterval() == 40) ;
+ Timer timer = Timer::New(40);
+ DALI_TEST_CHECK(timer);
+ DALI_TEST_EQUALS(1, timer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(timer.GetInterval() == 40);
- Timer moved = std::move( timer );
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( moved.GetInterval() == 40 );
- DALI_TEST_CHECK( !timer );
+ Timer moved = std::move(timer);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(moved.GetInterval() == 40);
+ DALI_TEST_CHECK(!timer);
END_TEST;
}
{
AdaptorTestApplication application;
- Timer timer = Timer::New( 40 );
- DALI_TEST_CHECK( timer );
- DALI_TEST_EQUALS( 1, timer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( timer.GetInterval() == 40) ;
+ Timer timer = Timer::New(40);
+ DALI_TEST_CHECK(timer);
+ DALI_TEST_EQUALS(1, timer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(timer.GetInterval() == 40);
Timer moved;
- moved = std::move( timer );
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( moved.GetInterval() == 40 );
- DALI_TEST_CHECK( !timer );
+ moved = std::move(timer);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(moved.GetInterval() == 40);
+ DALI_TEST_CHECK(!timer);
END_TEST;
}
timer.Start();
- DALI_TEST_CHECK( timer.IsRunning() );
+ DALI_TEST_CHECK(timer.IsRunning());
timer.Stop();
- DALI_TEST_CHECK( timer.IsRunning() == false );
+ DALI_TEST_CHECK(timer.IsRunning() == false);
END_TEST;
}
tet_printf("timer call back\n");
- Timer timer = Timer::New(100);
+ Timer timer = Timer::New(100);
TimerTestClass testClass(true);
timer.TickSignal().Connect(&testClass, &TimerTestClass::Tick);
test_ecore_main_loop_begin();
- DALI_TEST_CHECK( testClass.mTimerCalled );
+ DALI_TEST_CHECK(testClass.mTimerCalled);
END_TEST;
}
{
AdaptorTestApplication application;
- Timer timer = Timer::New(100);
+ Timer timer = Timer::New(100);
TimerTestClass testClass(false);
timer.TickSignal().Connect(&testClass, &TimerTestClass::Tick);
test_ecore_main_loop_begin();
- DALI_TEST_CHECK( testClass.mTimerCalled );
+ DALI_TEST_CHECK(testClass.mTimerCalled);
END_TEST;
}
AdaptorTestApplication application;
Timer timer = Timer::New(100);
- Timer cast = Timer::DownCast( timer );
+ Timer cast = Timer::DownCast(timer);
- DALI_TEST_CHECK( cast );
+ DALI_TEST_CHECK(cast);
END_TEST;
}
AdaptorTestApplication application;
Timer timer;
- Timer cast = Timer::DownCast( timer );
+ Timer cast = Timer::DownCast(timer);
- DALI_TEST_CHECK( ! cast );
+ DALI_TEST_CHECK(!cast);
END_TEST;
}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*
*/
-#include <dali/dali.h>
#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
using namespace Dali;
namespace
{
-
} // unnamed namespace
int UtcDaliTtsPlayerConstructorP(void)
{
Dali::TtsPlayer player;
- DALI_TEST_CHECK( !player );
+ DALI_TEST_CHECK(!player);
END_TEST;
}
int UtcDaliTtsPlayerCopyConstructorP(void)
{
Dali::TtsPlayer player;
- Dali::TtsPlayer copy( player );
- DALI_TEST_CHECK( copy == player );
+ Dali::TtsPlayer copy(player);
+ DALI_TEST_CHECK(copy == player);
END_TEST;
}
{
Dali::TtsPlayer player;
Dali::TtsPlayer copy;
- DALI_TEST_CHECK( ! copy );
+ DALI_TEST_CHECK(!copy);
copy = player;
- DALI_TEST_CHECK( copy == player );
+ DALI_TEST_CHECK(copy == player);
END_TEST;
}
Dali::TtsPlayer* player = new Dali::TtsPlayer();
delete player;
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
int UtcDaliTtsPlayerConstructorFromInternalPointerN(void)
{
Internal::Adaptor::TtsPlayer* internalPlayer = NULL;
- Dali::TtsPlayer player(internalPlayer);
- DALI_TEST_CHECK( !player ); // Should not reach here!
+ Dali::TtsPlayer player(internalPlayer);
+ DALI_TEST_CHECK(!player); // Should not reach here!
END_TEST;
}
int UtcDaliTtsPlayerGetP(void)
{
Dali::TtsPlayer player = Dali::TtsPlayer::Get();
- DALI_TEST_CHECK( !player );
+ DALI_TEST_CHECK(!player);
END_TEST;
}
try
{
player.Play("text");
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
player.Stop();
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
player.Pause();
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
player.Resume();
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
Dali::TtsPlayer::State state = player.GetState();
- tet_printf( "Error: TtsPlayer state = %d, expected exception\n", (unsigned int)state );
- DALI_TEST_CHECK( false ); // Should not reach here!
+ tet_printf("Error: TtsPlayer state = %d, expected exception\n", (unsigned int)state);
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
}
-
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*
*/
-#include <dali/dali.h>
-#include <dali-test-suite-utils.h>
-#include "public-api/dali-wearable.h"
#include <appcore-watch/watch_app.h>
#include <appcore-watch/watch_app_extension.h>
+#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
#include <stdlib.h>
+#include "public-api/dali-wearable.h"
#define TIMEZONE_BUFFER_MAX 102
using namespace Dali;
namespace
{
-
struct MyTestApp : public ConnectionTracker
{
- MyTestApp( WatchApplication& app)
- : initCalled( false ),
- mApplication( app )
+ MyTestApp(WatchApplication& app)
+ : initCalled(false),
+ mApplication(app)
{
- mApplication.InitSignal().Connect( this, &MyTestApp::Create );
+ mApplication.InitSignal().Connect(this, &MyTestApp::Create);
}
void Create(Application& app)
}
// Data
- bool initCalled;
- WatchApplication& mApplication;
+ bool initCalled;
+ WatchApplication& mApplication;
};
} // unnamed namespace
int UtcDaliWatchTimeNew(void)
{
- WatchTime watchTime;
- WatchTime *watchTimeRef = &watchTime;
+ WatchTime watchTime;
+ WatchTime* watchTimeRef = &watchTime;
- DALI_TEST_CHECK( watchTimeRef );
+ DALI_TEST_CHECK(watchTimeRef);
END_TEST;
}
int UtcDaliWatchTimeGetHour(void)
{
- int ret, hour;
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret, hour;
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_hour(watch_time, &hour);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetHour() == hour );
+ DALI_TEST_CHECK(watchTime.GetHour() == hour);
END_TEST;
}
int UtcDaliWatchTimeGetHour24(void)
{
- int ret, hour24;
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret, hour24;
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_hour24(watch_time, &hour24);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetHour24() == hour24 );
+ DALI_TEST_CHECK(watchTime.GetHour24() == hour24);
END_TEST;
}
int UtcDaliWatchTimeGetMinute(void)
{
- int ret, minute;
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret, minute;
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_minute(watch_time, &minute);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetMinute() == minute );
+ DALI_TEST_CHECK(watchTime.GetMinute() == minute);
END_TEST;
}
int UtcDaliWatchTimeGetSecond(void)
{
- int ret, second;
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret, second;
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_second(watch_time, &second);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetSecond() == second );
+ DALI_TEST_CHECK(watchTime.GetSecond() == second);
END_TEST;
}
int UtcDaliWatchTimeGetMillisecond(void)
{
- int ret, millisecond;
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret, millisecond;
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_millisecond(watch_time, &millisecond);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetMillisecond() == millisecond );
+ DALI_TEST_CHECK(watchTime.GetMillisecond() == millisecond);
END_TEST;
}
int UtcDaliWatchTimeGetYear(void)
{
- int ret, year;
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret, year;
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_year(watch_time, &year);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetYear() == year );
+ DALI_TEST_CHECK(watchTime.GetYear() == year);
END_TEST;
}
int UtcDaliWatchTimeGetMonth(void)
{
- int ret, month;
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret, month;
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_month(watch_time, &month);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetMonth() == month );
+ DALI_TEST_CHECK(watchTime.GetMonth() == month);
END_TEST;
}
int UtcDaliWatchTimeGetDay(void)
{
- int ret, day;
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret, day;
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_day(watch_time, &day);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetDay() == day );
+ DALI_TEST_CHECK(watchTime.GetDay() == day);
END_TEST;
}
int UtcDaliWatchTimeGetDayOfWeek(void)
{
- int ret, dayOfWeek;
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret, dayOfWeek;
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_day_of_week(watch_time, &dayOfWeek);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetDayOfWeek() == dayOfWeek );
+ DALI_TEST_CHECK(watchTime.GetDayOfWeek() == dayOfWeek);
END_TEST;
}
int UtcDaliWatchTimeGetUtcTime(void)
{
- int ret;
- struct tm *utcTime = (struct tm *)calloc( 1, sizeof( struct tm ) );
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret;
+ struct tm* utcTime = (struct tm*)calloc(1, sizeof(struct tm));
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_day(watch_time, utcTime);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetUtcTime().tm_sec == (*utcTime).tm_sec );
+ DALI_TEST_CHECK(watchTime.GetUtcTime().tm_sec == (*utcTime).tm_sec);
END_TEST;
}
int UtcDaliWatchTimeGetUtcTimeStamp(void)
{
- int ret;
- time_t *timeStamp = (time_t *)calloc( 1, sizeof( time_t ) );
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret;
+ time_t* timeStamp = (time_t*)calloc(1, sizeof(time_t));
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_day(watch_time, timeStamp);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetUtcTimeStamp() == *timeStamp );
+ DALI_TEST_CHECK(watchTime.GetUtcTimeStamp() == *timeStamp);
END_TEST;
}
int UtcDaliWatchTimeGetTimeZone(void)
{
- int ret;
- char *timeZone[TIMEZONE_BUFFER_MAX] = {0,};
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret;
+ char* timeZone[TIMEZONE_BUFFER_MAX] = {
+ 0,
+ };
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_day(watch_time, timeZone);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetTimeZone() == timeZone );
+ DALI_TEST_CHECK(watchTime.GetTimeZone() == timeZone);
END_TEST;
}
int UtcDaliWatchTimeGetDaylightSavingTimeStatus(void)
{
- int ret;
- bool daylight;
- WatchTime watchTime;
- watch_time_h watch_time = {0,};
+ int ret;
+ bool daylight;
+ WatchTime watchTime;
+ watch_time_h watch_time = {
+ 0,
+ };
ret = watch_time_get_current_time(&watch_time);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
ret = watch_time_get_day(watch_time, &daylight);
- DALI_TEST_CHECK( ret == APP_ERROR_NONE );
+ DALI_TEST_CHECK(ret == APP_ERROR_NONE);
- DALI_TEST_CHECK( watchTime.GetDaylightSavingTimeStatus() == daylight );
+ DALI_TEST_CHECK(watchTime.GetDaylightSavingTimeStatus() == daylight);
END_TEST;
}
*
*/
-#include <dali/dali.h>
#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
using namespace Dali;
namespace
{
-
struct MyTestApp : public ConnectionTracker
{
- MyTestApp( WatchApplication& app)
- : initCalled( false ),
- mApplication( app )
+ MyTestApp(WatchApplication& app)
+ : initCalled(false),
+ mApplication(app)
{
- mApplication.InitSignal().Connect( this, &MyTestApp::Create );
+ mApplication.InitSignal().Connect(this, &MyTestApp::Create);
}
void Create(Application& app)
}
// Data
- bool initCalled;
- WatchApplication& mApplication;
+ bool initCalled;
+ WatchApplication& mApplication;
};
-void WatchTimeSignalCallback( Application& app, const WatchTime& time)
+void WatchTimeSignalCallback(Application& app, const WatchTime& time)
{
}
-void WatchChangedSignalCallback( Application& app, bool ambient)
+void WatchChangedSignalCallback(Application& app, bool ambient)
{
}
{
WatchApplication application = WatchApplication::New();
- MyTestApp testApp( application );
+ MyTestApp testApp(application);
- DALI_TEST_CHECK( application );
+ DALI_TEST_CHECK(application);
END_TEST;
}
int UtcDaliWatchApplicationNew02(void)
{
- int argc( 1 );
- const char* argList[1] = { "program" };
- char** argv = const_cast<char**>(argList);
+ int argc(1);
+ const char* argList[1] = {"program"};
+ char** argv = const_cast<char**>(argList);
- WatchApplication application = WatchApplication::New( &argc, &argv );
+ WatchApplication application = WatchApplication::New(&argc, &argv);
- MyTestApp testApp( application );
+ MyTestApp testApp(application);
- DALI_TEST_CHECK( application );
+ DALI_TEST_CHECK(application);
END_TEST;
}
int UtcDaliWatchApplicationNew03(void)
{
- int argc( 1 );
- const char* argList[1] = { "program" };
- char** argv = const_cast<char**>(argList);
+ int argc(1);
+ const char* argList[1] = {"program"};
+ char** argv = const_cast<char**>(argList);
- WatchApplication application = WatchApplication::New( &argc, &argv, "stylesheet" );
+ WatchApplication application = WatchApplication::New(&argc, &argv, "stylesheet");
- MyTestApp testApp( application );
+ MyTestApp testApp(application);
- DALI_TEST_CHECK( application );
+ DALI_TEST_CHECK(application);
END_TEST;
}
int UtcDaliWatchApplicationCopyAndAssignment(void)
{
WatchApplication application = WatchApplication::New();
- WatchApplication copy( application );
- DALI_TEST_CHECK( copy == application );
+ WatchApplication copy(application);
+ DALI_TEST_CHECK(copy == application);
WatchApplication assigned;
- DALI_TEST_CHECK( !assigned );
+ DALI_TEST_CHECK(!assigned);
assigned = application;
- DALI_TEST_CHECK( copy == assigned );
+ DALI_TEST_CHECK(copy == assigned);
END_TEST;
}
int UtcDaliWatchApplicationTimeTickSignalP(void)
{
WatchApplication application = WatchApplication::New();
- application.TimeTickSignal().Connect( &WatchTimeSignalCallback );
- DALI_TEST_CHECK( application );
+ application.TimeTickSignal().Connect(&WatchTimeSignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.TimeTickSignal().Connect( &WatchTimeSignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.TimeTickSignal().Connect(&WatchTimeSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliWatchApplicationAmbientTickSignalP(void)
{
WatchApplication application = WatchApplication::New();
- application.AmbientTickSignal().Connect( &WatchTimeSignalCallback );
- DALI_TEST_CHECK( application );
+ application.AmbientTickSignal().Connect(&WatchTimeSignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.AmbientTickSignal().Connect( &WatchTimeSignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.AmbientTickSignal().Connect(&WatchTimeSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliWatchApplicationAmbientChangedSignalP(void)
{
WatchApplication application = WatchApplication::New();
- application.AmbientChangedSignal().Connect( &WatchChangedSignalCallback );
- DALI_TEST_CHECK( application );
+ application.AmbientChangedSignal().Connect(&WatchChangedSignalCallback);
+ DALI_TEST_CHECK(application);
END_TEST;
}
try
{
- application.AmbientChangedSignal().Connect( &WatchChangedSignalCallback );
- DALI_TEST_CHECK( false ); // Should not get here
+ application.AmbientChangedSignal().Connect(&WatchChangedSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
}
-
*
*/
+#include <dali-test-suite-utils.h>
#include <dali/dali.h>
#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/internal/system/linux/dali-ecore-x.h>
-#include <dali-test-suite-utils.h>
-
using namespace Dali;
namespace
{
-
intptr_t screenId = 0; // intptr_t has the same size as a pointer and is platform independent so this can be returned as a pointer in ecore_x_default_screen_get below without compilation warnings
} // unnamed namespace
extern "C"
{
+ Ecore_X_Screen* ecore_x_default_screen_get(void)
+ {
+ screenId += 8;
+ return (Ecore_X_Screen*)screenId;
+ }
-Ecore_X_Screen* ecore_x_default_screen_get(void)
-{
- screenId += 8;
- return (Ecore_X_Screen*)screenId;
-}
-
-void ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h)
-{
- *w = 100;
- *h = 100;
-}
-
-Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
-{
- return 0;
-}
+ void ecore_x_screen_size_get(const Ecore_X_Screen* screen, int* w, int* h)
+ {
+ *w = 100;
+ *h = 100;
+ }
+ Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
+ {
+ return 0;
+ }
}
int UtcDaliWindowConstructorP(void)
{
Dali::Window window;
- DALI_TEST_CHECK( !window );
+ DALI_TEST_CHECK(!window);
END_TEST;
}
int UtcDaliWindowCopyConstructorP(void)
{
Dali::Window window;
- Dali::Window copy( window );
- DALI_TEST_CHECK( copy == window );
+ Dali::Window copy(window);
+ DALI_TEST_CHECK(copy == window);
END_TEST;
}
int UtcDaliWindowConstructorFromInternalPointerN(void)
{
Internal::Adaptor::Window* internalWindow = NULL;
- Dali::Window window(internalWindow);
- DALI_TEST_CHECK( !window ); // Should not reach here!
+ Dali::Window window(internalWindow);
+ DALI_TEST_CHECK(!window); // Should not reach here!
END_TEST;
}
int UtcDaliWindowAssignmentOperatorP(void)
{
const Dali::Window window;
- Dali::Window copy;
- DALI_TEST_CHECK( ! copy );
+ Dali::Window copy;
+ DALI_TEST_CHECK(!copy);
copy = window;
- DALI_TEST_CHECK( copy == window );
+ DALI_TEST_CHECK(copy == window);
END_TEST;
}
Dali::Window* window = new Dali::Window();
delete window;
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
try
{
PositionSize windowPosition(0, 0, 0, 0);
- Dali::Window window = Dali::Window::New( windowPosition, "test-window", true );
+ Dali::Window window = Dali::Window::New(windowPosition, "test-window", true);
- tet_result( TET_FAIL );
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Failed to create X window", TEST_LOCATION);
}
// Attempt to create a new window
try
{
PositionSize windowPosition(0, 0, 0, 0);
- Dali::Window window = Dali::Window::New( windowPosition, "test-window", "test-window-class", true );
+ Dali::Window window = Dali::Window::New(windowPosition, "test-window", "test-window-class", true);
- tet_result( TET_FAIL );
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "Failed to create X window", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Failed to create X window", TEST_LOCATION);
}
END_TEST;
try
{
window.SetClass("window-name", "window-class");
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
window.Raise();
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
window.Lower();
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
window.Activate();
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
window.AddAvailableOrientation(Dali::Window::PORTRAIT);
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
window.RemoveAvailableOrientation(Dali::Window::PORTRAIT);
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
window.SetPreferredOrientation(Dali::Window::PORTRAIT);
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
Dali::Window::WindowOrientation orientation = window.GetPreferredOrientation();
- DALI_TEST_CHECK( orientation == Dali::Window::PORTRAIT ); // Should not reach here!
+ DALI_TEST_CHECK(orientation == Dali::Window::PORTRAIT); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
Dali::Any handle = window.GetNativeHandle();
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
Dali::Window window;
try
{
- window.SetAcceptFocus( true );
- DALI_TEST_CHECK( false ); // Should not reach here!
+ window.SetAcceptFocus(true);
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
window.IsFocusAcceptable();
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
window.FocusChangeSignal();
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
-#include <string.h>
#include <getopt.h>
#include <stdlib.h>
+#include <string.h>
#include <test-harness.h>
+
#include "tct-dali-platform-abstraction-core.h"
-int main(int argc, char * const argv[])
+int main(int argc, char* const argv[])
{
int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT;
const char* optString = "sf";
- bool optRerunFailed(true);
- bool optRunSerially(false);
+ bool optRerunFailed(true);
+ bool optRunSerially(false);
int nextOpt = 0;
do
{
- nextOpt = getopt( argc, argv, optString );
+ nextOpt = getopt(argc, argv, optString);
switch(nextOpt)
{
case 'f':
exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT);
break;
}
- } while( nextOpt != -1 );
+ } while(nextOpt != -1);
- if( optind == argc ) // no testcase name in argument list
+ if(optind == argc) // no testcase name in argument list
{
- if( optRunSerially )
+ if(optRunSerially)
{
- result = TestHarness::RunAll( argv[0], tc_array );
+ result = TestHarness::RunAll(argv[0], tc_array);
}
else
{
- result = TestHarness::RunAllInParallel( argv[0], tc_array, optRerunFailed );
+ result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed);
}
}
else
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
using Dali::Internal::Platform::ApplyAttributesToBitmap;
-#define ANSI_BLACK "\x1B[0m"
-#define ANSI_RED "\x1B[31m"
-#define ANSI_GREEN "\x1B[32m"
-#define ANSI_YELLOW "\x1B[33m"
-#define ANSI_BLUE "\x1B[34m"
+#define ANSI_BLACK "\x1B[0m"
+#define ANSI_RED "\x1B[31m"
+#define ANSI_GREEN "\x1B[32m"
+#define ANSI_YELLOW "\x1B[33m"
+#define ANSI_BLUE "\x1B[34m"
#define ANSI_MAGENTA "\x1B[35m"
-#define ANSI_CYAN "\x1B[36m"
-#define ANSI_WHITE "\x1B[37m"
-#define ANSI_RESET "\033[0m"
+#define ANSI_CYAN "\x1B[36m"
+#define ANSI_WHITE "\x1B[37m"
+#define ANSI_RESET "\033[0m"
-const unsigned char BORDER_FILL_VALUE = 0xff;
-const char* ASCII_FILL_VALUE = ANSI_YELLOW "#";
-const char* ASCII_PAD_VALUE = ANSI_BLUE "#";
+const unsigned char BORDER_FILL_VALUE = 0xff;
+const char* ASCII_FILL_VALUE = ANSI_YELLOW "#";
+const char* ASCII_PAD_VALUE = ANSI_BLUE "#";
typedef unsigned char PixelBuffer;
-
-void FillBitmap( Dali::Devel::PixelBuffer bitmap )
+void FillBitmap(Dali::Devel::PixelBuffer bitmap)
{
// Fill the given bitmap fully.
- const Pixel::Format pixelFormat = bitmap.GetPixelFormat();
- const unsigned int bytesPerPixel = Pixel::GetBytesPerPixel( pixelFormat );
- PixelBuffer * const targetPixels = bitmap.GetBuffer();
- const int bytesToFill = bitmap.GetWidth() * bitmap.GetHeight() * bytesPerPixel;
+ const Pixel::Format pixelFormat = bitmap.GetPixelFormat();
+ const unsigned int bytesPerPixel = Pixel::GetBytesPerPixel(pixelFormat);
+ PixelBuffer* const targetPixels = bitmap.GetBuffer();
+ const int bytesToFill = bitmap.GetWidth() * bitmap.GetHeight() * bytesPerPixel;
- memset( targetPixels, BORDER_FILL_VALUE, bytesToFill );
+ memset(targetPixels, BORDER_FILL_VALUE, bytesToFill);
}
-typedef Rect< int > ActiveArea;
+typedef Rect<int> ActiveArea;
// This struct defines all information for one test.
struct ImageFittingTestParameters
{
- unsigned int sourceWidth;
- unsigned int sourceHeight;
- unsigned int desiredWidth;
- unsigned int desiredHeight;
+ unsigned int sourceWidth;
+ unsigned int sourceHeight;
+ unsigned int desiredWidth;
+ unsigned int desiredHeight;
FittingMode::Type fittingMode;
unsigned int expectedWidth;
unsigned int expectedHeight;
- ActiveArea expectedActiveImageArea;
-
- ImageFittingTestParameters( unsigned int newSourceWidth, unsigned int newSourceHeight, unsigned int newDesiredWidth, unsigned int newDesiredHeight, FittingMode::Type newFittingMode,
- unsigned int newExpectedWidth, unsigned int newExpectedHeight, ActiveArea newExpectedActiveImageArea )
- : sourceWidth( newSourceWidth ),
- sourceHeight( newSourceHeight ),
- desiredWidth( newDesiredWidth ),
- desiredHeight( newDesiredHeight ),
- fittingMode( newFittingMode ),
- expectedWidth( newExpectedWidth ),
- expectedHeight( newExpectedHeight ),
- expectedActiveImageArea( newExpectedActiveImageArea )
+ ActiveArea expectedActiveImageArea;
+
+ ImageFittingTestParameters(unsigned int newSourceWidth, unsigned int newSourceHeight, unsigned int newDesiredWidth, unsigned int newDesiredHeight, FittingMode::Type newFittingMode, unsigned int newExpectedWidth, unsigned int newExpectedHeight, ActiveArea newExpectedActiveImageArea)
+ : sourceWidth(newSourceWidth),
+ sourceHeight(newSourceHeight),
+ desiredWidth(newDesiredWidth),
+ desiredHeight(newDesiredHeight),
+ fittingMode(newFittingMode),
+ expectedWidth(newExpectedWidth),
+ expectedHeight(newExpectedHeight),
+ expectedActiveImageArea(newExpectedActiveImageArea)
{
}
};
-typedef std::vector< ImageFittingTestParameters > TestContainer;
-
+typedef std::vector<ImageFittingTestParameters> TestContainer;
-void PerformFittingTests( TestContainer& tests )
+void PerformFittingTests(TestContainer& tests)
{
// Iterate through all pre-defined tests.
- for( unsigned int testNumber = 0; testNumber < tests.size(); ++testNumber )
+ for(unsigned int testNumber = 0; testNumber < tests.size(); ++testNumber)
{
// Gather info for this test.
- ImageFittingTestParameters &test = tests[ testNumber ];
+ ImageFittingTestParameters& test = tests[testNumber];
- unsigned int sourceWidth = test.sourceWidth;
- unsigned int sourceHeight = test.sourceHeight;
- unsigned int desiredWidth = test.desiredWidth;
- unsigned int desiredHeight = test.desiredHeight;
- FittingMode::Type fittingMode = test.fittingMode;
+ unsigned int sourceWidth = test.sourceWidth;
+ unsigned int sourceHeight = test.sourceHeight;
+ unsigned int desiredWidth = test.desiredWidth;
+ unsigned int desiredHeight = test.desiredHeight;
+ FittingMode::Type fittingMode = test.fittingMode;
// Create a source bitmap.
- ImageDimensions desiredDimensions( desiredWidth, desiredHeight );
+ ImageDimensions desiredDimensions(desiredWidth, desiredHeight);
SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR;
-
- auto sourceBitmap = Dali::Devel::PixelBuffer::New( sourceWidth, sourceHeight, Pixel::Format::RGBA8888 );
- const Pixel::Format pixelFormat = sourceBitmap.GetPixelFormat();
+ auto sourceBitmap = Dali::Devel::PixelBuffer::New(sourceWidth, sourceHeight, Pixel::Format::RGBA8888);
+ const Pixel::Format pixelFormat = sourceBitmap.GetPixelFormat();
// Completely fill the source bitmap (with white).
- FillBitmap( sourceBitmap );
+ FillBitmap(sourceBitmap);
// Perform fitting operations (this is the method we are testing).
- auto newBitmap = ApplyAttributesToBitmap( sourceBitmap, desiredDimensions, fittingMode, samplingMode );
+ auto newBitmap = ApplyAttributesToBitmap(sourceBitmap, desiredDimensions, fittingMode, samplingMode);
- DALI_TEST_CHECK( newBitmap );
+ DALI_TEST_CHECK(newBitmap);
// As we do not need performance within this test, we branch to exit here (for readability, maintainability).
- if( !newBitmap )
+ if(!newBitmap)
{
return;
}
- auto bitmap( newBitmap );
+ auto bitmap(newBitmap);
- unsigned int resultWidth = bitmap.GetWidth();
+ unsigned int resultWidth = bitmap.GetWidth();
unsigned int resultHeight = bitmap.GetHeight();
// Check the dimensions of the modified image match against the expected values defined in the test.
- DALI_TEST_EQUALS( resultWidth, test.expectedWidth, TEST_LOCATION );
- DALI_TEST_EQUALS( resultHeight, test.expectedHeight, TEST_LOCATION );
+ DALI_TEST_EQUALS(resultWidth, test.expectedWidth, TEST_LOCATION);
+ DALI_TEST_EQUALS(resultHeight, test.expectedHeight, TEST_LOCATION);
- PixelBuffer* resultBuffer = bitmap.GetBuffer();
- const unsigned int bytesPerPixel = Pixel::GetBytesPerPixel( pixelFormat );
+ PixelBuffer* resultBuffer = bitmap.GetBuffer();
+ const unsigned int bytesPerPixel = Pixel::GetBytesPerPixel(pixelFormat);
// We generate an ASCII representation of the source, desired and result images to log, purely as a debugging aid.
// (0 = border, 1 = active image area - from the source image).
- std::string xSourceImageString( sourceWidth, '#' );
- std::string xDesiredSizeString( desiredWidth - 2, '-' );
- std::string xDesiredSizePadString( desiredWidth - 2, ' ' );
- tet_printf( "%sRunning test: %d%s\n", ANSI_RED, testNumber + 1, ANSI_RESET );
- tet_printf( "Source image: %s%s%s\n", ANSI_YELLOW, xSourceImageString.c_str(), ANSI_RESET );
- for( unsigned int i = 0; i < sourceHeight - 1; ++i )
+ std::string xSourceImageString(sourceWidth, '#');
+ std::string xDesiredSizeString(desiredWidth - 2, '-');
+ std::string xDesiredSizePadString(desiredWidth - 2, ' ');
+ tet_printf("%sRunning test: %d%s\n", ANSI_RED, testNumber + 1, ANSI_RESET);
+ tet_printf("Source image: %s%s%s\n", ANSI_YELLOW, xSourceImageString.c_str(), ANSI_RESET);
+ for(unsigned int i = 0; i < sourceHeight - 1; ++i)
{
- tet_printf( " %s%s%s\n", ANSI_YELLOW, xSourceImageString.c_str(), ANSI_RESET );
+ tet_printf(" %s%s%s\n", ANSI_YELLOW, xSourceImageString.c_str(), ANSI_RESET);
}
- tet_printf( "Desired size: %s+%s+%s\n", ANSI_YELLOW, xDesiredSizeString.c_str(), ANSI_RESET );
- for( unsigned int i = 0; i < desiredHeight - 2; ++i )
+ tet_printf("Desired size: %s+%s+%s\n", ANSI_YELLOW, xDesiredSizeString.c_str(), ANSI_RESET);
+ for(unsigned int i = 0; i < desiredHeight - 2; ++i)
{
- tet_printf( " %s|%s|%s\n", ANSI_YELLOW, xDesiredSizePadString.c_str(), ANSI_RESET );
+ tet_printf(" %s|%s|%s\n", ANSI_YELLOW, xDesiredSizePadString.c_str(), ANSI_RESET);
}
- tet_printf( " %s+%s+%s\n", ANSI_YELLOW, xDesiredSizeString.c_str(), ANSI_RESET );
+ tet_printf(" %s+%s+%s\n", ANSI_YELLOW, xDesiredSizeString.c_str(), ANSI_RESET);
// We want to calculate the active image area (the area filled with image data as opposed to borders).
// This is so we can determine if the fitting modes worked correctly.
- ActiveArea resultActiveArea( -1, -1, -1, -1 );
+ ActiveArea resultActiveArea(-1, -1, -1, -1);
// Iterate over the result image data to find the active area.
- for( unsigned int y = 0; y < resultHeight; ++y )
+ for(unsigned int y = 0; y < resultHeight; ++y)
{
- int activeStartX = -1;
- int activeEndX = -1;
+ int activeStartX = -1;
+ int activeEndX = -1;
std::string xResultImageString;
- for( unsigned int x = 0; x < resultWidth; ++x )
+ for(unsigned int x = 0; x < resultWidth; ++x)
{
- bool pixelPopulated = resultBuffer[ x * bytesPerPixel ] != 0x00;
+ bool pixelPopulated = resultBuffer[x * bytesPerPixel] != 0x00;
// If the pixel is filled AND we haven't found a filled pixel yet,
// this is the horizontal start of the active pixel area (for this line).
- if( pixelPopulated && ( activeStartX == -1 ) )
+ if(pixelPopulated && (activeStartX == -1))
{
activeStartX = x;
}
- else if( !pixelPopulated && ( activeStartX != -1 ) && ( activeEndX == -1 ) )
+ else if(!pixelPopulated && (activeStartX != -1) && (activeEndX == -1))
{
// If the pixel is NOT filled AND we HAVE rpeviously found a filled pixel,
// then this is the horizontal end of the active pixel area (for this line).
}
// First calculate the X-end span value, if we ran out of image before reaching the end of active image area.
- if( ( activeStartX != -1 ) && ( activeEndX == -1 ) )
+ if((activeStartX != -1) && (activeEndX == -1))
{
activeEndX = resultWidth - activeStartX;
}
// If the X-start pixel on this line is earlier than other lines, the overall active area starts earlier.
// Note: This is ignored if there was no pixels found.
- if( ( activeStartX != -1 ) && ( ( activeStartX < resultActiveArea.x ) || ( resultActiveArea.x == -1 ) ) )
+ if((activeStartX != -1) && ((activeStartX < resultActiveArea.x) || (resultActiveArea.x == -1)))
{
resultActiveArea.x = activeStartX;
}
// If the X-end pixel on this line is later than other lines, the overall active area starts later.
// Note: This is ignored if there was no pixels found.
- if( ( activeEndX != -1 ) && ( ( activeEndX > resultActiveArea.width ) || ( resultActiveArea.width == -1 ) ) )
+ if((activeEndX != -1) && ((activeEndX > resultActiveArea.width) || (resultActiveArea.width == -1)))
{
resultActiveArea.width = activeEndX;
}
// If there was an X-start pixel on this line AND we don't yet have a Y-start, this line IS the Y-start.
- if( ( activeStartX != -1 ) && ( resultActiveArea.y == -1 ) )
+ if((activeStartX != -1) && (resultActiveArea.y == -1))
{
resultActiveArea.y = y;
}
// If there was no X-start pixel on this line AND we already have a Y-start value,
// then the last Y becomes the new Y-end value.
- if( ( activeStartX == -1 ) && ( resultActiveArea.y != -1 ) && ( resultActiveArea.height == -1 ) )
+ if((activeStartX == -1) && (resultActiveArea.y != -1) && (resultActiveArea.height == -1))
{
resultActiveArea.height = y - 1;
}
- if( y == 0 )
+ if(y == 0)
{
- tet_printf( "Result image: %s\n", xResultImageString.c_str() );
+ tet_printf("Result image: %s\n", xResultImageString.c_str());
}
else
{
- tet_printf( " %s\n", xResultImageString.c_str() );
+ tet_printf(" %s\n", xResultImageString.c_str());
}
resultBuffer += resultWidth * bytesPerPixel;
}
// Calculate the Y-end value, if we ran out of image before reaching the end of active image area.
- if( ( resultActiveArea.y != -1 ) && ( resultActiveArea.height == -1 ) )
+ if((resultActiveArea.y != -1) && (resultActiveArea.height == -1))
{
resultActiveArea.height = resultHeight - resultActiveArea.y;
}
- tet_printf( "%s", ANSI_RESET );
- tet_printf( "Test: %d Result image dimensions: %d,%d ActiveArea: %d,%d,%d,%d\n",
- testNumber + 1, resultWidth, resultHeight, resultActiveArea.x, resultActiveArea.y, resultActiveArea.width, resultActiveArea.height );
+ tet_printf("%s", ANSI_RESET);
+ tet_printf("Test: %d Result image dimensions: %d,%d ActiveArea: %d,%d,%d,%d\n",
+ testNumber + 1,
+ resultWidth,
+ resultHeight,
+ resultActiveArea.x,
+ resultActiveArea.y,
+ resultActiveArea.width,
+ resultActiveArea.height);
// Test the result images active area matches the expected active area defined in the test.
- DALI_TEST_EQUALS( resultActiveArea, test.expectedActiveImageArea, TEST_LOCATION );
+ DALI_TEST_EQUALS(resultActiveArea, test.expectedActiveImageArea, TEST_LOCATION);
}
}
// Source Width, Source Height, Desired Width, Desired Height, Fitting Mode, Expected Width, Expected Height, ActiveArea: X-start, Y-start, width, height
// Test Image source size = desired size. Output should be the same.
- tests.push_back( ImageFittingTestParameters( 4, 4, 4, 4, FittingMode::FIT_WIDTH, 4, 4, ActiveArea( 0, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 4, 4, 4, FittingMode::FIT_WIDTH, 4, 4, ActiveArea(0, 0, 4, 4)));
// Test Image source size > desired size, but aspect same. Should scale size down.
- tests.push_back( ImageFittingTestParameters( 4, 4, 2, 2, FittingMode::FIT_WIDTH, 2, 2, ActiveArea( 0, 0, 2, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 4, 2, 2, FittingMode::FIT_WIDTH, 2, 2, ActiveArea(0, 0, 2, 2)));
// Test Image source size < desired size, but aspect same. Should not scale size up.
- tests.push_back( ImageFittingTestParameters( 2, 2, 4, 4, FittingMode::FIT_WIDTH, 2, 2, ActiveArea( 0, 0, 2, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(2, 2, 4, 4, FittingMode::FIT_WIDTH, 2, 2, ActiveArea(0, 0, 2, 2)));
// Test Image source size < desired size, but aspect different. Should crop height, so no borders. No scale up as result has same aspect after crop.
- tests.push_back( ImageFittingTestParameters( 2, 4, 8, 8, FittingMode::FIT_WIDTH, 2, 2, ActiveArea( 0, 0, 2, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(2, 4, 8, 8, FittingMode::FIT_WIDTH, 2, 2, ActiveArea(0, 0, 2, 2)));
// Test Image source size > desired size, but aspect different (w < h). Should crop height, so no borders. No scale as result is same size as desired size.
- tests.push_back( ImageFittingTestParameters( 4, 8, 4, 4, FittingMode::FIT_WIDTH, 4, 4, ActiveArea( 0, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 8, 4, 4, FittingMode::FIT_WIDTH, 4, 4, ActiveArea(0, 0, 4, 4)));
// Test Image source size > desired size, but aspect different (w > h). Should add borders, AND scale down to desired size.
- tests.push_back( ImageFittingTestParameters( 8, 4, 4, 4, FittingMode::FIT_WIDTH, 4, 4, ActiveArea( 0, 1, 4, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(8, 4, 4, 4, FittingMode::FIT_WIDTH, 4, 4, ActiveArea(0, 1, 4, 2)));
- PerformFittingTests( tests );
+ PerformFittingTests(tests);
END_TEST;
}
// Source Width, Source Height, Desired Width, Desired Height, Fitting Mode, Expected Width, Expected Height, ActiveArea: X-start, Y-start, width, height
// Test Image source size = desired size. Output should be the same.
- tests.push_back( ImageFittingTestParameters( 4, 4, 4, 4, FittingMode::FIT_HEIGHT, 4, 4, ActiveArea( 0, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 4, 4, 4, FittingMode::FIT_HEIGHT, 4, 4, ActiveArea(0, 0, 4, 4)));
// Test Image source size > desired size, but aspect same. Should scale size down.
- tests.push_back( ImageFittingTestParameters( 4, 4, 2, 2, FittingMode::FIT_HEIGHT, 2, 2, ActiveArea( 0, 0, 2, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 4, 2, 2, FittingMode::FIT_HEIGHT, 2, 2, ActiveArea(0, 0, 2, 2)));
// Test Image source size < desired size, but aspect same. Should not scale size up.
- tests.push_back( ImageFittingTestParameters( 2, 2, 4, 4, FittingMode::FIT_HEIGHT, 2, 2, ActiveArea( 0, 0, 2, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(2, 2, 4, 4, FittingMode::FIT_HEIGHT, 2, 2, ActiveArea(0, 0, 2, 2)));
// Test Image source size < desired size, but aspect different. Should add borders, but not scale overall size up.
- tests.push_back( ImageFittingTestParameters( 2, 4, 8, 8, FittingMode::FIT_HEIGHT, 4, 4, ActiveArea( 1, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(2, 4, 8, 8, FittingMode::FIT_HEIGHT, 4, 4, ActiveArea(1, 0, 4, 4)));
// Test Image source size > desired size, but aspect different (w < h). Should add borders, AND scale down to desired size.
- tests.push_back( ImageFittingTestParameters( 4, 8, 4, 4, FittingMode::FIT_HEIGHT, 4, 4, ActiveArea( 1, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 8, 4, 4, FittingMode::FIT_HEIGHT, 4, 4, ActiveArea(1, 0, 4, 4)));
// Test Image source size > desired size, but aspect different (w > h). Should crop width, so no borders. No scale as result is same size as desired size.
- tests.push_back( ImageFittingTestParameters( 8, 4, 4, 4, FittingMode::FIT_HEIGHT, 4, 4, ActiveArea( 0, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(8, 4, 4, 4, FittingMode::FIT_HEIGHT, 4, 4, ActiveArea(0, 0, 4, 4)));
- PerformFittingTests( tests );
+ PerformFittingTests(tests);
END_TEST;
}
// Source Width, Source Height, Desired Width, Desired Height, Fitting Mode, Expected Width, Expected Height, ActiveArea: X-start, Y-start, width, height
// Test Image source size = desired size. Output should be the same.
- tests.push_back( ImageFittingTestParameters( 4, 4, 4, 4, FittingMode::SHRINK_TO_FIT, 4, 4, ActiveArea( 0, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 4, 4, 4, FittingMode::SHRINK_TO_FIT, 4, 4, ActiveArea(0, 0, 4, 4)));
// Test Image source size > desired size, but aspect same. Should scale size down.
- tests.push_back( ImageFittingTestParameters( 4, 4, 2, 2, FittingMode::SHRINK_TO_FIT, 2, 2, ActiveArea( 0, 0, 2, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 4, 2, 2, FittingMode::SHRINK_TO_FIT, 2, 2, ActiveArea(0, 0, 2, 2)));
// Test Image source size < desired size, but aspect same. Should not scale size up.
- tests.push_back( ImageFittingTestParameters( 2, 2, 4, 4, FittingMode::SHRINK_TO_FIT, 2, 2, ActiveArea( 0, 0, 2, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(2, 2, 4, 4, FittingMode::SHRINK_TO_FIT, 2, 2, ActiveArea(0, 0, 2, 2)));
// Test Image source size < desired size, but aspect different. Should add borders, but not scale overall size up, as although image is smaller than desired size, aspect is the same.
- tests.push_back( ImageFittingTestParameters( 2, 4, 8, 8, FittingMode::SHRINK_TO_FIT, 4, 4, ActiveArea( 1, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(2, 4, 8, 8, FittingMode::SHRINK_TO_FIT, 4, 4, ActiveArea(1, 0, 4, 4)));
// Test Image source size > desired size, but aspect different (w < h). Should add borders, AND scale down to desired size.
- tests.push_back( ImageFittingTestParameters( 4, 8, 4, 4, FittingMode::SHRINK_TO_FIT, 4, 4, ActiveArea( 1, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 8, 4, 4, FittingMode::SHRINK_TO_FIT, 4, 4, ActiveArea(1, 0, 4, 4)));
// Test Image source size > desired size, but aspect different (w > h). Should add borders, AND scale down to desired size.
- tests.push_back( ImageFittingTestParameters( 8, 4, 4, 4, FittingMode::SHRINK_TO_FIT, 4, 4, ActiveArea( 0, 1, 4, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(8, 4, 4, 4, FittingMode::SHRINK_TO_FIT, 4, 4, ActiveArea(0, 1, 4, 2)));
- PerformFittingTests( tests );
+ PerformFittingTests(tests);
END_TEST;
}
// Source Width, Source Height, Desired Width, Desired Height, Fitting Mode, Expected Width, Expected Height, ActiveArea: X-start, Y-start, width, height
// Test Image source size = desired size. Output should be the same.
- tests.push_back( ImageFittingTestParameters( 4, 4, 4, 4, FittingMode::SCALE_TO_FILL, 4, 4, ActiveArea( 0, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 4, 4, 4, FittingMode::SCALE_TO_FILL, 4, 4, ActiveArea(0, 0, 4, 4)));
// Test Image source size > desired size, but aspect same. Should scale size down.
- tests.push_back( ImageFittingTestParameters( 4, 4, 2, 2, FittingMode::SCALE_TO_FILL, 2, 2, ActiveArea( 0, 0, 2, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 4, 2, 2, FittingMode::SCALE_TO_FILL, 2, 2, ActiveArea(0, 0, 2, 2)));
// Test Image source size < desired size, but aspect same. Should not scale size up.
- tests.push_back( ImageFittingTestParameters( 2, 2, 4, 4, FittingMode::SCALE_TO_FILL, 2, 2, ActiveArea( 0, 0, 2, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(2, 2, 4, 4, FittingMode::SCALE_TO_FILL, 2, 2, ActiveArea(0, 0, 2, 2)));
// Test Image source size < desired size, but aspect different. Should crop height, so no borders. No scale up as result has same aspect after crop.
- tests.push_back( ImageFittingTestParameters( 2, 4, 8, 8, FittingMode::SCALE_TO_FILL, 2, 2, ActiveArea( 0, 0, 2, 2 ) ) );
+ tests.push_back(ImageFittingTestParameters(2, 4, 8, 8, FittingMode::SCALE_TO_FILL, 2, 2, ActiveArea(0, 0, 2, 2)));
// Test Image source size > desired size, but aspect different (w < h). Should crop height, so no borders. No scale as result is same size as desired size.
- tests.push_back( ImageFittingTestParameters( 4, 8, 4, 4, FittingMode::SCALE_TO_FILL, 4, 4, ActiveArea( 0, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(4, 8, 4, 4, FittingMode::SCALE_TO_FILL, 4, 4, ActiveArea(0, 0, 4, 4)));
// Test Image source size > desired size, but aspect different (w > h). Should crop width, so no borders. No scale as result is same size as desired size.
- tests.push_back( ImageFittingTestParameters( 8, 4, 4, 4, FittingMode::SCALE_TO_FILL, 4, 4, ActiveArea( 0, 0, 4, 4 ) ) );
+ tests.push_back(ImageFittingTestParameters(8, 4, 4, 4, FittingMode::SCALE_TO_FILL, 4, 4, ActiveArea(0, 0, 4, 4)));
- PerformFittingTests( tests );
+ PerformFittingTests(tests);
END_TEST;
}
-
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include "utc-image-loading-common.h"
-double GetTimeMilliseconds( Integration::PlatformAbstraction& abstraction )
+double GetTimeMilliseconds(Integration::PlatformAbstraction& abstraction)
{
timespec timeSpec;
- clock_gettime( CLOCK_MONOTONIC, &timeSpec );
- return ( timeSpec.tv_sec * 1e3 ) + ( timeSpec.tv_nsec / 1e6 );
+ clock_gettime(CLOCK_MONOTONIC, &timeSpec);
+ return (timeSpec.tv_sec * 1e3) + (timeSpec.tv_nsec / 1e6);
}
/** Live platform abstraction recreated for each test case. */
void utc_dali_loading_startup(void)
{
test_return_value = TET_UNDEF;
- gAbstraction = TizenPlatform::CreatePlatformAbstraction();
+ gAbstraction = TizenPlatform::CreatePlatformAbstraction();
// Setup some loading parameters to engage post-processing stages:
ImageParameters scaleToFillAttributes;
scaleToFillAttributes.second.first = FittingMode::SCALE_TO_FILL;
- scaleToFillAttributes.first = ImageDimensions( 160, 120 );
- gCancelAttributes.push_back( scaleToFillAttributes );
+ scaleToFillAttributes.first = ImageDimensions(160, 120);
+ gCancelAttributes.push_back(scaleToFillAttributes);
// Hit the derived dimensions code:
ImageParameters scaleToFillAttributesDeriveWidth = scaleToFillAttributes;
- scaleToFillAttributesDeriveWidth.first = ImageDimensions( 0, 120 );
- gCancelAttributes.push_back( scaleToFillAttributesDeriveWidth );
+ scaleToFillAttributesDeriveWidth.first = ImageDimensions(0, 120);
+ gCancelAttributes.push_back(scaleToFillAttributesDeriveWidth);
ImageParameters scaleToFillAttributesDeriveHeight = scaleToFillAttributes;
- scaleToFillAttributesDeriveHeight.first = ImageDimensions( 160, 0 );
- gCancelAttributes.push_back( scaleToFillAttributesDeriveHeight );
+ scaleToFillAttributesDeriveHeight.first = ImageDimensions(160, 0);
+ gCancelAttributes.push_back(scaleToFillAttributesDeriveHeight);
// Try to push a tall crop:
- ImageParameters scaleToFillAttributesTall = scaleToFillAttributes;
- scaleToFillAttributesTall.first = ImageDimensions( 160, 480 );
+ ImageParameters scaleToFillAttributesTall = scaleToFillAttributes;
+ scaleToFillAttributesTall.first = ImageDimensions(160, 480);
ImageParameters scaleToFillAttributesTall2 = scaleToFillAttributes;
- scaleToFillAttributesTall2.first = ImageDimensions( 160, 509 );
+ scaleToFillAttributesTall2.first = ImageDimensions(160, 509);
ImageParameters scaleToFillAttributesTall3 = scaleToFillAttributes;
- scaleToFillAttributesTall3.first = ImageDimensions( 37, 251 );
- gCancelAttributes.push_back( scaleToFillAttributesTall );
- gCancelAttributes.push_back( scaleToFillAttributesTall2 );
- gCancelAttributes.push_back( scaleToFillAttributesTall3 );
+ scaleToFillAttributesTall3.first = ImageDimensions(37, 251);
+ gCancelAttributes.push_back(scaleToFillAttributesTall);
+ gCancelAttributes.push_back(scaleToFillAttributesTall2);
+ gCancelAttributes.push_back(scaleToFillAttributesTall3);
// Try to push a wide crop:
- ImageParameters scaleToFillAttributesWide = scaleToFillAttributes;
- scaleToFillAttributesWide.first = ImageDimensions( 320, 60 );
+ ImageParameters scaleToFillAttributesWide = scaleToFillAttributes;
+ scaleToFillAttributesWide.first = ImageDimensions(320, 60);
ImageParameters scaleToFillAttributesWide2 = scaleToFillAttributes;
- scaleToFillAttributesWide2.first = ImageDimensions( 317, 60 );
+ scaleToFillAttributesWide2.first = ImageDimensions(317, 60);
ImageParameters scaleToFillAttributesWide3 = scaleToFillAttributes;
- scaleToFillAttributesWide3.first = ImageDimensions( 317, 53 );
- gCancelAttributes.push_back( scaleToFillAttributesWide );
- gCancelAttributes.push_back( scaleToFillAttributesWide2 );
- gCancelAttributes.push_back( scaleToFillAttributesWide3 );
+ scaleToFillAttributesWide3.first = ImageDimensions(317, 53);
+ gCancelAttributes.push_back(scaleToFillAttributesWide);
+ gCancelAttributes.push_back(scaleToFillAttributesWide2);
+ gCancelAttributes.push_back(scaleToFillAttributesWide3);
ImageParameters shrinkToFitAttributes = scaleToFillAttributes;
- shrinkToFitAttributes.second.first = FittingMode::SHRINK_TO_FIT;
- gCancelAttributes.push_back( shrinkToFitAttributes );
+ shrinkToFitAttributes.second.first = FittingMode::SHRINK_TO_FIT;
+ gCancelAttributes.push_back(shrinkToFitAttributes);
ImageParameters fitWidthAttributes = scaleToFillAttributes;
- fitWidthAttributes.second.first = FittingMode::FIT_WIDTH;
- gCancelAttributes.push_back( fitWidthAttributes );
+ fitWidthAttributes.second.first = FittingMode::FIT_WIDTH;
+ gCancelAttributes.push_back(fitWidthAttributes);
ImageParameters fitHeightAttributes = scaleToFillAttributes;
- fitHeightAttributes.second.first = FittingMode::FIT_HEIGHT;
- gCancelAttributes.push_back( fitHeightAttributes );
+ fitHeightAttributes.second.first = FittingMode::FIT_HEIGHT;
+ gCancelAttributes.push_back(fitHeightAttributes);
///@ToDo: Add attribute variants for all scale modes.
///@ToDo: Add attribute variants for all filter modes.
// Pad the array to a prime number to mitigate any accidental periodic
// patterns in which image file has which attributes applied to its load:
- srand48( 104729 );
+ srand48(104729);
const float lastUniques = gCancelAttributes.size() - 0.001f;
- while( gCancelAttributes.size() < 61u )
+ while(gCancelAttributes.size() < 61u)
{
- gCancelAttributes.push_back( gCancelAttributes[unsigned(drand48() * lastUniques)] );
+ gCancelAttributes.push_back(gCancelAttributes[unsigned(drand48() * lastUniques)]);
}
}
#ifndef DALI_TEST_SUITE_IMAGE_LOADING_COMMON_H
#define DALI_TEST_SUITE_IMAGE_LOADING_COMMON_H
-#include <unistd.h>
-#include <iostream>
-#include <stdlib.h>
-#include <ctime>
-#include <dali/dali.h>
#include <dali-test-suite-utils.h>
+#include <dali/dali.h>
#include <dali/internal/legacy/common/tizen-platform-abstraction.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctime>
+#include <iostream>
using namespace Dali;
using namespace Dali::Integration;
TEST_IMAGE_DIR "/fractal-compressed-ETC1_RGB8_OES-45x80.ktx",
TEST_IMAGE_DIR "/fractal-compressed-RGBA_ASTC_4x4_KHR-32x64.astc",
TEST_IMAGE_DIR "/test-image-4x4-32bpp.ico",
- TEST_IMAGE_DIR "/test-image.wbmp"
-};
+ TEST_IMAGE_DIR "/test-image.wbmp"};
const unsigned NUM_VALID_IMAGES = sizeof(VALID_IMAGES) / sizeof(VALID_IMAGES[0]);
-} // anon namespace
+} // namespace
/** Live platform abstraction recreated for each test case. */
extern TizenPlatform::TizenPlatformAbstraction* gAbstraction;
/** A variety of parameters to reach different code paths in the image loading. */
typedef std::pair<ImageDimensions, std::pair<FittingMode::Type, std::pair<SamplingMode::Type, bool> > > ImageParameters;
-extern std::vector<ImageParameters> gCancelAttributes;
+extern std::vector<ImageParameters> gCancelAttributes;
-double GetTimeMilliseconds( Integration::PlatformAbstraction& abstraction ); ///< Returns elapsed milliseconds.
+double GetTimeMilliseconds(Integration::PlatformAbstraction& abstraction); ///< Returns elapsed milliseconds.
void utc_dali_loading_startup(void);
void utc_dali_loading_cleanup(void);