[tracker: 6/6] tests/libtracker-extract: Fixed indentation of XMP test
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker: 6/6] tests/libtracker-extract: Fixed indentation of XMP test
- Date: Tue, 7 Sep 2010 12:38:48 +0000 (UTC)
commit c23438f329bd1f5057e3b5b5412de298784cd6b0
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Sep 7 14:38:18 2010 +0200
tests/libtracker-extract: Fixed indentation of XMP test
tests/libtracker-extract/tracker-xmp-test.c | 294 ++++++++++++++-------------
1 files changed, 148 insertions(+), 146 deletions(-)
---
diff --git a/tests/libtracker-extract/tracker-xmp-test.c b/tests/libtracker-extract/tracker-xmp-test.c
index 5fef88e..a33b68f 100644
--- a/tests/libtracker-extract/tracker-xmp-test.c
+++ b/tests/libtracker-extract/tracker-xmp-test.c
@@ -69,151 +69,152 @@
" </x:xmpmeta>"
#define METERING_MODE_XMP \
- " <x:xmpmeta " \
- " xmlns:x=\'adobe:ns:meta/\'" \
- " xmlns:exif=\"http://ns.adobe.com/exif/1.0/\">" \
- " <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">" \
- " <rdf:Description rdf:about=\"\">" \
- " <exif:MeteringMode>%d</exif:MeteringMode>" \
- " </rdf:Description>" \
- " </rdf:RDF></x:xmpmeta> "
+" <x:xmpmeta " \
+" xmlns:x=\'adobe:ns:meta/\'" \
+" xmlns:exif=\"http://ns.adobe.com/exif/1.0/\">" \
+" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">" \
+" <rdf:Description rdf:about=\"\">" \
+" <exif:MeteringMode>%d</exif:MeteringMode>" \
+" </rdf:Description>" \
+" </rdf:RDF></x:xmpmeta> "
#define ORIENTATION_XMP \
- " <x:xmpmeta " \
- " xmlns:x=\'adobe:ns:meta/\'" \
- " xmlns:exif=\"http://ns.adobe.com/exif/1.0/\">" \
- " <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">" \
- " <rdf:Description rdf:about=\"\">" \
- " <exif:Orientation>%s</exif:Orientation>" \
- " </rdf:Description>" \
- " </rdf:RDF></x:xmpmeta> "
+" <x:xmpmeta " \
+" xmlns:x=\'adobe:ns:meta/\'" \
+" xmlns:exif=\"http://ns.adobe.com/exif/1.0/\">" \
+" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">" \
+" <rdf:Description rdf:about=\"\">" \
+" <exif:Orientation>%s</exif:Orientation>" \
+" </rdf:Description>" \
+" </rdf:RDF></x:xmpmeta> "
typedef struct {
- const gchar *exif_value;
- const gchar *nepomuk_translation;
+ const gchar *exif_value;
+ const gchar *nepomuk_translation;
} ExifNepomuk;
static ExifNepomuk METERING_MODES [] = {
- {"0", "nmm:metering-mode-other"},
- {"1", "nmm:metering-mode-average"},
- {"2", "nmm:metering-mode-center-weighted-average"},
- {"3", "nmm:metering-mode-spot"},
- {"4", "nmm:metering-mode-multispot"},
- {"5", "nmm:metering-mode-pattern"},
- {"6", "nmm:metering-mode-partial"},
- {NULL, NULL}
+ {"0", "nmm:metering-mode-other"},
+ {"1", "nmm:metering-mode-average"},
+ {"2", "nmm:metering-mode-center-weighted-average"},
+ {"3", "nmm:metering-mode-spot"},
+ {"4", "nmm:metering-mode-multispot"},
+ {"5", "nmm:metering-mode-pattern"},
+ {"6", "nmm:metering-mode-partial"},
+ {NULL, NULL}
};
static ExifNepomuk ORIENTATIONS [] = {
- {"top - right", "nfo:orientation-top-mirror"},
- {"bottom - right", "nfo:orientation-bottom-mirror"},
- {"bottom - left", "nfo:orientation-bottom"},
- {"left - top", "nfo:orientation-left-mirror"},
- {"right - top", "nfo:orientation-right"},
- {"right - bottom", "nfo:orientation-right-mirror"},
- {"left - bottom", "nfo:orientation-left"},
- {"invalid value", "nfo:orientation-top"}
+ {"top - right", "nfo:orientation-top-mirror"},
+ {"bottom - right", "nfo:orientation-bottom-mirror"},
+ {"bottom - left", "nfo:orientation-bottom"},
+ {"left - top", "nfo:orientation-left-mirror"},
+ {"right - top", "nfo:orientation-right"},
+ {"right - bottom", "nfo:orientation-right-mirror"},
+ {"left - bottom", "nfo:orientation-left"},
+ {"invalid value", "nfo:orientation-top"}
};
static TrackerXmpData *
get_example_expected (void)
{
- TrackerXmpData *data;
-
- data = g_new0 (TrackerXmpData, 1);
-
- /* NS_DC */
- data->title = g_strdup ("Title of the content");
- data->rights = g_strdup ("CC share alike");
- data->creator = g_strdup ("The ultimate creator");
- data->description = g_strdup ("Description of the content");
- data->date = g_strdup ("2010-03-18T15:17:04Z");
- data->keywords = g_strdup ("test, data, xmp");
- data->subject = g_strdup ("Subject of the content");
-
- data->publisher = g_strdup ("A honest developer"); /* publisher */
- data->contributor = g_strdup ("A honest contributor");
- data->type = NULL ;
- data->format = g_strdup ("application/pdf");
- data->identifier = g_strdup ("12345");
- data->source = g_strdup ("My dirty mind");
- data->language = g_strdup ("Spanglish");
- data->relation = g_strdup ("Single");
- data->coverage = g_strdup ("Pretty high after this test");
-
- /* NS_CC */
- data->license = NULL;
-
- /* NS_PDF */
- data->pdf_title = NULL;
- data->pdf_keywords = NULL;
-
- /* NS_EXIF*/
- data->title2 = g_strdup ("Title in exif");
- data->time_original = g_strdup ("2010-03-18T15:17:04Z");
- data->artist = g_strdup ("Artist in exif");
- data->make = g_strdup ("Make in exif");
- data->model = g_strdup ("Model in exif");
- data->orientation = g_strdup ("nfo:orientation-top");
- data->flash = g_strdup ("nmm:flash-off");
- data->metering_mode = g_strdup ("nmm:metering-mode-spot");
- data->exposure_time = g_strdup ("1000"); /* exposure time */
- data->fnumber = g_strdup ("12"); /* fnumber */
- data->focal_length = g_strdup ("50"); /* focal length */
-
- data->iso_speed_ratings = g_strdup ("400"); /* iso speed rating */
- data->white_balance = g_strdup ("nmm:white-balance-manual");
- data->copyright = g_strdup ("Copyright in exif");
-
- /* NS_XAP */
- data->rating = NULL;
-
- /* NS_IPTC4XMP */
- /* NS_PHOTOSHOP */
- data->address = NULL; /* address */
- data->country = NULL; /* country */
- data->state = NULL; /* state */
- data->city = NULL; /* city */
-
- return data;
+ TrackerXmpData *data;
+
+ data = g_new0 (TrackerXmpData, 1);
+
+ /* NS_DC */
+ data->title = g_strdup ("Title of the content");
+ data->rights = g_strdup ("CC share alike");
+ data->creator = g_strdup ("The ultimate creator");
+ data->description = g_strdup ("Description of the content");
+ data->date = g_strdup ("2010-03-18T15:17:04Z");
+ data->keywords = g_strdup ("test, data, xmp");
+ data->subject = g_strdup ("Subject of the content");
+
+ data->publisher = g_strdup ("A honest developer"); /* publisher */
+ data->contributor = g_strdup ("A honest contributor");
+ data->type = NULL ;
+ data->format = g_strdup ("application/pdf");
+ data->identifier = g_strdup ("12345");
+ data->source = g_strdup ("My dirty mind");
+ data->language = g_strdup ("Spanglish");
+ data->relation = g_strdup ("Single");
+ data->coverage = g_strdup ("Pretty high after this test");
+
+ /* NS_CC */
+ data->license = NULL;
+
+ /* NS_PDF */
+ data->pdf_title = NULL;
+ data->pdf_keywords = NULL;
+
+ /* NS_EXIF*/
+ data->title2 = g_strdup ("Title in exif");
+ data->time_original = g_strdup ("2010-03-18T15:17:04Z");
+ data->artist = g_strdup ("Artist in exif");
+ data->make = g_strdup ("Make in exif");
+ data->model = g_strdup ("Model in exif");
+ data->orientation = g_strdup ("nfo:orientation-top");
+ data->flash = g_strdup ("nmm:flash-off");
+ data->metering_mode = g_strdup ("nmm:metering-mode-spot");
+ data->exposure_time = g_strdup ("1000"); /* exposure time */
+ data->fnumber = g_strdup ("12"); /* fnumber */
+ data->focal_length = g_strdup ("50"); /* focal length */
+
+ data->iso_speed_ratings = g_strdup ("400"); /* iso speed rating */
+ data->white_balance = g_strdup ("nmm:white-balance-manual");
+ data->copyright = g_strdup ("Copyright in exif");
+
+ /* NS_XAP */
+ data->rating = NULL;
+
+ /* NS_IPTC4XMP */
+ /* NS_PHOTOSHOP */
+ data->address = NULL; /* address */
+ data->country = NULL; /* country */
+ data->state = NULL; /* state */
+ data->city = NULL; /* city */
+
+ return data;
};
static void
test_parsing_xmp (void)
{
- TrackerXmpData *data;
- TrackerXmpData *expected;
+ TrackerXmpData *data;
+ TrackerXmpData *expected;
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
- data = tracker_xmp_new (BROKEN_XMP, strlen (BROKEN_XMP), "test://file");
+ data = tracker_xmp_new (BROKEN_XMP, strlen (BROKEN_XMP), "test://file");
g_assert (data != NULL);
tracker_xmp_free (data);
- }
- g_test_trap_assert_stderr ("*parsing failure*");
-
- data = tracker_xmp_new (EXAMPLE_XMP, strlen (EXAMPLE_XMP), "test://file");
- expected = get_example_expected ();
-
- /* NS_DC */
- g_assert_cmpstr (data->format, ==, expected->format);
- g_assert_cmpstr (data->title, ==, expected->title);
- g_assert_cmpstr (data->rights, ==, expected->rights);
- g_assert_cmpstr (data->description, ==, expected->description);
- g_assert_cmpstr (data->date, ==, expected->date);
- g_assert_cmpstr (data->keywords, ==, expected->keywords);
- g_assert_cmpstr (data->subject, ==, expected->subject);
- g_assert_cmpstr (data->publisher, ==, expected->publisher);
- g_assert_cmpstr (data->contributor, ==, expected->contributor);
- g_assert_cmpstr (data->identifier, ==, expected->identifier);
- g_assert_cmpstr (data->source, ==, expected->source);
- g_assert_cmpstr (data->language, ==, expected->language);
- g_assert_cmpstr (data->relation, ==, expected->relation);
- g_assert_cmpstr (data->coverage, ==, expected->coverage);
- g_assert_cmpstr (data->creator, ==, expected->creator);
-
- /* NS_EXIF*/
- g_assert_cmpstr (data->title2, ==, expected->title2);
+ }
+
+ g_test_trap_assert_stderr ("*parsing failure*");
+
+ data = tracker_xmp_new (EXAMPLE_XMP, strlen (EXAMPLE_XMP), "test://file");
+ expected = get_example_expected ();
+
+ /* NS_DC */
+ g_assert_cmpstr (data->format, ==, expected->format);
+ g_assert_cmpstr (data->title, ==, expected->title);
+ g_assert_cmpstr (data->rights, ==, expected->rights);
+ g_assert_cmpstr (data->description, ==, expected->description);
+ g_assert_cmpstr (data->date, ==, expected->date);
+ g_assert_cmpstr (data->keywords, ==, expected->keywords);
+ g_assert_cmpstr (data->subject, ==, expected->subject);
+ g_assert_cmpstr (data->publisher, ==, expected->publisher);
+ g_assert_cmpstr (data->contributor, ==, expected->contributor);
+ g_assert_cmpstr (data->identifier, ==, expected->identifier);
+ g_assert_cmpstr (data->source, ==, expected->source);
+ g_assert_cmpstr (data->language, ==, expected->language);
+ g_assert_cmpstr (data->relation, ==, expected->relation);
+ g_assert_cmpstr (data->coverage, ==, expected->coverage);
+ g_assert_cmpstr (data->creator, ==, expected->creator);
+
+ /* NS_EXIF*/
+ g_assert_cmpstr (data->title2, ==, expected->title2);
g_assert_cmpstr (data->time_original, ==, expected->time_original);
g_assert_cmpstr (data->artist, ==, expected->artist);
g_assert_cmpstr (data->make, ==, expected->make);
@@ -229,44 +230,44 @@ test_parsing_xmp (void)
g_assert_cmpstr (data->white_balance, ==, expected->white_balance);
g_assert_cmpstr (data->copyright, ==, expected->copyright);
- tracker_xmp_free (expected);
+ tracker_xmp_free (expected);
tracker_xmp_free (data);
}
static void
test_xmp_metering_mode (void)
{
- gint i;
+ gint i;
- for (i = 0; METERING_MODES[i].exif_value != NULL; i++) {
+ for (i = 0; METERING_MODES[i].exif_value != NULL; i++) {
TrackerXmpData *data;
gchar *xmp;
- xmp = g_strdup_printf (METERING_MODE_XMP, i);
- data = tracker_xmp_new (xmp, strlen (xmp), "local://file");
- g_free (xmp);
+ xmp = g_strdup_printf (METERING_MODE_XMP, i);
+ data = tracker_xmp_new (xmp, strlen (xmp), "local://file");
+ g_free (xmp);
- g_assert_cmpstr (data->metering_mode, ==, METERING_MODES[i].nepomuk_translation);
+ g_assert_cmpstr (data->metering_mode, ==, METERING_MODES[i].nepomuk_translation);
tracker_xmp_free (data);
- }
+ }
}
static void
test_xmp_orientation (void)
{
- gint i;
+ gint i;
- for (i = 0; i < G_N_ELEMENTS (ORIENTATIONS); i++) {
+ for (i = 0; i < G_N_ELEMENTS (ORIENTATIONS); i++) {
TrackerXmpData *data;
gchar *xmp;
- xmp = g_strdup_printf (ORIENTATION_XMP, ORIENTATIONS[i].exif_value);
- data = tracker_xmp_new (xmp, strlen (xmp), "local://file");
- g_free (xmp);
+ xmp = g_strdup_printf (ORIENTATION_XMP, ORIENTATIONS[i].exif_value);
+ data = tracker_xmp_new (xmp, strlen (xmp), "local://file");
+ g_free (xmp);
- g_assert_cmpstr (data->orientation, ==, ORIENTATIONS[i].nepomuk_translation);
+ g_assert_cmpstr (data->orientation, ==, ORIENTATIONS[i].nepomuk_translation);
tracker_xmp_free (data);
- }
+ }
}
static void
@@ -329,7 +330,7 @@ int
main (int argc,
char **argv)
{
- gint result;
+ gint result;
g_type_init ();
g_thread_init (NULL);
@@ -339,22 +340,23 @@ main (int argc,
#ifdef HAVE_EXEMPI
g_test_add_func ("/libtracker-extract/tracker-xmp/parsing_xmp",
- test_parsing_xmp);
+ test_parsing_xmp);
- g_test_add_func ("/libtracker-extract/tracker-xmp/metering-mode",
- test_xmp_metering_mode);
+ g_test_add_func ("/libtracker-extract/tracker-xmp/metering-mode",
+ test_xmp_metering_mode);
- g_test_add_func ("/libtracker-extract/tracker-xmp/orientation",
- test_xmp_orientation);
+ g_test_add_func ("/libtracker-extract/tracker-xmp/orientation",
+ test_xmp_orientation);
- g_test_add_func ("/libtracker-extract/tracker-xmp/sparql_translation",
- test_xmp_apply);
+ g_test_add_func ("/libtracker-extract/tracker-xmp/sparql_translation",
+ test_xmp_apply);
#endif
- g_test_add_func ("/libtracker-extract/tracker-xmp/sparql_translation_location",
- test_xmp_apply_location);
- result = g_test_run ();
+ g_test_add_func ("/libtracker-extract/tracker-xmp/sparql_translation_location",
+ test_xmp_apply_location);
+
+ result = g_test_run ();
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]