[gimp/metadata-browser: 43/44] Declare test data instead of initializing it.
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser: 43/44] Declare test data instead of initializing it.
- Date: Wed, 12 Sep 2012 23:10:23 +0000 (UTC)
commit f5021cc9eb41f2fe596b7a9857d0bfbbf4643e6a
Author: Roman Joost <roman bromeco de>
Date: Wed Mar 21 10:41:28 2012 +1000
Declare test data instead of initializing it.
plug-ins/metadata/tests/test-xmp-model.c | 31 +++++++++++------------------
1 files changed, 12 insertions(+), 19 deletions(-)
---
diff --git a/plug-ins/metadata/tests/test-xmp-model.c b/plug-ins/metadata/tests/test-xmp-model.c
index 4fae1fe..2d8681c 100644
--- a/plug-ins/metadata/tests/test-xmp-model.c
+++ b/plug-ins/metadata/tests/test-xmp-model.c
@@ -201,8 +201,9 @@ static void
test_xmp_model_get_raw_property_value (GimpTestFixture *fixture,
gconstpointer data)
{
- const gchar **expected;
- const gchar **result;
+ gchar *expected_alt[] = {"en_GB", "my title", NULL};
+ gchar *expected_seq[] = {"Wilber", NULL};
+ const gchar **result = NULL;
// NULL is returned if no value is set by given schema and property
// name
@@ -212,35 +213,27 @@ test_xmp_model_get_raw_property_value (GimpTestFixture *fixture,
// XMP_TYPE_LANG_ALT
// Note: XMP_TYPE_TEXT is tested with wrapper function
// xmp_model_set_scalar_property
- expected = g_new (const gchar *, 2);
- expected[0] = g_strdup ("en_GB");
- expected[1] = g_strdup ("my title");
- expected[2] = NULL;
xmp_model_set_property (fixture->xmp_model,
XMP_TYPE_LANG_ALT,
"dc",
"title",
- expected);
+ (const gchar **) g_strdupv (expected_alt));
result = xmp_model_get_raw_property_value (fixture->xmp_model,
"dc", "title");
- g_assert_cmpstr (result[0], ==, expected[0]);
- g_assert_cmpstr (result[1], ==, expected[1]);
+ g_assert (result != NULL);
+ g_assert_cmpstr (result[0], ==, expected_alt[0]);
// XMP_TYPE_TEXT_SEQ
- expected = g_new (const gchar *, 1);
- expected[0] = g_strdup ("Wilber");
- expected[1] = NULL;
- g_assert (xmp_model_set_property (fixture->xmp_model,
- XMP_TYPE_TEXT_SEQ,
- "dc",
- "creator",
- expected) == TRUE);
+ xmp_model_set_property (fixture->xmp_model,
+ XMP_TYPE_TEXT_SEQ,
+ "dc",
+ "creator",
+ (const gchar**) g_strdupv (expected_seq));
result = xmp_model_get_raw_property_value (fixture->xmp_model,
"dc", "creator");
g_assert (result != NULL);
- g_assert_cmpstr (result[0], ==, expected[0]);
- g_assert_cmpstr (result[1], ==, expected[1]);
+ g_assert_cmpstr (result[0], ==, expected_seq[0]);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]