#include "ut_tdm.h"
-class TDMHelper : public TDMOutput {
+/* LCOV_EXCL_START */
+
+class TDMHelper : public TDMOutput
+{
public:
TDMHelper();
void SetUp(void);
TDMOutput::TearDown();
}
-#ifdef UT_TDM_HELPER_ENABLE
-
TEST_P(TDMHelper, HelperGetTime)
{
- ASSERT_TRUE(tdm_helper_get_time() > 0.0);
+ ASSERT_GT(tdm_helper_get_time(), 0.0);
}
-TEST_P(TDMHelper, HelperDumpBuffer)
+TEST_P(TDMHelper, HelperDumpBufferXR24)
+{
+ tbm_surface_h buffer;
+
+ buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_XRGB8888);
+ ASSERT_NE(buffer, NULL);
+
+ tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
+
+ char filename[256];
+ snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
+ tdm_helper_dump_buffer(buffer, (const char*)filename);
+
+ tbm_surface_destroy(buffer);
+}
+
+TEST_P(TDMHelper, HelperDumpBufferAR24)
{
tbm_surface_h buffer;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
tdm_pos pos = {.x = 40, .y = 40, .w = TDM_UT_BUFFER_SIZE - 80, .h = TDM_UT_BUFFER_SIZE - 80};
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
tdm_helper_clear_buffer_pos(buffer, &pos);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(buffer, (const char*)filename);
+ tdm_helper_dump_buffer_str(buffer, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
}
unsigned int color = 0xffffff00;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
tdm_helper_clear_buffer_color(buffer, &pos, color);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(buffer, (const char*)filename);
+ tdm_helper_dump_buffer_str(buffer, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
}
tbm_surface_h buffer;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
tdm_helper_clear_buffer(buffer);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(buffer, (const char*)filename);
+ tdm_helper_dump_buffer_str(buffer, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
}
tbm_surface_h buffer;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_XRGB8888);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
tdm_helper_clear_buffer(buffer);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(buffer, (const char*)filename);
+ tdm_helper_dump_buffer_str(buffer, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
}
tbm_surface_h buffer;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_YUV420);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
tdm_helper_clear_buffer(buffer);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(buffer, (const char*)filename);
+ tdm_helper_dump_buffer_str(buffer, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
}
tbm_surface_h buffer;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_NV12);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
tdm_helper_clear_buffer(buffer);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(buffer, (const char*)filename);
+ tdm_helper_dump_buffer_str(buffer, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
}
tbm_surface_h buffer;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_NV21);
- ASSERT_TRUE(buffer != NULL);
-
- tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
-
- tdm_helper_clear_buffer(buffer);
-
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(buffer, (const char*)filename);
-
- tbm_surface_destroy(buffer);
-}
-
-TEST_P(TDMHelper, HelperClearBufferYUYV)
-{
- tbm_surface_h buffer;
-
- buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_YUYV);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
tdm_helper_clear_buffer(buffer);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(buffer, (const char*)filename);
-
- tbm_surface_destroy(buffer);
-}
-
-TEST_P(TDMHelper, HelperClearBufferUYVY)
-{
- tbm_surface_h buffer;
-
- buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_UYVY);
- ASSERT_TRUE(buffer != NULL);
-
- tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
-
- tdm_helper_clear_buffer(buffer);
-
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(buffer, (const char*)filename);
+ tdm_helper_dump_buffer_str(buffer, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
}
int w = TDM_UT_INVALID_VALUE, h = TDM_UT_INVALID_VALUE;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_helper_get_buffer_full_size(buffer, &w, &h);
- ASSERT_TRUE(w != TDM_UT_INVALID_VALUE);
- ASSERT_TRUE(w >= tbm_surface_get_width(buffer));
- ASSERT_TRUE(h != TDM_UT_INVALID_VALUE);
- ASSERT_TRUE(h >= tbm_surface_get_height(buffer));
+ ASSERT_NE(w, TDM_UT_INVALID_VALUE);
+ ASSERT_GE(w, tbm_surface_get_width(buffer));
+ ASSERT_NE(h, TDM_UT_INVALID_VALUE);
+ ASSERT_GE(h, tbm_surface_get_height(buffer));
tbm_surface_destroy(buffer);
}
tdm_pos sp, dp;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
temp = tbm_surface_create(TDM_UT_BUFFER_SIZE * 2, TDM_UT_BUFFER_SIZE * 2, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(temp != NULL);
+ ASSERT_NE(temp, NULL);
sp.x = sp.y = 0, sp.w = sp.h = TDM_UT_BUFFER_SIZE;
dp.x = dp.y = 0, dp.w = dp.h = TDM_UT_BUFFER_SIZE * 2;
- ASSERT_TRUE(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_NORMAL, 0) == TDM_ERROR_NONE);
+ ASSERT_EQ(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_NORMAL, 0), TDM_ERROR_NONE);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(temp, (const char*)filename);
+ tdm_helper_dump_buffer_str(temp, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
tbm_surface_destroy(temp);
tdm_pos sp, dp;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
temp = tbm_surface_create(TDM_UT_BUFFER_SIZE * 2, TDM_UT_BUFFER_SIZE * 2, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(temp != NULL);
+ ASSERT_NE(temp, NULL);
sp.x = sp.y = 0, sp.w = sp.h = TDM_UT_BUFFER_SIZE;
dp.x = dp.y = 0, dp.w = dp.h = TDM_UT_BUFFER_SIZE * 2;
- ASSERT_TRUE(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_FLIPPED, 0) == TDM_ERROR_NONE);
+ ASSERT_EQ(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_FLIPPED, 0), TDM_ERROR_NONE);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(temp, (const char*)filename);
+ tdm_helper_dump_buffer_str(temp, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
tbm_surface_destroy(temp);
tdm_pos sp, dp;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
temp = tbm_surface_create(TDM_UT_BUFFER_SIZE * 2, TDM_UT_BUFFER_SIZE * 2, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(temp != NULL);
+ ASSERT_NE(temp, NULL);
sp.x = sp.y = 0, sp.w = sp.h = TDM_UT_BUFFER_SIZE;
dp.x = dp.y = 0, dp.w = dp.h = TDM_UT_BUFFER_SIZE * 2;
- ASSERT_TRUE(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_90, 0) == TDM_ERROR_NONE);
+ ASSERT_EQ(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_90, 0), TDM_ERROR_NONE);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(temp, (const char*)filename);
+ tdm_helper_dump_buffer_str(temp, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
tbm_surface_destroy(temp);
tdm_pos sp, dp;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
temp = tbm_surface_create(TDM_UT_BUFFER_SIZE * 2, TDM_UT_BUFFER_SIZE * 2, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(temp != NULL);
+ ASSERT_NE(temp, NULL);
sp.x = sp.y = 0, sp.w = sp.h = TDM_UT_BUFFER_SIZE;
dp.x = dp.y = 0, dp.w = dp.h = TDM_UT_BUFFER_SIZE * 2;
- ASSERT_TRUE(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_180, 0) == TDM_ERROR_NONE);
+ ASSERT_EQ(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_180, 0), TDM_ERROR_NONE);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(temp, (const char*)filename);
+ tdm_helper_dump_buffer_str(temp, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
tbm_surface_destroy(temp);
tdm_pos sp, dp;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
temp = tbm_surface_create(TDM_UT_BUFFER_SIZE * 2, TDM_UT_BUFFER_SIZE * 2, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(temp != NULL);
+ ASSERT_NE(temp, NULL);
sp.x = sp.y = 0, sp.w = sp.h = TDM_UT_BUFFER_SIZE;
dp.x = dp.y = 0, dp.w = dp.h = TDM_UT_BUFFER_SIZE * 2;
- ASSERT_TRUE(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_270, 0) == TDM_ERROR_NONE);
+ ASSERT_EQ(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_270, 0), TDM_ERROR_NONE);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(temp, (const char*)filename);
+ tdm_helper_dump_buffer_str(temp, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(buffer);
tbm_surface_destroy(temp);
tdm_pos sp, dp;
buffer = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_YUV420);
- ASSERT_TRUE(buffer != NULL);
+ ASSERT_NE(buffer, NULL);
tdm_test_buffer_fill(buffer, PATTERN_SMPTE);
temp = tbm_surface_create(TDM_UT_BUFFER_SIZE * 2, TDM_UT_BUFFER_SIZE * 2, TBM_FORMAT_YUV420);
- ASSERT_TRUE(temp != NULL);
+ ASSERT_NE(temp, NULL);
sp.x = sp.y = 0, sp.w = sp.h = TDM_UT_BUFFER_SIZE;
dp.x = dp.y = 0, dp.w = dp.h = TDM_UT_BUFFER_SIZE * 2;
- ASSERT_TRUE(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_NORMAL, 0) == TDM_ERROR_OPERATION_FAILED);
+ ASSERT_EQ(tdm_helper_convert_buffer(buffer, temp, &sp, &dp, TDM_TRANSFORM_NORMAL, 0), TDM_ERROR_OPERATION_FAILED);
tbm_surface_destroy(buffer);
tbm_surface_destroy(temp);
TEST_P(TDMHelper, HelperGetFD)
{
int fd = tdm_helper_get_fd("TDM_DRM_MASTER_FD");
- ASSERT_TRUE(fd >= 0);
+ ASSERT_GE(fd, 0);
close(fd);
fd = tdm_helper_get_fd("BLURBLUR");
- ASSERT_TRUE(fd == -1);
+ ASSERT_EQ(fd, -1);
}
TEST_P(TDMHelper, HelperSetFD)
tbm_surface_h dump;
output = tdm_display_get_output(dpy, o, &ret);
- ASSERT_TRUE(ret == TDM_ERROR_NONE);
- ASSERT_TRUE(output != NULL);
+ ASSERT_EQ(ret, TDM_ERROR_NONE);
+ ASSERT_NE(output, NULL);
if (!ut_tdm_output_is_connected(output))
continue;
- ASSERT_TRUE(ut_tdm_output_prepare(dpy, output) == true);
+ ASSERT_EQ(ut_tdm_output_prepare(dpy, output, true), true);
dump = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888);
- ASSERT_TRUE(dump != NULL);
+ ASSERT_NE(dump, NULL);
- ASSERT_TRUE(tdm_helper_capture_output(output, dump, 0, 0, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE,
- _ut_tdm_helper_capture_cb, NULL) == TDM_ERROR_NONE);
+ ASSERT_EQ(tdm_helper_capture_output(output, dump, 0, 0, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE,
+ _ut_tdm_helper_capture_cb, NULL), TDM_ERROR_NONE);
- char filename[256];
- snprintf(filename, sizeof filename, "%s.png", typeid(*this).name());
- tdm_helper_dump_buffer(dump, (const char*)filename);
+ tdm_helper_dump_buffer_str(dump, NULL, (char*)typeid(*this).name());
tbm_surface_destroy(dump);
}
{
tbm_surface_h dump = (tbm_surface_h)TDM_UT_INVALID_VALUE;
- ASSERT_TRUE(tdm_helper_capture_output(NULL, dump, 0, 0, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE,
- _ut_tdm_helper_capture_cb, NULL) == TDM_ERROR_INVALID_PARAMETER);
+ ASSERT_EQ(tdm_helper_capture_output(NULL, dump, 0, 0, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE,
+ _ut_tdm_helper_capture_cb, NULL), TDM_ERROR_INVALID_PARAMETER);
}
TEST_P(TDMHelper, HelperCaptureOutputNullOther)
for (int o = 0; o < output_count; o++) {
tdm_error ret;
tdm_output *output = tdm_display_get_output(dpy, o, &ret);
- ASSERT_TRUE(ret == TDM_ERROR_NONE);
- ASSERT_TRUE(output != NULL);
+ ASSERT_EQ(ret, TDM_ERROR_NONE);
+ ASSERT_NE(output, NULL);
tdm_helper_output_commit_per_vblank_enabled(output);
}
tbm_surface_h dump = (tbm_surface_h)TDM_UT_INVALID_VALUE;
- ASSERT_TRUE(tdm_helper_capture_output(NULL, dump, 0, 0, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE,
- _ut_tdm_helper_capture_cb, NULL) == TDM_ERROR_INVALID_PARAMETER);
+ ASSERT_EQ(tdm_helper_capture_output(NULL, dump, 0, 0, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE,
+ _ut_tdm_helper_capture_cb, NULL), TDM_ERROR_INVALID_PARAMETER);
}
TEST_P(TDMHelper, HelperGetDisplayInformation)
for (int o = 0; o < output_count; o++) {
tdm_error ret;
tdm_output *output = tdm_display_get_output(dpy, o, &ret);
- ASSERT_TRUE(ret == TDM_ERROR_NONE);
- ASSERT_TRUE(output != NULL);
+ ASSERT_EQ(ret, TDM_ERROR_NONE);
+ ASSERT_NE(output, NULL);
if (!ut_tdm_output_is_connected(output))
continue;
- ASSERT_TRUE(ut_tdm_output_prepare(dpy, output) == true);
+ ASSERT_EQ(ut_tdm_output_prepare(dpy, output, true), true);
}
tdm_helper_get_display_information(dpy, reply, &len);
TEST_P(TDMHelper, HelperCommitPerVblankEnabled)
{
- tdm_helper_commit_per_vblank_enabled(dpy);
+ ASSERT_EQ(tdm_helper_commit_per_vblank_enabled(dpy), 0);
}
TEST_P(TDMHelper, HelperCommitPerVblankEnabledNullOBject)
{
- tdm_helper_commit_per_vblank_enabled(NULL);
-}
-
-TEST_P(TDMHelper, HelperOutputCommitPerVblankEnabled)
-{
- for (int o = 0; o < output_count; o++) {
- tdm_error ret;
- tdm_output *output = tdm_display_get_output(dpy, o, &ret);
- ASSERT_TRUE(ret == TDM_ERROR_NONE);
- ASSERT_TRUE(output != NULL);
- tdm_helper_output_commit_per_vblank_enabled(output);
- }
+ ASSERT_EQ(tdm_helper_commit_per_vblank_enabled(NULL), 0);
}
TEST_P(TDMHelper, HelperOutputCommitPerVblankEnabledNullObject)
{
- tdm_helper_output_commit_per_vblank_enabled(NULL);
+ ASSERT_EQ(tdm_helper_output_commit_per_vblank_enabled(NULL), -1);
}
+#ifdef TDM_UT_TEST_WITH_PARAMS
INSTANTIATE_TEST_CASE_P(TDMHelperParams,
TDMHelper,
Combine(Bool(), Bool(), Values(TDM_DEFAULT_MODULE)));
-
+#else
+INSTANTIATE_TEST_CASE_P(TDMHelperParams,
+ TDMHelper,
+ Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file