int UtSurface::width = 720;
int UtSurface::height = 1024;
tbm_format UtSurface::format;
-int UtSurface::num_formats;
+uint32_t UtSurface::num_formats;
tbm_format *UtSurface::formats;
void UtSurface::SetUpTestCase()
ut_set_default_tbm_env();
- result = tbm_surface_query_formats(&formats, &num_formats);
+ result = (tbm_surface_error_e)tbm_surface_query_formats(&formats, &num_formats);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
- for (int i = 0; i < num_formats; i++)
+ for (uint32_t i = 0; i < num_formats; i++)
if (formats[i] == TBM_FORMAT_ARGB8888)
format = TBM_FORMAT_ARGB8888;
int UtSurfaceQueue::width = 720;
int UtSurfaceQueue::height = 1024;
int UtSurfaceQueue::format;
-int UtSurfaceQueue::num_formats;
-int *UtSurfaceQueue::formats;
+uint32_t UtSurfaceQueue::num_formats;
+tbm_format *UtSurfaceQueue::formats;
void UtSurfaceQueue::SetUpTestCase()
{
ut_set_default_tbm_env();
- result = tbm_surface_query_formats(&formats, &num_formats);
+ result = (tbm_surface_error_e)tbm_surface_query_formats(&formats, &num_formats);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
- for (int i = 0; i < num_formats; i++)
+ for (uint32_t i = 0; i < num_formats; i++)
if (formats[i] == TBM_FORMAT_ARGB8888)
format = TBM_FORMAT_ARGB8888;
void UtSurfaceQueue::SetUp()
{
alien_surface = tbm_surface_create(width, height, format);
- ASSERT_NE(NULL, alien_surface);
+ ASSERT_NE((tbm_surface_h)NULL, alien_surface);
queue = tbm_surface_queue_create(QUEUE_SIZE, width, height, format, TBM_BO_DEFAULT);
- ASSERT_NE(NULL, queue);
+ ASSERT_NE((tbm_surface_queue_h)NULL, queue);
}
void UtSurfaceQueue::TearDown()
static int height;
static tbm_format format;
- static int num_formats;
+ static uint32_t num_formats;
static tbm_format *formats;
tbm_surface_h surface;
static int height;
static int format;
- static int num_formats;
- static int *formats;
+ static uint32_t num_formats;
+ static tbm_format *formats;
tbm_surface_h alien_surface;
tbm_surface_queue_h queue;
ASSERT_TRUE(bufmgr == bufmgr2);
bo = tbm_bo_alloc(bufmgr, 128 * 128, TBM_BO_DEFAULT);
- ASSERT_NE(bo, NULL);
+ ASSERT_NE(nullptr, bo);
}
/* tbm_bo_alloc() */
bo = tbm_bo_alloc(NULL, 128 * 128, TBM_BO_DEFAULT);
- ASSERT_EQ(bo, NULL);
+ ASSERT_EQ(nullptr, bo);
}
TEST_F(UtBufmgrInit, BoAllocFailSizeLessThenZero)
bo = tbm_bo_alloc(bufmgr, -1, TBM_BO_DEFAULT);
- ASSERT_EQ(bo, NULL);
+ ASSERT_EQ(nullptr, bo);
}
TEST_F(UtBufmgrInit, BoAllocFailNoValidBufmgr)
bo = tbm_bo_alloc((tbm_bufmgr)&bufmgr, -1, TBM_BO_DEFAULT);
- ASSERT_EQ(bo, NULL);
+ ASSERT_EQ(nullptr, bo);
}
TEST_F(UtBufmgrInit, BoAllocSuccess)
ret_bo = tbm_bo_alloc(bufmgr, 128 * 128, TBM_BO_DEFAULT);
- ASSERT_NE(ret_bo, NULL);
+ ASSERT_NE(nullptr, ret_bo);
}
/* tbm_bo_ref() */
ret_bo = tbm_bo_ref((tbm_bo)&bo);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
TEST_F(UtBufmgrInit, BoRefFailNullBo)
ret_bo = tbm_bo_ref(NULL);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
TEST_F(UtBufmgrInit, BoRefFailNoValidBo)
ret_bo = tbm_bo_ref((tbm_bo)&bo);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
TEST_F(UtBoInit, BoRefSuccess)
ret_bo = tbm_bo_ref(bo);
- ASSERT_NE(ret_bo, NULL);
+ ASSERT_NE(nullptr, ret_bo);
}
/* tbm_bo_unref() */
ret_bo = tbm_bo_ref(bo);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
/* tbm_bo_map() */
bo_handle = tbm_bo_map((tbm_bo)&bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
- ASSERT_EQ(bo_handle.ptr, NULL);
+ ASSERT_EQ(nullptr, bo_handle.ptr);
}
TEST_F(UtBufmgrInit, BoMapFailNullBo)
bo_handle = tbm_bo_map(NULL, TBM_DEVICE_CPU, TBM_OPTION_READ);
- ASSERT_EQ(bo_handle.ptr, NULL);
+ ASSERT_EQ(nullptr, bo_handle.ptr);
}
TEST_F(UtBufmgrInit, BoMapFailNoValidBo)
bo_handle = tbm_bo_map((tbm_bo)&bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
- ASSERT_EQ(bo_handle.ptr, NULL);
+ ASSERT_EQ(nullptr, bo_handle.ptr);
}
TEST_F(UtBoInit, BoMapSuccess)
bo_handle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
- ASSERT_NE(bo_handle.ptr, NULL);
+ ASSERT_NE(nullptr, bo_handle.ptr);
}
/* tbm_bo_unmap() */
tbm_bo_handle bo_handle;
bo_handle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
- ASSERT_NE(bo_handle.ptr, NULL);
+ ASSERT_NE(nullptr, bo_handle.ptr);
ret = tbm_bo_unmap(bo);
bo_handle = tbm_bo_get_handle((tbm_bo)&bo, TBM_DEVICE_DEFAULT);
- ASSERT_EQ(bo_handle.ptr, NULL);
+ ASSERT_EQ(nullptr, bo_handle.ptr);
}
TEST_F(UtBufmgrInit, BoGetHandleFailNullBo)
bo_handle = tbm_bo_get_handle(NULL, TBM_DEVICE_DEFAULT);
- ASSERT_EQ(bo_handle.ptr, NULL);
+ ASSERT_EQ(nullptr, bo_handle.ptr);
}
TEST_F(UtBufmgrInit, BoGetHandleFailNoValidBo)
bo_handle = tbm_bo_get_handle((tbm_bo)&bo, TBM_DEVICE_DEFAULT);
- ASSERT_EQ(bo_handle.ptr, NULL);
+ ASSERT_EQ(nullptr, bo_handle.ptr);
}
TEST_F(UtBoInit, BoGetHandleSuccess)
bo_handle = tbm_bo_get_handle(bo, TBM_DEVICE_DEFAULT);
- ASSERT_NE(bo_handle.ptr, NULL);
+ ASSERT_NE(nullptr, bo_handle.ptr);
}
/* tbm_bo_export() */
ret_key = tbm_bo_export(bo);
- ASSERT_NE(ret_key, NULL);
+ ASSERT_NE(0, ret_key);
}
/* tbmBoExportfd() */
ret_bo = tbm_bo_import((tbm_bufmgr)&bufmgr, 20);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
TEST_F(UtBufmgrInit, BoImportFailNullBufmgr)
ret_bo = tbm_bo_import(NULL, 20);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
TEST_F(UtBufmgrInit, BoImportFailNoValidBufmgr)
ret_bo = tbm_bo_import((tbm_bufmgr)&bufmgr, 20);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
TEST_F(UtBufmgrInit, BoImportFailNoValidKey)
ret_bo = tbm_bo_import(bufmgr, 20);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
TEST_F(UtBoInit, BoImportSuccess)
ret_bo = tbm_bo_import(bufmgr, exported_bo_key);
- ASSERT_NE(ret_bo, NULL);
+ ASSERT_NE(nullptr, ret_bo);
}
TEST_F(UtBoInit, BoImportSuccessWhenWeImportTwice)
ASSERT_NE(exported_bo_key, 0);
ret_bo_1 = tbm_bo_import(bufmgr, exported_bo_key);
- ASSERT_NE(ret_bo_1, NULL);
+ ASSERT_NE(nullptr, ret_bo_1);
ret_bo_2 = tbm_bo_import(bufmgr, exported_bo_key);
- ASSERT_NE(ret_bo_2, NULL);
+ ASSERT_NE(nullptr, ret_bo_2);
ASSERT_EQ(ret_bo_1, ret_bo_2);
}
ret_bo = tbm_bo_import_fd((tbm_bufmgr)&bufmgr, 20);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
TEST_F(UtBufmgrInit, BoImportFdFailNullBufmgr)
ret_bo = tbm_bo_import_fd(NULL, 20);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
TEST_F(UtBufmgrInit, BoImportFdFailNoValidBufmgr)
ret_bo = tbm_bo_import_fd((tbm_bufmgr)&bufmgr, 20);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
TEST_F(UtBufmgrInit, BoImportFdFailNoValidFd)
ret_bo = tbm_bo_import_fd(bufmgr, 20);
- ASSERT_EQ(ret_bo, NULL);
+ ASSERT_EQ(nullptr, ret_bo);
}
TEST_F(UtBoInit, BoImportFdSuccess)
ret_bo = tbm_bo_import_fd(bufmgr, exported_bo_fd);
- ASSERT_NE(ret_bo, NULL);
+ ASSERT_NE(nullptr, ret_bo);
}
TEST_F(UtBoInit, BoImportFdSuccessWhenWeImportTwice)
ASSERT_NE(exported_bo_fd, 0);
ret_bo_1 = tbm_bo_import_fd(bufmgr, exported_bo_fd);
- ASSERT_NE(ret_bo_1, NULL);
+ ASSERT_NE(nullptr, ret_bo_1);
ret_bo_2 = tbm_bo_import_fd(bufmgr, exported_bo_fd);
- ASSERT_NE(ret_bo_2, NULL);
+ ASSERT_NE(nullptr, ret_bo_2);
ASSERT_EQ(ret_bo_1, ret_bo_2);
}
UtBufmgrInit();
bo = tbm_bo_alloc(bufmgr, 128 * 128, TBM_BO_DEFAULT);
- ASSERT_NE(bo, NULL);
+ ASSERT_NE(nullptr, bo);
bo_handle1 = tbm_bo_map(bo, TBM_DEVICE_2D, TBM_OPTION_READ | TBM_OPTION_WRITE);
bo_handle2 = tbm_bo_map(bo, TBM_DEVICE_2D, TBM_OPTION_READ | TBM_OPTION_WRITE);
UtBufmgrInit();
bo = tbm_bo_alloc(bufmgr, 128 * 128, TBM_BO_DEFAULT);
- ASSERT_NE(bo, NULL);
+ ASSERT_NE(nullptr, bo);
bo_handle1 = tbm_bo_map(bo, TBM_DEVICE_2D, TBM_OPTION_READ | TBM_OPTION_WRITE);
bo_handle2 = tbm_bo_map(bo, TBM_DEVICE_2D, TBM_OPTION_READ | TBM_OPTION_WRITE);
UtBufmgrInit();
bo = tbm_bo_alloc(bufmgr, 128 * 128, TBM_BO_DEFAULT);
- ASSERT_NE(bo, NULL);
+ ASSERT_NE(nullptr, bo);
bo_handle1 = tbm_bo_map(bo, TBM_DEVICE_2D, TBM_OPTION_READ | TBM_OPTION_WRITE);
(void) bo_handle1;
int bo1, bo2;
int ret;
- ret = tbm_bo_swap((tbm_bo)&bo1, (tbm_bo)&bo1);
+ ret = tbm_bo_swap((tbm_bo)&bo1, (tbm_bo)&bo2);
ASSERT_EQ(ret, 0);
}
TEST_F(UtBoInit, BoSwapFailNoValidBo1)
{
- int bo1;
int ret;
ret = tbm_bo_swap((tbm_bo)&bo, bo);
tbm_error_e error;
bo1 = tbm_bo_alloc(bufmgr, 128 * 128, TBM_BO_DEFAULT);
- ASSERT_NE(bo1, NULL);
+ ASSERT_NE(nullptr, bo1);
bo2 = tbm_bo_alloc(bufmgr, 256 * 256, TBM_BO_DEFAULT);
- ASSERT_NE(bo2, NULL);
+ ASSERT_NE(nullptr, bo2);
ret = tbm_bo_swap(bo1, bo2);
int ret;
bo1 = tbm_bo_alloc(bufmgr, 128 * 128, TBM_BO_DEFAULT);
- ASSERT_NE(bo1, NULL);
+ ASSERT_NE(nullptr, bo1);
bo2 = tbm_bo_alloc(bufmgr, 128 * 128, TBM_BO_DEFAULT);
- ASSERT_NE(bo2, NULL);
+ ASSERT_NE(nullptr, bo2);
ret = tbm_bo_swap(bo1, bo2);
TEST_F(UtBoInit, BoAddUserDataFailNoValidBo)
{
- int bo1;
int ret;
ret = tbm_bo_add_user_data((tbm_bo)&bo, 4887, NULL);
TEST_F(UtBoInit, BoAddUserDataSuccess)
{
- int bo1;
int ret;
ret = tbm_bo_add_user_data(bo, 4887, NULL);
TEST_F(UtBoInit, BoAddUserDataFailDataAlreadyExist)
{
- int bo1;
int ret;
ret = tbm_bo_add_user_data(bo, 4887, NULL);
TEST_F(UtInit, SurfaceQueryFormatsFailNull)
{
- int num = 0;
+ uint32_t num = 0;
tbm_format *formats = NULL;
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
ut_set_default_tbm_env();
- result = tbm_surface_query_formats(&formats, NULL);
+ result = (tbm_surface_error_e)tbm_surface_query_formats(&formats, NULL);
ASSERT_EQ(TBM_SURFACE_ERROR_INVALID_PARAMETER, result);
- result = tbm_surface_query_formats(NULL, &num);
+ result = (tbm_surface_error_e)tbm_surface_query_formats(NULL, &num);
ASSERT_EQ(TBM_SURFACE_ERROR_INVALID_PARAMETER, result);
}
TEST_F(UtInit, SurfaceQueryFormatSuccess)
{
- int num = 0;
+ uint32_t num = 0;
tbm_format *formats = NULL;
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
ut_set_default_tbm_env();
- result = tbm_surface_query_formats(&formats, &num);
+ result = (tbm_surface_error_e)tbm_surface_query_formats(&formats, &num);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
ASSERT_NE(0, num);
- ASSERT_NE(NULL, formats);
- for (int i = 0; i < num; i++)
+ ASSERT_NE((tbm_format *)NULL, formats);
+ for (uint32_t i = 0; i < num; i++)
ASSERT_NE(0, formats[i]);
free(formats);
}
ut_set_default_tbm_env();
surface = tbm_surface_create(-1, 1024, TBM_FORMAT_ARGB8888);
- ASSERT_EQ(NULL, surface); // Expected Value: NULL
+ ASSERT_EQ(nullptr, surface); // Expected Value: NULL
surface = tbm_surface_create(720, -1, TBM_FORMAT_ARGB8888);
- ASSERT_EQ(NULL, surface);
+ ASSERT_EQ(nullptr, surface);
surface = tbm_surface_create(720, 1024, 0);
- ASSERT_EQ(NULL, surface);
+ ASSERT_EQ(nullptr, surface);
}
TEST_F(UtInit, SurfaceCeateSuccess)
{
tbm_surface_h surface = NULL;
- int num = 0;
+ uint32_t num = 0;
tbm_format *formats = NULL;
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
ut_set_default_tbm_env();
- result = tbm_surface_query_formats(&formats, &num);
+ result = (tbm_surface_error_e)tbm_surface_query_formats(&formats, &num);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
- for (int i = 0; i < num; i++) {
+ for (uint32_t i = 0; i < num; i++) {
surface = tbm_surface_create(720, 1024, formats[i]);
- ASSERT_NE(NULL, surface);
- result = tbm_surface_destroy(surface);
+ ASSERT_NE((tbm_surface_h)NULL, surface);
+ result = (tbm_surface_error_e)tbm_surface_destroy(surface);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
}
}
tbm_surface_info_s info;
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
- result = tbm_surface_get_info(invalid_surface, &info);
+ result = (tbm_surface_error_e)tbm_surface_get_info(invalid_surface, &info);
ASSERT_EQ(TBM_SURFACE_ERROR_INVALID_OPERATION, result);
}
tbm_surface_info_s info;
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
- result = tbm_surface_get_info(surface, NULL);
+ result = (tbm_surface_error_e)tbm_surface_get_info(surface, NULL);
ASSERT_EQ(TBM_SURFACE_ERROR_INVALID_PARAMETER, result);
- result = tbm_surface_get_info(NULL, &info);
+ result = (tbm_surface_error_e)tbm_surface_get_info(NULL, &info);
ASSERT_EQ(TBM_SURFACE_ERROR_INVALID_PARAMETER, result);
- result = tbm_surface_get_info(NULL, NULL);
+ result = (tbm_surface_error_e)tbm_surface_get_info(NULL, NULL);
ASSERT_EQ(TBM_SURFACE_ERROR_INVALID_PARAMETER, result);
}
tbm_surface_info_s info;
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
- result = tbm_surface_get_info(surface, &info);
+ result = (tbm_surface_error_e)tbm_surface_get_info(surface, &info);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
ASSERT_EQ(this->format, info.format);
ASSERT_EQ(this->height, info.height);
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
tbm_surface_h invalid_surface = (tbm_surface_h)1;
- result = tbm_surface_map(invalid_surface, 0, &info);
+ result = (tbm_surface_error_e)tbm_surface_map(invalid_surface, 0, &info);
ASSERT_EQ(TBM_SURFACE_ERROR_INVALID_OPERATION, result);
}
tbm_surface_info_s info;
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
- result = tbm_surface_map(surface, 0, NULL);
+ result = (tbm_surface_error_e)tbm_surface_map(surface, 0, NULL);
ASSERT_EQ(TBM_SURFACE_ERROR_INVALID_PARAMETER, result);
- result = tbm_surface_map(NULL, 0, &info);
+ result = (tbm_surface_error_e)tbm_surface_map(NULL, 0, &info);
ASSERT_EQ(TBM_SURFACE_ERROR_INVALID_PARAMETER, result);
}
tbm_surface_info_s info;
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
- result = tbm_surface_map(surface, 0, &info);
+ result = (tbm_surface_error_e)tbm_surface_map(surface, 0, &info);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
ASSERT_EQ(this->format, info.format);
ASSERT_EQ(this->height, info.height);
ASSERT_GT(info.bpp, 0);
ASSERT_GT(info.size, 0);
- result = tbm_surface_unmap(surface);
+ result = (tbm_surface_error_e)tbm_surface_unmap(surface);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
}
{
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
tbm_surface_h invalid_surface = (tbm_surface_h)1;
- result = tbm_surface_unmap(invalid_surface);
+ result = (tbm_surface_error_e)tbm_surface_unmap(invalid_surface);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
}
{
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
- result = tbm_surface_unmap(NULL);
+ result = (tbm_surface_error_e)tbm_surface_unmap(NULL);
ASSERT_EQ(TBM_SURFACE_ERROR_INVALID_PARAMETER, result);
}
/* int tbm_surface_internal_query_supported_formats(uint32_t **formats, uint32_t *num) */
TEST_F(UtInit, SurfaceInternalQueryFormatsFailNull)
{
- int num = 0;
+ uint32_t num = 0;
tbm_format *formats = NULL;
ut_set_default_tbm_env();
TEST_F(UtInit, SurfaceInternalQueryFormatsSuccess)
{
- int num = 0;
+ uint32_t num = 0;
tbm_format *formats = NULL;
ut_set_default_tbm_env();
ASSERT_TRUE(tbm_surface_internal_query_supported_formats(&formats, &num));
ASSERT_NE(0, num);
- ASSERT_NE(NULL, formats);
- for (int i = 0; i < num; i++)
+ ASSERT_NE((tbm_format *)NULL, formats);
+ for (uint32_t i = 0; i < num; i++)
ASSERT_NE(0, formats[i]);
if (formats)
ut_set_default_tbm_env();
surface = tbm_surface_internal_create_with_flags(-1, 1024, TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT);
- ASSERT_EQ(NULL, surface); // Expected Value: NULL
+ ASSERT_EQ(nullptr, surface); // Expected Value: NULL
surface = tbm_surface_internal_create_with_flags(720, -1, TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT);
- ASSERT_EQ(NULL, surface);
+ ASSERT_EQ(nullptr, surface);
surface = tbm_surface_internal_create_with_flags(720, 1024, 0, TBM_BO_DEFAULT);
- ASSERT_EQ(NULL, surface);
+ ASSERT_EQ(nullptr, surface);
surface = tbm_surface_internal_create_with_flags(720, 1024, 0, (TBM_BO_WC << 1));
- ASSERT_EQ(NULL, surface);
+ ASSERT_EQ(nullptr, surface);
}
TEST_F(UtInit, SurfaceInternalCeatewithFlagsSuccess)
{
tbm_surface_h surface = NULL;
- int num = 0;
+ uint32_t num = 0;
tbm_format *formats = NULL;
ut_set_default_tbm_env();
ASSERT_TRUE(tbm_surface_internal_query_supported_formats(&formats, &num));
- for (int i = 0; i < num; i++) {
+ for (uint32_t i = 0; i < num; i++) {
surface = tbm_surface_internal_create_with_flags(720, 1024, formats[i], TBM_BO_DEFAULT);
- ASSERT_NE(NULL, surface);
+ ASSERT_NE(nullptr, surface);
tbm_surface_internal_destroy(surface);
}
TEST_F(UtInit, SurfaceInteranlDestroyFailTwice)
{
tbm_surface_h surface = NULL;
- int num = 0;
+ uint32_t num = 0;
tbm_format *formats = NULL;
ASSERT_TRUE(tbm_surface_internal_query_supported_formats(&formats, &num));
TEST_F(UtSurfaceInternal, GetBoFailNULL)
{
tbm_bo bo = tbm_surface_internal_get_bo(NULL, 0);
- ASSERT_EQ(NULL, bo);
+ ASSERT_EQ(nullptr, bo);
}
TEST_F(UtSurfaceInternal, GetBoFailInvalideInput)
/* invalid surface */
bo = tbm_surface_internal_get_bo(invalide_surface, 0);
- ASSERT_EQ(NULL, bo);
+ ASSERT_EQ(nullptr, bo);
num = tbm_surface_internal_get_num_bos(surface);
ASSERT_TRUE(num > 0);
/* invalid index of bo */
bo = tbm_surface_internal_get_bo(surface, -1);
- ASSERT_EQ(NULL, bo);
+ ASSERT_EQ(nullptr, bo);
bo = tbm_surface_internal_get_bo(surface, num);
- ASSERT_EQ(NULL, bo);
+ ASSERT_EQ(nullptr, bo);
}
TEST_F(UtSurfaceInternal, GetBoSuccess)
for (int i = 0; i < num; i++) {
bo = tbm_surface_internal_get_bo(surface, i);
- ASSERT_NE(NULL, bo);
+ ASSERT_NE((tbm_bo)NULL, bo);
}
}
tbm_surface_error_e result = TBM_SURFACE_ERROR_NONE;
tbm_bo bos[1];
- result = tbm_surface_get_info(surface, &info);
+ result = (tbm_surface_error_e)tbm_surface_get_info(surface, &info);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
surf = tbm_surface_internal_create_with_bos(NULL, NULL, 1);
surf = tbm_surface_internal_create_with_bos(&info, NULL, 1);
- ASSERT_EQ(NULL, surf);
+ ASSERT_EQ(nullptr, surf);
surf = tbm_surface_internal_create_with_bos(NULL, bos, 1);
- ASSERT_EQ(NULL, surf);
+ ASSERT_EQ(nullptr, surf);
}
TEST_F(UtSurfaceInternal, CreateWithBosFailInvalidInput)
tbm_bo bos[4] = { NULL };
int num;
- result = tbm_surface_get_info(surface, &info);
+ result = (tbm_surface_error_e)tbm_surface_get_info(surface, &info);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
num = tbm_surface_internal_get_num_bos(surface);
for (int i = 0; i < num; i++) {
bos[i] = tbm_surface_internal_get_bo(surface, i);
- ASSERT_NE(NULL, bos[i]);
+ ASSERT_NE(nullptr, bos[i]);
}
/* wrong number of bo */
surf = tbm_surface_internal_create_with_bos(&info, bos, num + 1);
- ASSERT_EQ(NULL, surf);
+ ASSERT_EQ(nullptr, surf);
surf = tbm_surface_internal_create_with_bos(&info, bos, num - 1);
- ASSERT_EQ(NULL, surf);
+ ASSERT_EQ(nullptr, surf);
/* invalid bo */
bos[num-1] = NULL;
surf = tbm_surface_internal_create_with_bos(&info, bos, num);
- ASSERT_EQ(NULL, surf);
+ ASSERT_EQ(nullptr, surf);
}
TEST_F(UtSurfaceInternal, CreateWithBosSuccess)
tbm_bo bos[4] = { NULL };
int num = 0;
- result = tbm_surface_get_info(surface, &info);
+ result = (tbm_surface_error_e)tbm_surface_get_info(surface, &info);
ASSERT_EQ(TBM_SURFACE_ERROR_NONE, result);
num = tbm_surface_internal_get_num_bos(surface);
for (int i = 0; i < num; i++) {
bos[i] = tbm_surface_internal_get_bo(surface, i);
- ASSERT_NE(NULL, bos[i]);
+ ASSERT_NE(nullptr, bos[i]);
}
surf = tbm_surface_internal_create_with_bos(&info, bos, num);
- ASSERT_NE(NULL, surf);
+ ASSERT_NE(nullptr, surf);
tbm_surface_internal_destroy(surf);
/* set size plane to zero*/
info.planes[0].size = 0;
surf = tbm_surface_internal_create_with_bos(&info, bos, num);
- ASSERT_NE(NULL, surf);
+ ASSERT_NE(nullptr, surf);
tbm_surface_internal_destroy(surf);
/* set bpp to zero*/
info.bpp = 0;
surf = tbm_surface_internal_create_with_bos(&info, bos, num);
- ASSERT_NE(NULL, surf);
+ ASSERT_NE(nullptr, surf);
tbm_surface_internal_destroy(surf);
/* set size to zero*/
info.size = 0;
surf = tbm_surface_internal_create_with_bos(&info, bos, num);
- ASSERT_NE(NULL, surf);
+ ASSERT_NE(nullptr, surf);
tbm_surface_internal_destroy(surf);
}
void data_free_handle(void *user_data)
{
ASSERT_TRUE(user_data == &tbm_data_free_is_called);
- int * is_called = user_data;
- *((int *)user_data) = 1;
+ int *is_called = (int *)user_data;
+ *is_called = 1;
}
/* tbm_surface_internal_add_user_data(tbm_surface_h surface, unsigned long key, tbm_data_free data_free_func) */
TEST_F(UtSurfaceInternal, AddUserDataFailNull)
{
- static const int key_ud;
- ASSERT_FALSE(tbm_surface_internal_add_user_data(NULL, &key_ud, NULL));
+ static const unsigned long key_ud = 0;
+ ASSERT_FALSE(tbm_surface_internal_add_user_data(NULL, key_ud, NULL));
}
TEST_F(UtSurfaceInternal, AddUserDataFailInvaildInput)
{
- static const int key_ud;
+ static const unsigned long key_ud = 0;
int surf;
- ASSERT_FALSE(tbm_surface_internal_add_user_data((tbm_surface_h)&surf, &key_ud, NULL));
+ ASSERT_FALSE(tbm_surface_internal_add_user_data((tbm_surface_h)&surf, key_ud, NULL));
}
TEST_F(UtSurfaceInternal, AddUserDataSuccess)
{
- int key_ud;
- ASSERT_TRUE(tbm_surface_internal_add_user_data(surface, &key_ud, NULL));
+ unsigned long key_ud;
+ ASSERT_TRUE(tbm_surface_internal_add_user_data(surface, key_ud, NULL));
}
TEST_F(UtSurfaceInternal, AddUserDataFailDoubleKey)
{
- int key_ud;
- ASSERT_TRUE(tbm_surface_internal_add_user_data(surface, &key_ud, NULL));
+ unsigned long key_ud;
+ ASSERT_TRUE(tbm_surface_internal_add_user_data(surface, key_ud, NULL));
- ASSERT_FALSE(tbm_surface_internal_add_user_data(surface, &key_ud, NULL));
+ ASSERT_FALSE(tbm_surface_internal_add_user_data(surface, key_ud, NULL));
}
/* tbm_surface_internal_set_user_data(tbm_surface_h surface, unsigned long key, void *data) */
TEST_F(UtSurfaceInternal, SetUserDataFailNull)
{
- static const int key_ud;
- ASSERT_FALSE(tbm_surface_internal_set_user_data(NULL, &key_ud, &tbm_data_free_is_called));
+ static const unsigned long key_ud = 0;
+ ASSERT_FALSE(tbm_surface_internal_set_user_data(NULL, key_ud, &tbm_data_free_is_called));
}
TEST_F(UtSurfaceInternal, SetUserDataFailInvaildInput)
{
- static const int key_ud;
+ static const unsigned long key_ud = 0;
int surf;
ASSERT_FALSE(tbm_surface_internal_set_user_data(surface,
- &key_ud, &tbm_data_free_is_called)) << "invalid key";
+ key_ud, &tbm_data_free_is_called)) << "invalid key";
ASSERT_FALSE(tbm_surface_internal_set_user_data((tbm_surface_h)&surf,
- &key_ud, &tbm_data_free_is_called)) << "invalid surface";
+ key_ud, &tbm_data_free_is_called)) << "invalid surface";
}
TEST_F(UtSurfaceInternal, SetUserDataSuccess)
{
- int key_ud;
- ASSERT_TRUE(tbm_surface_internal_add_user_data(surface, &key_ud, data_free_handle));
+ unsigned long key_ud;
+ ASSERT_TRUE(tbm_surface_internal_add_user_data(surface, key_ud, data_free_handle));
/*the first call*/
- ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, &key_ud, &tbm_data_free_is_called));
+ ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, key_ud, &tbm_data_free_is_called));
/*the second call: previous data has to be released*/
tbm_data_free_is_called = 0;
- ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, &key_ud, NULL));
+ ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, key_ud, NULL));
ASSERT_TRUE(tbm_data_free_is_called);
/*the third call: previous data(NULL) hasn't to be released*/
tbm_data_free_is_called = 0;
- ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, &key_ud, NULL));
+ ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, key_ud, NULL));
ASSERT_FALSE(tbm_data_free_is_called);
}
/* tbm_surface_internal_get_user_data(tbm_surface_h surface, unsigned long key, void **data) */
TEST_F(UtSurfaceInternal, GetUserDataFailNull)
{
- static const int key_ud;
- int * data = NULL;
- ASSERT_FALSE(tbm_surface_internal_get_user_data(NULL, &key_ud, &data));
+ static const unsigned long key_ud = 0;
+ int *data = NULL;
+ ASSERT_FALSE(tbm_surface_internal_get_user_data(NULL, key_ud, (void **)&data));
- ASSERT_FALSE(tbm_surface_internal_get_user_data(surface, &key_ud, NULL));
+ ASSERT_FALSE(tbm_surface_internal_get_user_data(surface, key_ud, NULL));
}
TEST_F(UtSurfaceInternal, GetUserDataFailInvaildInput)
{
- static const int key_ud;
+ static const unsigned long key_ud = 0;
int surf;
- int * data = NULL;
+ int *data = NULL;
ASSERT_FALSE(tbm_surface_internal_get_user_data(surface,
- &key_ud, &data)) << "invalid key";
+ key_ud, (void **)&data)) << "invalid key" << std::endl;
ASSERT_FALSE(tbm_surface_internal_get_user_data((tbm_surface_h)&surf,
- &key_ud, &data)) << "invalid surface";
+ key_ud, (void **)&data)) << "invalid surface" << std::endl;
}
TEST_F(UtSurfaceInternal, GetUserDataSuccess)
{
- int key_ud;
- int * data = NULL;
+ unsigned long key_ud;
+ int *data = NULL;
- ASSERT_TRUE(tbm_surface_internal_add_user_data(surface, &key_ud, data_free_handle));
- ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, &key_ud, &tbm_data_free_is_called));
+ ASSERT_TRUE(tbm_surface_internal_add_user_data(surface, key_ud, data_free_handle));
+ ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, key_ud, &tbm_data_free_is_called));
/* check set data */
- ASSERT_TRUE(tbm_surface_internal_get_user_data(surface, &key_ud, &data));
+ ASSERT_TRUE(tbm_surface_internal_get_user_data(surface, key_ud, (void **)&data));
ASSERT_TRUE(data == &tbm_data_free_is_called);
/* check if data is NULL */
- ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, &key_ud, NULL));
- ASSERT_TRUE(tbm_surface_internal_get_user_data(surface, &key_ud, &data));
+ ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, key_ud, NULL));
+ ASSERT_TRUE(tbm_surface_internal_get_user_data(surface, key_ud, (void **)&data));
ASSERT_TRUE(data == NULL);
}
/* tbm_surface_internal_delete_user_data(tbm_surface_h surface, unsigned long key) */
TEST_F(UtSurfaceInternal, DeleteUserDataFailNull)
{
- static const int key_ud;
- ASSERT_FALSE(tbm_surface_internal_delete_user_data(NULL, &key_ud));
+ static const int key_ud = 0;
+ ASSERT_FALSE(tbm_surface_internal_delete_user_data(NULL, key_ud));
}
TEST_F(UtSurfaceInternal, DeleteUserDataFailInvaildInput)
{
- static const int key_ud;
+ static const int key_ud = 0;
int surf;
- ASSERT_FALSE(tbm_surface_internal_delete_user_data(surface, &key_ud)) << "invalid key";
-
- ASSERT_FALSE(tbm_surface_internal_delete_user_data((tbm_surface_h)&surf, &key_ud)) << "invalid surface";
+ ASSERT_FALSE(tbm_surface_internal_delete_user_data(surface, key_ud)) << "invalid key";
+ ASSERT_FALSE(tbm_surface_internal_delete_user_data((tbm_surface_h)&surf, key_ud)) << "invalid surface";
}
TEST_F(UtSurfaceInternal, DeleteUserDataSuccess)
{
- int key_ud;
+ unsigned long key_ud;
- ASSERT_TRUE(tbm_surface_internal_add_user_data(surface, &key_ud, data_free_handle));
- ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, &key_ud, &tbm_data_free_is_called));
+ ASSERT_TRUE(tbm_surface_internal_add_user_data(surface, key_ud, data_free_handle));
+ ASSERT_TRUE(tbm_surface_internal_set_user_data(surface, key_ud, &tbm_data_free_is_called));
tbm_data_free_is_called = 0;
- ASSERT_TRUE(tbm_surface_internal_delete_user_data(surface, &key_ud));
+ ASSERT_TRUE(tbm_surface_internal_delete_user_data(surface, key_ud));
ASSERT_TRUE(tbm_data_free_is_called);
- ASSERT_FALSE(tbm_surface_internal_set_user_data(surface, &key_ud, &tbm_data_free_is_called));
+ ASSERT_FALSE(tbm_surface_internal_set_user_data(surface, key_ud, &tbm_data_free_is_called));
}
ut_set_default_tbm_env();
queue = tbm_surface_queue_create(-1, 720, 1024, TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT);
- ASSERT_EQ(NULL, queue); // Expected Value: NULL
+ ASSERT_EQ(nullptr, queue); // Expected Value: NULL
queue = tbm_surface_queue_create(QUEUE_SIZE, -1, 1024, TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT);
- ASSERT_EQ(NULL, queue);
+ ASSERT_EQ(nullptr, queue);
queue = tbm_surface_queue_create(QUEUE_SIZE, 720, -1, TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT);
- ASSERT_EQ(NULL, queue);
+ ASSERT_EQ(nullptr, queue);
queue = tbm_surface_queue_create(QUEUE_SIZE, 720, 1024, 0, TBM_BO_DEFAULT);
- ASSERT_EQ(NULL, queue);
+ ASSERT_EQ(nullptr, queue);
}
TEST(UtSurfaceQueueCreate, CreateSuccess)
{
tbm_surface_queue_h queue = NULL;
- int num = 0;
+ uint32_t num = 0;
tbm_format *formats = NULL;
ut_set_default_tbm_env();
ASSERT_TRUE(tbm_surface_internal_query_supported_formats(&formats, &num));
queue = tbm_surface_queue_create(QUEUE_SIZE, 720, 1024, formats[0], TBM_BO_DEFAULT);
- ASSERT_NE(NULL, queue);
+ ASSERT_NE(nullptr, queue);
tbm_surface_queue_destroy(queue);
ut_set_default_tbm_env();
queue = tbm_surface_queue_sequence_create(-1, 720, 1024, TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT);
- ASSERT_EQ(NULL, queue); // Expected Value: NULL
+ ASSERT_EQ(nullptr, queue); // Expected Value: NULL
queue = tbm_surface_queue_sequence_create(QUEUE_SIZE, -1, 1024, TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT);
- ASSERT_EQ(NULL, queue);
+ ASSERT_EQ(nullptr, queue);
queue = tbm_surface_queue_sequence_create(QUEUE_SIZE, 720, -1, TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT);
- ASSERT_EQ(NULL, queue);
+ ASSERT_EQ(nullptr, queue);
queue = tbm_surface_queue_sequence_create(QUEUE_SIZE, 720, 1024, 0, TBM_BO_DEFAULT);
- ASSERT_EQ(NULL, queue);
+ ASSERT_EQ(nullptr, queue);
}
TEST(UtSurfaceQueueCreate, SequenceCreateSuccess)
{
tbm_surface_queue_h queue = NULL;
- int num = 0;
+ uint32_t num = 0;
tbm_format *formats = NULL;
ut_set_default_tbm_env();
ASSERT_TRUE(tbm_surface_internal_query_supported_formats(&formats, &num));
queue = tbm_surface_queue_create(QUEUE_SIZE, 720, 1024, formats[0], TBM_BO_DEFAULT);
- ASSERT_NE(NULL, queue);
+ ASSERT_NE(nullptr, queue);
free(formats);
}
for (int i = 0; i < QUEUE_SIZE; i++) {
result = tbm_surface_queue_dequeue(queue, &surface);
ASSERT_EQ(TBM_SURFACE_QUEUE_ERROR_NONE, result);
- ASSERT_NE(NULL, surface);
+ ASSERT_NE((tbm_surface_h)NULL, surface);
}
result = tbm_surface_queue_dequeue(queue, &surface);
ASSERT_NE(TBM_SURFACE_QUEUE_ERROR_NONE, result);
- ASSERT_EQ(NULL, surface);
+ ASSERT_EQ(nullptr, surface);
}
/* tbm_surface_queue_error_e tbm_surface_queue_get_surfaces( tbm_surface_queue_h surface_queue,
for (int i = 0; i < QUEUE_SIZE; i++) {
result = tbm_surface_queue_dequeue(queue, &surface);
ASSERT_EQ(TBM_SURFACE_QUEUE_ERROR_NONE, result);
- ASSERT_NE(NULL, surface);
+ ASSERT_NE(nullptr, surface);
}
/* test */
ASSERT_EQ(TBM_SURFACE_QUEUE_ERROR_NONE, result);
ASSERT_EQ(QUEUE_SIZE, num);
for (int i = 0; i < QUEUE_SIZE; i++)
- ASSERT_NE(NULL, surfaces[i]);
+ ASSERT_NE(nullptr, surfaces[i]);
}
/* tbm_surface_queue_error_e tbm_surface_queue_cancel_dequeue(
for (int i = 0; i < QUEUE_SIZE; i++) {
result = tbm_surface_queue_dequeue(queue, &surface);
ASSERT_EQ(TBM_SURFACE_QUEUE_ERROR_NONE, result);
- ASSERT_NE(NULL, surface);
+ ASSERT_NE(nullptr, surface);
}
last_surface = surface;
result = tbm_surface_queue_dequeue(queue, &surface);
ASSERT_NE(TBM_SURFACE_QUEUE_ERROR_NONE, result);
- ASSERT_EQ(NULL, surface);
+ ASSERT_EQ(nullptr, surface);
/* test */
result = tbm_surface_queue_cancel_dequeue(queue, last_surface);
/* test: acquire empty queue*/
result = tbm_surface_queue_acquire(queue, &acquired_surface);
ASSERT_NE(TBM_SURFACE_QUEUE_ERROR_NONE, result);
- ASSERT_EQ(NULL, acquired_surface);
+ ASSERT_EQ(nullptr, acquired_surface);
}
/* tbm_surface_queue_error_e tbm_surface_queue_cancel_acquire(
last_surface = surface;
result = tbm_surface_queue_acquire(queue, &surface);
ASSERT_NE(TBM_SURFACE_QUEUE_ERROR_NONE, result);
- ASSERT_EQ(NULL, surface);
+ ASSERT_EQ(nullptr, surface);
/* test */
result = tbm_surface_queue_cancel_acquire(queue, last_surface);