#include <tbm_drm_helper.h>
}
+/* LCOV_EXCL_START */
+
#include "tdm.h"
#include "tdm_helper.h"
#include "tdm_config.h"
} \
} while (0)
+/* LCOV_EXCL_STOP */
+
#endif // _UT_TDM_H_
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
class TDMBackendCapture : public TDMBackendDisplay
{
public:
TDMBackendCapture,
Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
#define TDM_UT_BACKEND_TEST_CNT 20
TDMBackendBasic::TDMBackendBasic()
TDMBackendDisplay,
Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
bool enable_porting_debug = false;
void TDMBackendEnv::SetUp(void)
TDMBackendEnv,
Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
class TDMBackendPP : public TDMBackendDisplay
{
public:
TDMBackendPP,
Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
class TDMBuffer : public TDMDisplay
{
public:
TDMBuffer,
Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
#include "tdm_client.h"
+/* LCOV_EXCL_START */
+
enum {
TDM_UT_PIPE_MSG_NONE,
TDM_UT_PIPE_MSG_REPLY,
ASSERT_EQ(tdm_client_get_fd(client, NULL), TDM_ERROR_INVALID_PARAMETER);
}
+static void
+_ut_tdm_client_vblank_cb(unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data)
+{
+ bool *done = (bool *)user_data;
+ if (done)
+ *done = true;
+}
+
/* tdm_client_handle_events_timeout */
-TEST_P(TDMClient, DISABLED_ClientHandleEvent)
+TEST_P(TDMClient, ClientHandleEvent)
{
+ bool done = false;
+
ASSERT_EQ(PrepareClient(), true);
-// ASSERT_EQ(tdm_client_handle_events_timeout(client, 3000), TDM_ERROR_NONE);
-}
+ ASSERT_EQ(tdm_client_wait_vblank(client, NULL, 1, 1, 0, _ut_tdm_client_vblank_cb, &done), TDM_ERROR_NONE);
+ ASSERT_EQ(done, false);
-TEST_P(TDMClient, ClientHandleEventNullObject)
-{
- ASSERT_EQ(tdm_client_handle_events_timeout(NULL, 3000), TDM_ERROR_INVALID_PARAMETER);
+ while (!done)
+ ASSERT_EQ(tdm_client_handle_events(client), TDM_ERROR_NONE);
}
-static void
-_ut_tdm_client_vblank_cb(unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data)
+TEST_P(TDMClient, ClientHandleEventNullObject)
{
- bool *done = (bool *)user_data;
- if (done)
- *done = true;
+ ASSERT_EQ(tdm_client_handle_events(NULL), TDM_ERROR_INVALID_PARAMETER);
}
/* tdm_client_wait_vblank, deprecated */
ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE);
}
+/* tdm_client_vblank_wait */
+TEST_P(TDMClient, ClientVblankIsWaiting)
+{
+ bool done;
+ unsigned int waiting;
+
+ ASSERT_EQ(PrepareClient(), true);
+ ASSERT_EQ(PrepareOutput(), true);
+ ASSERT_EQ(PrepareVblank(), true);
+
+ done = false;
+ ASSERT_EQ(tdm_client_vblank_wait(vblank, 1, _ut_tdm_client_vblank_cb2, &done), TDM_ERROR_NONE);
+
+ waiting = tdm_client_vblank_is_waiting(vblank);
+ ASSERT_EQ(waiting, 1);
+
+ start = tdm_helper_get_time();
+ while (!done)
+ ASSERT_EQ(tdm_client_handle_events_timeout(client, 3000), TDM_ERROR_NONE);
+ end = tdm_helper_get_time();
+
+ /* "+ vrefresh_interval" consider the delay of socket communication between kernel and platform */
+ ASSERT_LT((end - start), (vrefresh_interval + vrefresh_interval));
+
+ waiting = tdm_client_vblank_is_waiting(vblank);
+ ASSERT_EQ(waiting, 0);
+}
+
+/* tdm_client_vblank_wait */
+TEST_P(TDMClient, ClientVblankIsWaitingNullObject)
+{
+ unsigned int waiting = tdm_client_vblank_is_waiting(NULL);
+ ASSERT_EQ(waiting, 0);
+}
+
#ifdef TDM_UT_TEST_WITH_PARAMS
INSTANTIATE_TEST_CASE_P(TDMClientParams,
TDMClient,
TDMClient,
Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
TDMDisplay::TDMDisplay()
{
dpy = NULL;
ASSERT_EQ(output, NULL);
}
+TEST_P(TDMDisplay, DisplayFindOutput)
+{
+ tdm_output *output;
+ int count = TDM_UT_INVALID_VALUE;
+ tdm_error ret;
+
+ ASSERT_EQ(tdm_display_get_output_count(dpy, &count), TDM_ERROR_NONE);
+ ASSERT_GT(count, 0);
+
+ output = tdm_display_find_output(dpy, "primary", &ret);
+ ASSERT_EQ(ret, TDM_ERROR_NONE);
+ ASSERT_NE(output, NULL);
+
+ output = tdm_display_find_output(dpy, "invalid", &ret);
+ ASSERT_EQ(ret, TDM_ERROR_NONE);
+ ASSERT_EQ(output, NULL);
+}
+
TEST_P(TDMDisplay, DisplayCreatePp)
{
tdm_pp *pp;
INSTANTIATE_TEST_CASE_P(TDMDisplayParams,
TDMDisplay,
Values(TDM_DEFAULT_MODULE));
-#endif
\ No newline at end of file
+#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
void TDMEnv::SetUp(void)
{
const char *test_backend;
TDMEnv,
Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
class TDMEventLoop : public TDMDisplay
{
public:
TDMEventLoop,
Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
class TDMHelper : public TDMOutput
{
public:
TDMHelper,
Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
#define HWC_WIN_NUM 5
class TDMHwcWindow : public TDMOutput
INSTANTIATE_TEST_CASE_P(TDMHwcWindowParams,
TDMHwcWindow,
Values(TDM_DEFAULT_MODULE));
-#endif
\ No newline at end of file
+#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
#define BORDER_SIZE 20
class TDMLayer : public TDMOutput
TDMLayer,
Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
TEST(TDMLog, logPrintf)
{
tdm_log_enable_color(1);
tdm_log_print(TDM_UT_INVALID_VALUE, "utest");
}
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
int tdm_debug_module;
int main(int argc, char **argv)
#endif
return AllTestSuccess;
-}
\ No newline at end of file
+}
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
static void _ut_tdm_output_change_cb(tdm_output *output, tdm_output_change_type type, tdm_value value, void *user_data);
static void _ut_tdm_output_change_cb2(tdm_output *output, tdm_output_change_type type, tdm_value value, void *user_data);
INSTANTIATE_TEST_CASE_P(TDMOutputParams,
TDMOutput,
Values(TDM_DEFAULT_MODULE));
-#endif
\ No newline at end of file
+#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
class TDMOutputHwc : public TDMOutput
{
public:
TDMOutputHwc,
Values(TDM_DEFAULT_MODULE));
#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
#include "ut_tdm.h"
+/* LCOV_EXCL_START */
+
static void _ut_tdm_vblank_create_cb(tdm_vblank *vblank, void *user_data);
static void _ut_tdm_vblank_create_cb2(tdm_vblank *vblank, void *user_data);
/* wait vblank -> dpms off -> then? (vblank handler is called? or not?) */
}
+TEST_P(TDMVblank, VblankWaitTimeout)
+{
+ TDM_UT_SKIP_FLAG(has_outputs);
+
+ ASSERT_EQ(TestPrepareOutput(), true);
+ ASSERT_EQ(TestCreateVblanks(), true);
+
+ if (vblank_count > 0) {
+ tdm_vblank *vblank = vblanks[0];
+ unsigned int cur_seq = 0;
+
+ ASSERT_EQ(tdm_vblank_wait(vblank, 0, 0, 1, _ut_tdm_vblank_cb, &cur_seq), TDM_ERROR_NONE);
+ usleep(1200000);
+ while (cur_seq == 0)
+ ASSERT_EQ(ut_tdm_display_handle_events(dpy), TDM_ERROR_NONE);
+ }
+}
+
#ifdef TDM_UT_TEST_WITH_PARAMS
INSTANTIATE_TEST_CASE_P(TDMVblankParams,
TDMVblank,
INSTANTIATE_TEST_CASE_P(TDMVblankParams,
TDMVblank,
Values(TDM_DEFAULT_MODULE));
-#endif
\ No newline at end of file
+#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file