set initialization value
[platform/core/uifw/libtdm.git] / haltests / src / tc_tdm_client.cpp
index 0d54855..8243d1f 100644 (file)
@@ -145,6 +145,7 @@ TDMClient::TDMClient()
        client = NULL;
        output = NULL;
        vblank = NULL;
+       voutput = NULL;
        vrefresh_interval = start = end = 0.0;
 }
 
@@ -746,6 +747,37 @@ TEST_P(TDMClient, ClientOutputGetRefreshRateNullOther)
        ASSERT_EQ(tdm_client_output_get_refresh_rate(output, NULL), TDM_ERROR_INVALID_PARAMETER);
 }
 
+/* tdm_client_output_get_mode */
+TEST_P(TDMClient, ClientOutputGetMode)
+{
+       unsigned int width = 0, height = 0;
+
+       ASSERT_EQ(PrepareClient(), true);
+       ASSERT_EQ(PrepareOutput(), true);
+
+       ASSERT_EQ(tdm_client_output_get_mode(output, &width, &height), TDM_ERROR_NONE);
+       ASSERT_GT(width, 0);
+       ASSERT_GT(height, 0);
+}
+
+TEST_P(TDMClient, ClientOutputGetModeNullObject)
+{
+       unsigned int width = (unsigned int)TDM_UT_INVALID_VALUE;
+       unsigned int height = (unsigned int)TDM_UT_INVALID_VALUE;
+
+       ASSERT_EQ(tdm_client_output_get_mode(NULL, &width, &height), TDM_ERROR_INVALID_PARAMETER);
+       ASSERT_EQ(width, (unsigned int)TDM_UT_INVALID_VALUE);
+       ASSERT_EQ(height, (unsigned int)TDM_UT_INVALID_VALUE);
+}
+
+TEST_P(TDMClient, ClientOutputGetModeNullOther)
+{
+       ASSERT_EQ(PrepareClient(), true);
+       ASSERT_EQ(PrepareOutput(), true);
+
+       ASSERT_EQ(tdm_client_output_get_mode(output, NULL, NULL), TDM_ERROR_INVALID_PARAMETER);
+}
+
 /* tdm_client_output_get_conn_status */
 TEST_P(TDMClient, ClientOutputGetConnStatus)
 {
@@ -1388,8 +1420,15 @@ TEST_P(TDMClient, ClientVblankIsWaitingNullObject)
 TEST_P(TDMClient, ClientCreateVOutput)
 {
        tdm_error ret;
+       int virtual_conf = 0;
        const char name[TDM_NAME_LEN] = "Virtual Output";
 
+       virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+       if (virtual_conf == 0) {
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
+
        ASSERT_EQ(PrepareClient(), true);
 
        voutput = tdm_client_create_voutput(client, name, &ret);
@@ -1500,8 +1539,12 @@ void TDMVirtualOutput::TearDownTestCase(void)
 bool TDMVirtualOutput::PrepareVOutput(void)
 {
        tdm_error ret;
+       int virtual_conf = 0;
        const char name[TDM_NAME_LEN] = "Virtual Output";
 
+       virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+       if (virtual_conf == 0) return true;
+
        client = tdm_client_create(&ret);
        TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE);
        TDM_UT_RETURN_FALSE_IF_FAIL(client != NULL);
@@ -1544,7 +1587,13 @@ TEST_F(TDMVirtualOutput, SetAvailableModes)
        tdm_error ret;
        tdm_client_output_mode modes[this->MODE_COUNT];
        int count = this->MODE_COUNT;
+       int virtual_conf;
 
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
        _tc_tdm_client_virutual_make_available_mode(modes, count);
 
        ret = tdm_client_voutput_set_available_modes(this->voutput, modes, count);
@@ -1556,6 +1605,13 @@ TEST_F(TDMVirtualOutput, FailTestSetAvailableModes)
        tdm_error ret;
        tdm_client_output_mode modes[this->MODE_COUNT];
        int count = this->MODE_COUNT;
+       int virtual_conf;
+
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
 
        ret = tdm_client_voutput_set_available_modes(NULL, modes, count);
        ASSERT_EQ(ret, TDM_ERROR_INVALID_PARAMETER);
@@ -1568,6 +1624,13 @@ TEST_F(TDMVirtualOutput, SetPhysicalSize)
 {
        tdm_error ret;
        unsigned int mmWidth = 1234, mmHeight = 1234;
+       int virtual_conf;
+
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
 
        ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight);
        ASSERT_EQ(ret, TDM_ERROR_NONE);
@@ -1577,6 +1640,13 @@ TEST_F(TDMVirtualOutput, FailTestSetPhysicalSize)
 {
        tdm_error ret;
        unsigned int invalid_mmWidth = 0, invalid_mmHeight = 0;
+       int virtual_conf;
+
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
 
        ret = tdm_client_voutput_set_physical_size(this->voutput, invalid_mmWidth, invalid_mmHeight);
        ASSERT_EQ(ret, TDM_ERROR_INVALID_PARAMETER);
@@ -1594,6 +1664,13 @@ TEST_F(TDMVirtualOutput, AddCommitHandler)
 {
        tdm_error ret;
        int flag_callback_called = 0;
+       int virtual_conf;
+
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
 
        ret = tdm_client_voutput_add_commit_handler(this->voutput,
                                                                                                _tc_tdm_client_voutput_commit_handler,
@@ -1609,6 +1686,13 @@ TEST_F(TDMVirtualOutput, AddCommitHandler)
 TEST_F(TDMVirtualOutput, CommitDone)
 {
        tdm_error ret;
+       int virtual_conf;
+
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
 
        ret = tdm_client_voutput_commit_done(this->voutput);
        ASSERT_EQ(ret, TDM_ERROR_NONE);
@@ -1618,6 +1702,13 @@ TEST_F(TDMVirtualOutput, GetClientOutput)
 {
        tdm_error ret;
        tdm_client_output *output;
+       int virtual_conf;
+
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
 
        output = tdm_client_voutput_get_client_output(this->voutput, &ret);
        ASSERT_EQ(ret, TDM_ERROR_NONE);
@@ -1630,6 +1721,13 @@ TEST_F(TDMVirtualOutput, Connect)
        unsigned int mmWidth = 300, mmHeight = 150;
        tdm_client_output_mode modes[this->MODE_COUNT];
        int count = this->MODE_COUNT;
+       int virtual_conf;
+
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
 
        ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight);
        ASSERT_EQ(ret, TDM_ERROR_NONE);
@@ -1647,6 +1745,13 @@ TEST_F(TDMVirtualOutput, Connect)
 TEST_F(TDMVirtualOutput, Disconnect)
 {
        tdm_error ret;
+       int virtual_conf;
+
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
 
 //     TDM_UT_WAIT("check & press");
 
@@ -1663,6 +1768,13 @@ TEST_F(TDMVirtualOutput, SetMode)
        unsigned int mmWidth = 300, mmHeight = 150;
        tdm_client_output_mode modes[this->MODE_COUNT];
        int count = this->MODE_COUNT;
+       int virtual_conf;
+
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
 
        ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight);
        ASSERT_EQ(ret, TDM_ERROR_NONE);
@@ -1692,6 +1804,13 @@ TEST_F(TDMVirtualOutput, SetModeNullObject)
        unsigned int mmWidth = 300, mmHeight = 150;
        tdm_client_output_mode modes[this->MODE_COUNT];
        int count = this->MODE_COUNT;
+       int virtual_conf;
+
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
 
        ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight);
        ASSERT_EQ(ret, TDM_ERROR_NONE);
@@ -1719,6 +1838,13 @@ TEST_F(TDMVirtualOutput, SetModeInvalidIndex)
        unsigned int mmWidth = 300, mmHeight = 150;
        tdm_client_output_mode modes[this->MODE_COUNT];
        int count = this->MODE_COUNT;
+       int virtual_conf;
+
+       if (this->voutput == NULL) {
+               virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0);
+               ASSERT_EQ(virtual_conf, 0);
+               return;
+       }
 
        ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight);
        ASSERT_EQ(ret, TDM_ERROR_NONE);