[tracker] tests/libtracker-extract: Yet another test for the Regions of interest
- From: Ivan Frade <ifrade src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tests/libtracker-extract: Yet another test for the Regions of interest
- Date: Wed, 14 Sep 2011 15:24:14 +0000 (UTC)
commit 578fcd7de0dc887bb36338339dabe8f3d65e5748
Author: Ivan Frade <ivan frade gmail com>
Date: Wed Sep 14 16:04:27 2011 +0300
tests/libtracker-extract: Yet another test for the Regions of interest
tests/libtracker-extract/Makefile.am | 2 +-
tests/libtracker-extract/nb282393_simple.xmp | 37 ++++++++++++++++++++++++
tests/libtracker-extract/tracker-test-xmp.c | 40 ++++++++++++++++++++++++++
3 files changed, 78 insertions(+), 1 deletions(-)
---
diff --git a/tests/libtracker-extract/Makefile.am b/tests/libtracker-extract/Makefile.am
index 55e9def..435cdcb 100644
--- a/tests/libtracker-extract/Makefile.am
+++ b/tests/libtracker-extract/Makefile.am
@@ -37,4 +37,4 @@ tracker_test_utils_SOURCES = tracker-test-utils.c
tracker_test_xmp_SOURCES = tracker-test-xmp.c
-EXTRA_DIST = encoding-detect.bin areas.xmp areas-with-contacts.xmp areas-ns.xmp nb282393.xmp
+EXTRA_DIST = encoding-detect.bin areas.xmp areas-with-contacts.xmp areas-ns.xmp nb282393.xmp nb282393_simple.xmp
diff --git a/tests/libtracker-extract/nb282393_simple.xmp b/tests/libtracker-extract/nb282393_simple.xmp
new file mode 100644
index 0000000..9309a18
--- /dev/null
+++ b/tests/libtracker-extract/nb282393_simple.xmp
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+ <rdf:Description rdf:about=""
+ xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
+ xmlns:exif="http://ns.adobe.com/exif/1.0/"
+ xmlns:mwg-rs="http://www.metadataworkinggroup.com/schemas/regions/"
+ xmlns:stArea="http://ns.adobe.com/xmp/sType/Area#"
+ xmlns:nco="http://www.semanticdesktop.org/ontologies/2007/03/22/nco#"
+ xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
+ tiff:NativeDigest="256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;D41D8CD98F00B204E9800998ECF8427E"
+ exif:NativeDigest="36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;D41D8CD98F00B204E9800998ECF8427E">
+ <mwg-rs:Regions rdf:parseType="Resource">
+ <mwg-rs:RegionList>
+ <rdf:Bag>
+ <rdf:li>
+ <rdf:Description
+ mwg-rs:Name=" "
+ mwg-rs:Type="">
+ <mwg-rs:Area
+ stArea:x="0.440000"
+ stArea:y="0.365000"
+ stArea:h="0.440000"
+ stArea:w="0.586667"/>
+ <mwg-rs:Extensions
+ nco:PersonContact="urn:uuid:840a3c05-6cc6-48a1-bb56-fc50fae3345a"/>
+ </rdf:Description>
+ </rdf:li>
+ </rdf:Bag>
+ </mwg-rs:RegionList>
+ <mwg-rs:AppliedToDimensions
+ stDim:h="200"
+ stDim:w="150"/>
+ </mwg-rs:Regions>
+ </rdf:Description>
+ </rdf:RDF>
+</x:xmpmeta>
diff --git a/tests/libtracker-extract/tracker-test-xmp.c b/tests/libtracker-extract/tracker-test-xmp.c
index e72bb0d..1190cc8 100644
--- a/tests/libtracker-extract/tracker-test-xmp.c
+++ b/tests/libtracker-extract/tracker-test-xmp.c
@@ -539,6 +539,43 @@ test_xmp_regions_nb282393 ()
tracker_xmp_free (data);
}
+void
+test_xmp_regions_nb282393_2 ()
+{
+ TrackerXmpData *data;
+ TrackerXmpRegion *region;
+
+ GFile *f;
+ gchar *contents;
+ gsize size;
+ gchar *filepath;
+
+ filepath = g_build_filename (TOP_SRCDIR, "tests", "libtracker-extract", "nb282393_simple.xmp", NULL);
+ f = g_file_new_for_path (filepath);
+ g_assert(g_file_load_contents (f, NULL, &contents, &size, NULL, NULL));
+ g_object_unref (f);
+ g_free (filepath);
+
+ data = tracker_xmp_new (contents, size, "test://file");
+
+ g_assert_cmpint (1, ==, g_slist_length (data->regions));
+
+ /* Regions are stacked while parsing.*/
+ region = g_slist_nth_data (data->regions, 0);
+ g_assert_cmpstr (region->x, ==, "0.440000");
+ g_assert_cmpstr (region->y, ==, "0.365000");
+ g_assert_cmpstr (region->width, ==, "0.586667");
+ g_assert_cmpstr (region->height, ==, "0.440000");
+ g_assert_cmpstr (region->title, ==, " ");
+
+ g_assert_cmpstr (region->link_class, ==, "nco:PersonContact");
+ g_assert_cmpstr (region->link_uri, ==, "urn:uuid:840a3c05-6cc6-48a1-bb56-fc50fae3345a");
+
+ //debug_print_sparql (data);
+
+ tracker_xmp_free (data);
+}
+
int
main (int argc,
char **argv)
@@ -574,6 +611,9 @@ main (int argc,
g_test_add_func ("/libtracker-extract/tracker-xmp/xmp_regions_crash_nb282393",
test_xmp_regions_nb282393);
+ g_test_add_func ("/libtracker-extract/tracker-xmp/xmp_regions_crash_nb282393_2",
+ test_xmp_regions_nb282393_2);
+
g_test_add_func ("/libtracker-extract/tracker-xmp/xmp_regions_ns_prefix",
test_xmp_regions_ns_prefix);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]