[libdmapsharing/gobject-introspection] Some work on test-dmap-client



commit 76c95e6e724c928a6438c21f23d60c63a3a6941a
Author: W. Michael Petullo <mike flyn org>
Date:   Wed Jun 25 23:05:01 2014 -0400

    Some work on test-dmap-client
    
    Signed-off-by: W. Michael Petullo <mike flyn org>

 tests/test-dmap-client.c |   10 +++++++---
 tests/test-dpap-record.c |   16 +++++++++++++++-
 2 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/tests/test-dmap-client.c b/tests/test-dmap-client.c
index 85b748d..4ffbe94 100644
--- a/tests/test-dmap-client.c
+++ b/tests/test-dmap-client.c
@@ -39,19 +39,23 @@ static guint conn_type = DAAP;
 static void
 print_record (guint id, DMAPRecord *record, gpointer user_data)
 {
-       gboolean has_video;
-       gchar   *artist, *title;
+       gboolean has_video = FALSE;
+       gchar   *artist = NULL, *title = NULL, *format = NULL, *filename = NULL;
 
        g_object_get (record,
                     "has-video", &has_video,
                     "songartist", &artist,
                     "title",  &title,
+                    "format",  &format,
+                    "filename",  &filename,
                      NULL);
 
-       g_print ("%d: %s %s (has video: %s)\n", id, artist, title, has_video ? "Y" : "N");
+       g_print ("%d: %s %s %s %s (has video: %s)\n", id, artist, title, format, filename, has_video ? "Y" : 
"N");
 
        g_free (artist);
        g_free (title);
+       g_free (format);
+       g_free (filename);
 }
 
 static void
diff --git a/tests/test-dpap-record.c b/tests/test-dpap-record.c
index 30dbb71..3ad9c11 100644
--- a/tests/test-dpap-record.c
+++ b/tests/test-dpap-record.c
@@ -46,6 +46,7 @@ enum {
         PROP_PIXEL_HEIGHT,
         PROP_PIXEL_WIDTH,
         PROP_FORMAT,
+        PROP_THUMBNAIL,
         PROP_COMMENTS
 };
 
@@ -88,6 +89,12 @@ test_dpap_record_set_property (GObject *object,
                        g_free (record->priv->format);
                         record->priv->format = g_value_dup_string (value);
                         break;
+                case PROP_THUMBNAIL:
+                       if (record->priv->thumbnail) {
+                                g_byte_array_unref (record->priv->thumbnail);
+                        }
+                        record->priv->thumbnail = g_byte_array_ref (g_value_get_pointer (value));
+                        break;
                 case PROP_COMMENTS:
                        g_free (record->priv->comments);
                         record->priv->comments = g_value_dup_string (value);
@@ -135,6 +142,9 @@ test_dpap_record_get_property (GObject *object,
                 case PROP_FORMAT:
                         g_value_set_string (value, record->priv->format);
                         break;
+                case PROP_THUMBNAIL:
+                       g_value_set_pointer (value, record->priv->thumbnail);
+                        break;
                 case PROP_COMMENTS:
                         g_value_set_string (value, record->priv->comments);
                         break;
@@ -187,6 +197,7 @@ test_dpap_record_class_init (TestDPAPRecordClass *klass)
         g_object_class_override_property (gobject_class, PROP_PIXEL_HEIGHT, "pixel-height");
         g_object_class_override_property (gobject_class, PROP_PIXEL_WIDTH, "pixel-width");
         g_object_class_override_property (gobject_class, PROP_FORMAT, "format");
+        g_object_class_override_property (gobject_class, PROP_THUMBNAIL, "thumbnail");
         g_object_class_override_property (gobject_class, PROP_COMMENTS, "comments");
 }
 
@@ -223,7 +234,10 @@ test_dpap_record_finalize (GObject *object)
        g_free (record->priv->filename);
        g_free (record->priv->format);
        g_free (record->priv->comments);
-       g_byte_array_unref (record->priv->thumbnail);
+
+       if (record->priv->thumbnail) {
+               g_byte_array_unref (record->priv->thumbnail);
+       }
 
        G_OBJECT_CLASS (test_dpap_record_parent_class)->finalize (object);
 }


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