[gimp/metadata-browser] metadata: also test raw values in the #XMPModel



commit 96a49b90abadd26ef6085e1a20c4d8451dcc388b
Author: Roman Joost <roman bromeco de>
Date:   Tue Mar 5 20:33:17 2013 +1000

    metadata: also test raw values in the #XMPModel

 plug-ins/metadata/tests/files/test_xmp.conf        |    4 +-
 plug-ins/metadata/tests/files/test_xmp.jpg         |  Bin 3129 -> 3064 bytes
 .../metadata/tests/test-xmp-model-functional.c     |   37 +++++++++++++++-----
 3 files changed, 30 insertions(+), 11 deletions(-)
---
diff --git a/plug-ins/metadata/tests/files/test_xmp.conf b/plug-ins/metadata/tests/files/test_xmp.conf
index c33dee7..ef7efcb 100644
--- a/plug-ins/metadata/tests/files/test_xmp.conf
+++ b/plug-ins/metadata/tests/files/test_xmp.conf
@@ -9,6 +9,6 @@ del     Xmp.dc.contributor
 set     Xmp.dc.contributor      "Róman Joost"
 set     Xmp.dc.contributor      "Maiko Joost"
 
-set     Xmp.dc.title    LangAlt     lang=de-DE  Hallo, Welt
+del     Xmp.dc.title
 set     Xmp.dc.title    LangAlt     Hello, World
-set     Xmp.dc.title    LangAlt     lang=ja     こんにちは世界
+set     Xmp.dc.title    LangAlt     lang=ja     こ
diff --git a/plug-ins/metadata/tests/files/test_xmp.jpg b/plug-ins/metadata/tests/files/test_xmp.jpg
index 00ff9e9..0b531c3 100644
Binary files a/plug-ins/metadata/tests/files/test_xmp.jpg and b/plug-ins/metadata/tests/files/test_xmp.jpg 
differ
diff --git a/plug-ins/metadata/tests/test-xmp-model-functional.c 
b/plug-ins/metadata/tests/test-xmp-model-functional.c
index 0d09f1f..1b5583a 100644
--- a/plug-ins/metadata/tests/test-xmp-model-functional.c
+++ b/plug-ins/metadata/tests/test-xmp-model-functional.c
@@ -46,15 +46,16 @@ typedef struct
   const gchar *name;
   int          pos;
   const gchar *expected_value;
+  const gchar *expected_values[10];
 } TestDataEntry;
 
 static TestDataEntry propertiestotest[] =
 {
-   { XMP_PREFIX_DUBLIN_CORE,  "title",          1, NULL },
-   { XMP_PREFIX_DUBLIN_CORE,  "creator",        0, NULL },
-   { XMP_PREFIX_DUBLIN_CORE,  "description",    1, NULL },
-   { XMP_PREFIX_DUBLIN_CORE,  "subject",        0, NULL },
-   { NULL,  NULL,          0 }
+   { XMP_PREFIX_DUBLIN_CORE,  "title",          1, NULL, { NULL } },
+   { XMP_PREFIX_DUBLIN_CORE,  "creator",        0, NULL, { NULL } },
+   { XMP_PREFIX_DUBLIN_CORE,  "description",    1, NULL, { NULL } },
+   { XMP_PREFIX_DUBLIN_CORE,  "subject",        0, NULL, { NULL } },
+   { NULL,                    NULL,             0, NULL, { NULL } }
 };
 TestDataEntry * const import_exportdata = propertiestotest;
 
@@ -65,9 +66,11 @@ TestDataEntry * const import_exportdata = propertiestotest;
  */
 static TestDataEntry _xmp_property_values_view[] =
 {
-   { XMP_PREFIX_DUBLIN_CORE,  "title",          0, "Hello, World," },  // lang alt
-   { XMP_PREFIX_DUBLIN_CORE,  "creator",        0, "1) Wilber, 2) Wilma" },  // seq
-   { NULL,  NULL,          0 }
+   { XMP_PREFIX_DUBLIN_CORE,  "title",      0, "Hello, World,",
+     {"x-default", "Hello, World,", "ja", "\xe3\x81\x93"} },
+   { XMP_PREFIX_DUBLIN_CORE,  "creator",    0, "1) Wilber, 2) Wilma",
+     {"1) Wilber, 2) Wilma"} },
+   { NULL,  NULL,          0, NULL, { NULL } }
 };
 TestDataEntry * const xmp_property_values_view = _xmp_property_values_view;
 
@@ -113,8 +116,10 @@ static void
 test_xmp_model_value_types (GimpTestFixture *fixture,
                             gconstpointer    data)
 {
-  int             i;
+  int             i, j;
+  guint           a, b;
   const gchar    *value;
+  const gchar   **raw         = NULL;
   TestDataEntry  *testdata;
   GError        **error       = NULL;
   gchar          *uri         = NULL;
@@ -130,11 +135,25 @@ test_xmp_model_value_types (GimpTestFixture *fixture,
    {
     testdata = &(xmp_property_values_view[i]);
 
+    /* view representation for the editor */
     value = xmp_model_get_scalar_property (fixture->xmp_model,
                                            testdata->schema_name,
                                            testdata->name);
     g_assert_cmpstr (value, ==, testdata->expected_value);
+
+    /* internal data, which the view representation is created from */
+    raw = xmp_model_get_raw_property_value (fixture->xmp_model,
+                                            testdata->schema_name,
+                                            testdata->name);
+    a = g_strv_length ((gchar **) raw);
+    b = g_strv_length ((gchar **) testdata->expected_values);
+    g_assert_cmpuint (a, ==, b);
+    for (j = 0; raw[j] != NULL; j++)
+     {
+      g_assert_cmpstr (raw[j], ==, testdata->expected_values[j]);
+     }
    }
+
 }
 
 /**


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