}
tdm_error
+tdm_client_output_get_mode(tdm_client_output *output, unsigned int *width, unsigned int *height)
+{
+ tdm_private_client_output *private_output;
+ tdm_private_client *private_client;
+
+ TDM_RETURN_VAL_IF_FAIL(output != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(width != NULL, TDM_ERROR_INVALID_PARAMETER);
+ TDM_RETURN_VAL_IF_FAIL(height != NULL, TDM_ERROR_INVALID_PARAMETER);
+
+ private_output = (tdm_private_client_output*)output;
+ private_client = private_output->private_client;
+
+ pthread_mutex_lock(&private_client->lock);
+
+ if (private_output->watch_output_changes) {
+ *width = private_output->width;
+ *height = private_output->height;
+ pthread_mutex_unlock(&private_client->lock);
+ return TDM_ERROR_NONE;
+ }
+
+ if (CHECK_WL_PROTOCOL_ERROR(private_client)) {
+ pthread_mutex_unlock(&private_client->lock);
+ return TDM_ERROR_PROTOCOL_ERROR;
+ }
+
+ wl_proxy_set_queue((struct wl_proxy *)private_output->output, private_client->queue);
+ wl_tdm_output_get_mode(private_output->output);
+ wl_display_roundtrip_queue(private_client->display, private_client->queue);
+ wl_proxy_set_queue((struct wl_proxy *)private_output->output, NULL);
+
+ if (CHECK_WL_PROTOCOL_ERROR(private_client)) {
+ pthread_mutex_unlock(&private_client->lock);
+ return TDM_ERROR_PROTOCOL_ERROR;
+ }
+
+ *width = private_output->width;
+ *height = private_output->height;
+
+ pthread_mutex_unlock(&private_client->lock);
+
+ return TDM_ERROR_NONE;
+}
+
+tdm_error
tdm_client_output_get_conn_status(tdm_client_output *output, tdm_output_conn_status *status)
{
tdm_private_client_output *private_output;
tdm_client_output_get_refresh_rate(tdm_client_output *output, unsigned int *refresh);
/**
+ * @brief Get the width and height of the given client output mode
+ * @param[in] output The client output object
+ * @param[out] width The width of output mode
+ * @param[out] height The height of output mode
+ * @return #TDM_ERROR_NONE if success. Otherwise, error value.
+ */
+tdm_error
+tdm_client_output_get_mode(tdm_client_output *output, unsigned int *width, unsigned int *height);
+
+/**
* @brief Get the connection status of the given client output
* @param[in] output The client output object
* @param[out] status The connection status
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)
{