virtual: client get voutput's output by tdm_client_get_output
[platform/core/uifw/libtdm.git] / haltests / src / tc_tdm_client.cpp
index 1ee78c5..01668cb 100644 (file)
@@ -1413,7 +1413,6 @@ protected:
        static tdm_client *client;
        static tdm_client_voutput *voutput;
        const int MODE_COUNT = 2;
-       const int FORMAT_COUNT = 2;
 
 private:
        static pid_t server_pid;
@@ -1541,7 +1540,6 @@ _tc_tdm_client_virutual_make_available_mode(tdm_client_output_mode *modes, int c
        }
 }
 
-
 TEST_F(TDMVirtualOutput, SetAvailableModes)
 {
        tdm_error ret;
@@ -1567,19 +1565,6 @@ TEST_F(TDMVirtualOutput, FailTestSetAvailableModes)
        ASSERT_EQ(ret, TDM_ERROR_INVALID_PARAMETER);
 }
 
-TEST_F(TDMVirtualOutput, SetAvailableFormats)
-{
-       const int nformats = 2;
-       tdm_error ret;
-       tbm_format formats[nformats];
-
-       formats[0] = TBM_FORMAT_ARGB8888;
-       formats[1] = TBM_FORMAT_XRGB8888;
-
-       ret = tdm_client_voutput_set_available_formats(this->voutput, formats, nformats);
-       ASSERT_EQ(ret, TDM_ERROR_NONE);
-}
-
 TEST_F(TDMVirtualOutput, SetPhysicalSize)
 {
        tdm_error ret;
@@ -1598,6 +1583,38 @@ TEST_F(TDMVirtualOutput, FailTestSetPhysicalSize)
        ASSERT_EQ(ret, TDM_ERROR_INVALID_PARAMETER);
 }
 
+static void
+_tc_tdm_client_voutput_commit_handler(tdm_client_voutput *voutput, tbm_surface_h buffer, void *user_data)
+{
+       int *flag;
+       flag = (int *)user_data;
+       *flag = 1;
+}
+
+TEST_F(TDMVirtualOutput, AddCommitHandler)
+{
+       tdm_error ret;
+       int flag_callback_called = 0;
+
+       ret = tdm_client_voutput_add_commit_handler(this->voutput,
+                                                                                               _tc_tdm_client_voutput_commit_handler,
+                                                                                               &flag_callback_called);
+       ASSERT_EQ(ret, TDM_ERROR_NONE);
+//     ASSERT_EQ(flag_callback_called, 1);
+
+       tdm_client_voutput_remove_commit_handler(this->voutput,
+                                                                                        _tc_tdm_client_voutput_commit_handler,
+                                                                                        &flag_callback_called);
+}
+
+TEST_F(TDMVirtualOutput, CommitDone)
+{
+       tdm_error ret;
+
+       ret = tdm_client_voutput_commit_done(this->voutput);
+       ASSERT_EQ(ret, TDM_ERROR_NONE);
+}
+
 TEST_F(TDMVirtualOutput, GetClientOutput)
 {
        tdm_error ret;
@@ -1610,12 +1627,10 @@ TEST_F(TDMVirtualOutput, GetClientOutput)
 
 TEST_F(TDMVirtualOutput, Connect)
 {
-       const int nformats = 2;
        tdm_error ret;
        tdm_client_output *output;
        unsigned int mmWidth = 300, mmHeight = 150;
        tdm_client_output_mode modes[this->MODE_COUNT];
-       tbm_format formats[nformats];
        int count = this->MODE_COUNT;
 
        output = tdm_client_voutput_get_client_output(this->voutput, &ret);
@@ -1629,11 +1644,6 @@ TEST_F(TDMVirtualOutput, Connect)
        ret = tdm_client_voutput_set_available_modes(this->voutput, modes, count);
        ASSERT_EQ(ret, TDM_ERROR_NONE);
 
-       formats[0] = TBM_FORMAT_ARGB8888;
-       formats[1] = TBM_FORMAT_XRGB8888;
-       ret = tdm_client_voutput_set_available_formats(this->voutput, formats, nformats);
-       ASSERT_EQ(ret, TDM_ERROR_NONE);
-
        ret = tdm_client_output_connect(output);
        ASSERT_EQ(ret, TDM_ERROR_NONE);