[libgdata/wip/rishi/drive: 6/8] tests: ODTs are represented by GDataDocumentsDocument in Drive v2



commit 70b3a2ca3506eca72f7f8976928ec639bee01620
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Sep 23 15:21:22 2016 +0200

    tests: ODTs are represented by GDataDocumentsDocument in Drive v2
    
    GDataDocumentText is bound to application/vnd.google-apps.document,
    which represents native Drive-specific text documents. Anything that's
    not a Drive-specific type, except PDFs, are meant to be represented as
    GDataDocumentsDocument.
    
    Trying to upload an ODT as a GDataDocumentText confuses things. We
    pass the ODT's MIME type to the GDataUploadStream, which is not the
    MIME type of the associated entry. The updated GDataEntry that is
    obtained as a side-effect of the upload is set to match the stream's
    MIME type. Therefore it is a GDataDocumentDocuments, which isn't the
    same type as the initial entry we started with.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684920

 gdata/tests/documents.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/gdata/tests/documents.c b/gdata/tests/documents.c
index 155a99f..968c860 100644
--- a/gdata/tests/documents.c
+++ b/gdata/tests/documents.c
@@ -938,7 +938,7 @@ static void
 set_up_update_document (UpdateDocumentData *data, gconstpointer _test_params)
 {
        const UpdateDocumentTestParams *test_params = _test_params;
-       GDataDocumentsText *document;
+       GDataDocumentsDocument *document;
        gchar *title, *document_file_path, *trace_name;
        GFile *document_file;
 
@@ -950,7 +950,7 @@ set_up_update_document (UpdateDocumentData *data, gconstpointer _test_params)
        g_free (trace_name);
 
        /* Create a document */
-       document = gdata_documents_text_new (NULL);
+       document = gdata_documents_document_new (NULL);
        title = g_strdup_printf ("Test Update file (%s)", test_params->test_name);
        gdata_entry_set_title (GDATA_ENTRY (document), title);
        g_free (title);
@@ -1097,7 +1097,7 @@ test_update (UpdateDocumentData *data, gconstpointer _test_params)
                g_object_unref (file_stream);
        }
 
-       g_assert (GDATA_IS_DOCUMENTS_TEXT (updated_document));
+       g_assert (GDATA_IS_DOCUMENTS_DOCUMENT (updated_document));
 
        /* Check for success */
        switch (test_params->payload_type) {
@@ -1214,7 +1214,7 @@ set_up_folders (FoldersData *data, GDataDocumentsService *service, gboolean init
        document_file = g_file_new_for_path (path);
        g_free (path);
 
-       document = GDATA_DOCUMENTS_DOCUMENT (gdata_documents_text_new (NULL));
+       document = gdata_documents_document_new (NULL);
        gdata_entry_set_title (GDATA_ENTRY (document), "add_file_folder_move_text");
 
        file_info = g_file_query_info (document_file, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," 
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
@@ -1245,7 +1245,7 @@ set_up_folders (FoldersData *data, GDataDocumentsService *service, gboolean init
        /* Finish the upload */
        new_document = gdata_documents_service_finish_upload (service, upload_stream, &error);
        g_assert_no_error (error);
-       g_assert (GDATA_IS_DOCUMENTS_TEXT (new_document));
+       g_assert (GDATA_IS_DOCUMENTS_DOCUMENT (new_document));
 
        g_object_unref (upload_stream);
        g_object_unref (file_stream);
@@ -1261,7 +1261,7 @@ set_up_folders (FoldersData *data, GDataDocumentsService *service, gboolean init
                                                                                     
gdata_documents_service_get_primary_authorization_domain (),
                                                                                     gdata_entry_get_id 
(GDATA_ENTRY (new_document)), NULL,
                                                                                     G_OBJECT_TYPE 
(new_document), NULL, NULL));
-       g_assert (GDATA_IS_DOCUMENTS_TEXT (data->document));
+       g_assert (GDATA_IS_DOCUMENTS_DOCUMENT (data->document));
 }
 
 static void
@@ -1299,7 +1299,7 @@ test_folders_add_to_folder (FoldersData *data, gconstpointer service)
                                                                                              
GDATA_DOCUMENTS_ENTRY (data->document),
                                                                                              data->folder, 
NULL, &error));
        g_assert_no_error (error);
-       g_assert (GDATA_IS_DOCUMENTS_TEXT (new_document));
+       g_assert (GDATA_IS_DOCUMENTS_DOCUMENT (new_document));
 
        /* Check it's still the same document */
        g_assert_cmpstr (gdata_entry_get_title (GDATA_ENTRY (new_document)), ==, gdata_entry_get_title 
(GDATA_ENTRY (data->document)));
@@ -1363,7 +1363,7 @@ test_folders_remove_from_folder (FoldersData *data, gconstpointer service)
                                                                                                   
GDATA_DOCUMENTS_ENTRY (data->document),
                                                                                                   
data->folder, NULL, &error));
        g_assert_no_error (error);
-       g_assert (GDATA_IS_DOCUMENTS_TEXT (new_document));
+       g_assert (GDATA_IS_DOCUMENTS_DOCUMENT (new_document));
 
        /* Check it's still the same document */
        g_assert_cmpstr (gdata_entry_get_title (GDATA_ENTRY (new_document)), ==, gdata_entry_get_title 
(GDATA_ENTRY (data->document)));


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