[gimp/metadata-browser: 31/45] Test setting/getting properties in empty XMPModels.



commit cdc3527ad93bd3fe75dd9246f5367defdfbea396
Author: Roman Joost <roman bromeco de>
Date:   Sat Oct 1 13:17:45 2011 +1000

    Test setting/getting properties in empty XMPModels.

 .../metadata/tests/test-xmp-model-functional.c     |   59 +++++++++++---------
 1 files changed, 32 insertions(+), 27 deletions(-)
---
diff --git a/plug-ins/metadata/tests/test-xmp-model-functional.c 
b/plug-ins/metadata/tests/test-xmp-model-functional.c
index 74d0fad..9b8ddb4 100644
--- a/plug-ins/metadata/tests/test-xmp-model-functional.c
+++ b/plug-ins/metadata/tests/test-xmp-model-functional.c
@@ -52,6 +52,7 @@ static TestDataEntry propertiestotest[] =
    { XMP_PREFIX_DUBLIN_CORE,  "title",          1 },
    { XMP_PREFIX_DUBLIN_CORE,  "creator",        0 },
    { XMP_PREFIX_DUBLIN_CORE,  "description",    1 },
+   { XMP_PREFIX_DUBLIN_CORE,  "subject",        0 },
    { XMP_PREFIX_PHOTOSHOP,    "CaptionWriter",  0 },
    { NULL,  NULL,          0 }
 };
@@ -176,6 +177,7 @@ static void
 test_xmp_model_import_export (GimpTestFixture *fixture,
                               gconstpointer    data)
 {
+  int             i;
   gboolean        result;
   GString        *buffer;
   TestDataEntry  *testdata;
@@ -183,33 +185,36 @@ test_xmp_model_import_export (GimpTestFixture *fixture,
   const gchar    *scalarvalue = "test";
   GError        **error       = NULL;
 
-  /* dc:title */
-  testdata = &(import_exportdata[0]);
-
-  /* set a new scalar value */
-  result = xmp_model_set_scalar_property (fixture->xmp_model,
-                                          testdata->schema_name,
-                                          testdata->name,
-                                          scalarvalue);
-  g_assert (result == TRUE);
-
-  /* export */
-  buffer = g_string_new ("GIMP_TEST");
-  xmp_generate_packet (fixture->xmp_model, buffer);
-
-  /* import */
-  xmp_model_parse_buffer (fixture->xmp_model,
-                          buffer->str,
-                          buffer->len,
-                          TRUE,
-                          error);
-  after_value = xmp_model_get_raw_property_value (fixture->xmp_model,
-                                                  testdata->schema_name,
-                                                  testdata->name);
-
-  /* check that the scalar value is correctly exported */
-  g_assert (after_value != NULL);
-  g_assert_cmpstr (after_value[testdata->pos], ==, scalarvalue);
+
+  for (i = 0; import_exportdata[i].name != NULL; ++i)
+   {
+    testdata = &(import_exportdata[i]);
+
+    /* set a new scalar value */
+    result = xmp_model_set_scalar_property (fixture->xmp_model,
+                                            testdata->schema_name,
+                                            testdata->name,
+                                            scalarvalue);
+    g_assert (result == TRUE);
+
+    /* export */
+    buffer = g_string_new ("GIMP_TEST");
+    xmp_generate_packet (fixture->xmp_model, buffer);
+
+    /* import */
+    xmp_model_parse_buffer (fixture->xmp_model,
+                            buffer->str,
+                            buffer->len,
+                            TRUE,
+                            error);
+    after_value = xmp_model_get_raw_property_value (fixture->xmp_model,
+                                                    testdata->schema_name,
+                                                    testdata->name);
+
+    /* check that the scalar value is correctly exported */
+    g_assert (after_value != NULL);
+    g_assert_cmpstr (after_value[testdata->pos], ==, scalarvalue);
+   }
 }
 
 int main(int argc, char **argv)


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