skip some tbm_surface api which may not be supported.
Change-Id: I0e143746004c5a81c8ab87501bc9eaa57907361a
EXPECT_TRUE(0);\
} while(0)
EXPECT_TRUE(0);\
} while(0)
-#define TBM_UT_SKIP_FLAG(FLAG) \
+#define TBM_UT_RETURN_TRUE_NOT_SUPPORTED(error) \
- if((FLAG)) {\
- TBM_UT_INFO(" [ SKIPPED ] not supported");\
+ if((error == TBM_ERROR_NOT_SUPPORTED)) {\
+ TBM_UT_WRN(" [ SKIPPED ] not supported");\
EXPECT_TRUE(1);\
return;\
}\
EXPECT_TRUE(1);\
return;\
}\
TEST_F(TBMSurfaceInternal, ExportNegative_InvalidParameters)
{
tbm_error_e error = TBM_ERROR_NONE;
TEST_F(TBMSurfaceInternal, ExportNegative_InvalidParameters)
{
tbm_error_e error = TBM_ERROR_NONE;
-
- TBM_UT_SKIP_FLAG(!bufmgr->use_hal_tbm);
+ tbm_surface_buffer_data *buffer_data = NULL;
- EXPECT_EQ(tbm_surface_internal_export(invalid_surface, &error), nullptr);
+ buffer_data = tbm_surface_internal_export(invalid_surface, &error);
+ // skip this test if this api is not supported.
+ TBM_UT_RETURN_TRUE_NOT_SUPPORTED(error);
+
EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_INVALID_PARAMETER));
EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_INVALID_PARAMETER));
+ EXPECT_EQ(buffer_data, nullptr);
}
TEST_F(TBMSurfaceInternal, ExportPositive_Success)
}
TEST_F(TBMSurfaceInternal, ExportPositive_Success)
tbm_surface_buffer_data *buffer_data = NULL;
unsigned int i;
tbm_surface_buffer_data *buffer_data = NULL;
unsigned int i;
- TBM_UT_SKIP_FLAG(!bufmgr->use_hal_tbm);
+ buffer_data = tbm_surface_internal_export(surface, &error);
+ // skip this test if this api is not supported.
+ TBM_UT_RETURN_TRUE_NOT_SUPPORTED(error);
- EXPECT_NE((buffer_data = tbm_surface_internal_export(surface, &error)), nullptr);
EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_NONE));
EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_NONE));
+ EXPECT_NE(buffer_data, nullptr);
// verify the member variables of tbm_surface_buffer_data
if (buffer_data) {
EXPECT_GT(buffer_data->num_fds, 0);
// verify the member variables of tbm_surface_buffer_data
if (buffer_data) {
EXPECT_GT(buffer_data->num_fds, 0);
tbm_error_e error = TBM_ERROR_NONE;
tbm_surface_h surface1 = NULL;
tbm_error_e error = TBM_ERROR_NONE;
tbm_surface_h surface1 = NULL;
- TBM_UT_SKIP_FLAG(!bufmgr->use_hal_tbm);
+ // invalid surface test
+ surface1 = tbm_surface_internal_import(NULL, NULL, &error);
+ TBM_UT_RETURN_TRUE_NOT_SUPPORTED(error);
- EXPECT_EQ((surface1 = tbm_surface_internal_import(NULL, NULL, &error)), nullptr);
EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_INVALID_PARAMETER));
EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_INVALID_PARAMETER));
+ EXPECT_EQ(surface1, nullptr);
}
TEST_F(TBMSurfaceInternal, ImportPositive_Success)
}
TEST_F(TBMSurfaceInternal, ImportPositive_Success)
tbm_surface_h surface1 = NULL;
unsigned int i;
tbm_surface_h surface1 = NULL;
unsigned int i;
- TBM_UT_SKIP_FLAG(!bufmgr->use_hal_tbm);
-
- EXPECT_NE((buffer_data = tbm_surface_internal_export(surface, &error)), nullptr);
+ buffer_data = tbm_surface_internal_export(surface, &error);
+ TBM_UT_RETURN_TRUE_NOT_SUPPORTED(error);
+
EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_NONE));
EXPECT_STREQ(tbm_error_str(error), tbm_error_str(TBM_ERROR_NONE));
+ EXPECT_NE(buffer_data, nullptr);
// verify the member variables of tbm_surface_buffer_data
if (buffer_data) {
// verify the member variables of tbm_surface_buffer_data
if (buffer_data) {