[libgdata/offline-testing] documents: Fix default value of GDataDocumentsUploadQuery:convert



commit a76f6981248688156032769973f3043bda1d1769
Author: Philip Withnall <philip tecnocode co uk>
Date:   Tue Jul 30 13:18:20 2013 +0200

    documents: Fix default value of GDataDocumentsUploadQuery:convert
    
    Also add a test for it, because tests are good.

 .../documents/gdata-documents-upload-query.c       |    1 +
 gdata/tests/documents.c                            |   26 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gdata/services/documents/gdata-documents-upload-query.c 
b/gdata/services/documents/gdata-documents-upload-query.c
index 270d10b..a019838 100644
--- a/gdata/services/documents/gdata-documents-upload-query.c
+++ b/gdata/services/documents/gdata-documents-upload-query.c
@@ -210,6 +210,7 @@ static void
 gdata_documents_upload_query_init (GDataDocumentsUploadQuery *self)
 {
        self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOCUMENTS_UPLOAD_QUERY, 
GDataDocumentsUploadQueryPrivate);
+       self->priv->convert = TRUE;
 }
 
 static void
diff --git a/gdata/tests/documents.c b/gdata/tests/documents.c
index 56cbcf0..c22cf2d 100644
--- a/gdata/tests/documents.c
+++ b/gdata/tests/documents.c
@@ -1655,6 +1655,31 @@ test_query_etag (void)
        g_object_unref (query);
 }
 
+/* Test getting and setting the GDataDocumentsUploadQuery:convert property */
+static void
+test_upload_query_properties_convert (void)
+{
+       gboolean convert;
+       GDataDocumentsUploadQuery *query;
+
+       /* Verifying the normal state of the property in a newly-constructed instance of 
GDataDocumentsUploadQuery */
+       query = gdata_documents_upload_query_new ();
+       g_assert (gdata_documents_upload_query_get_convert (query) == TRUE);
+
+       g_object_get (query, "convert", &convert, NULL);
+       g_assert (convert == TRUE);
+
+       /* Setting the property. */
+       gdata_documents_upload_query_set_convert (query, FALSE);
+       g_assert (gdata_documents_upload_query_get_convert (query) == FALSE);
+
+       /* Setting it another way. */
+       g_object_set (query, "convert", TRUE, NULL);
+       g_assert (gdata_documents_upload_query_get_convert (query) == TRUE);
+
+       g_object_unref (query);
+}
+
 /* Here we hardcode the feed URI, but it should really be extracted from a document feed, as the 
GDATA_LINK_BATCH link */
 #define BATCH_URI "https://docs.google.com/feeds/default/private/full/batch";
 
@@ -2090,6 +2115,7 @@ main (int argc, char *argv[])
 
        g_test_add_func ("/documents/folder/parser/normal", test_folder_parser_normal);
        g_test_add_func ("/documents/query/etag", test_query_etag);
+       g_test_add_func ("/documents/upload-query/properties/convert", test_upload_query_properties_convert);
 
        retval = g_test_run ();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]