Commit 51a16f12 authored by Ivan Frade's avatar Ivan Frade

tests/libtracker-extract: More XMP tests for the RoI

Fixed the Area namespace according to the spec.
parent 1c512c40
......@@ -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
EXTRA_DIST = encoding-detect.bin areas.xmp areas-with-contacts.xmp areas-ns.xmp nb282393.xmp
......@@ -3,7 +3,7 @@
xmlns:x="adobe:ns:meta/"
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:my-dym="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
xmlns:my-area="http://ns.adobe.com/xap/1.0/sType/Area#"
xmlns:my-area="http://ns.adobe.com/xmp/sType/Area#"
xmlns:my-ns="http://www.metadataworkinggroup.com/schemas/regions/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="">
......
......@@ -3,7 +3,7 @@
<rdf:Description rdf:about=''
xmlns:mwg-rs='http://www.metadataworkinggroup.com/schemas/regions/'
xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#'
xmlns:stArea='http://ns.adobe.com/xap/1.0/sType/Area#'
xmlns:stArea='http://ns.adobe.com/xmp/sType/Area#'
xmlns:stDim='http://ns.adobe.com/xap/1.0/sType/Dimensions#'
xmlns:nco='http://www.semanticdesktop.org/ontologies/2007/03/22/nco#'
xmlns:xmpRights='http://ns.adobe.com/xap/1.0/rights/'>
......
......@@ -2,7 +2,7 @@
xmlns:x="adobe:ns:meta/"
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
xmlns:stArea="http://ns.adobe.com/xap/1.0/sType/Area#"
xmlns:stArea="http://ns.adobe.com/xmp/sType/Area#"
xmlns:mwg-rs="http://www.metadataworkinggroup.com/schemas/regions/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="">
......
<?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:xmp="http://ns.adobe.com/xap/1.0/"
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#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmp:CreateDate="2011-09-11T11:29:48"
xmp:ModifyDate="2011-09-13T15:33:39"
xmp:Rating="0"
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;7ED55293F2FB266034F7E47E457379EF"
tiff:Orientation="1"
tiff:YCbCrPositioning="2"
tiff:XResolution="72/1"
tiff:YResolution="72/1"
tiff:ResolutionUnit="2"
tiff:DateTime="2011-09-13T15:33:39"
tiff:Make="Canon"
tiff:Model="Canon PowerShot S95"
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;47F59181CDFD6A141145DA200B8C041D"
exif:ExifVersion="0230"
exif:FlashpixVersion="0100"
exif:ColorSpace="1"
exif:CompressedBitsPerPixel="3/1"
exif:PixelXDimension="150"
exif:PixelYDimension="200"
exif:DateTimeOriginal="2011-09-11T11:29:48"
exif:DateTimeDigitized="2011-09-11T11:29:48"
exif:ExposureTime="1/800"
exif:FNumber="40/10"
exif:ShutterSpeedValue="309/32"
exif:ApertureValue="128/32"
exif:ExposureBiasValue="0/3"
exif:MaxApertureValue="116/32"
exif:MeteringMode="5"
exif:FocalLength="12845/1000"
exif:FocalPlaneXResolution="3648000/292"
exif:FocalPlaneYResolution="2736000/219"
exif:FocalPlaneResolutionUnit="2"
exif:SensingMethod="2"
exif:FileSource="3"
exif:CustomRendered="0"
exif:ExposureMode="0"
exif:WhiteBalance="0"
exif:DigitalZoomRatio="3648/3648"
exif:SceneCaptureType="0">
<exif:Flash
exif:Fired="False"
exif:Return="0"
exif:Mode="2"
exif:Function="False"
exif:RedEyeMode="False"/>
<exif:ComponentsConfiguration>
<rdf:Seq>
<rdf:li>1</rdf:li>
<rdf:li>2</rdf:li>
<rdf:li>3</rdf:li>
<rdf:li>0</rdf:li>
</rdf:Seq>
</exif:ComponentsConfiguration>
<exif:UserComment>
<rdf:Alt>
<rdf:li xml:lang="x-default"/>
</rdf:Alt>
</exif:UserComment>
<exif:ISOSpeedRatings>
<rdf:Seq>
<rdf:li>80</rdf:li>
</rdf:Seq>
</exif:ISOSpeedRatings>
<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.433333"
stArea:y="0.370000"
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>
<dc:description>
<rdf:Alt>
<rdf:li xml:lang="x-default"> </rdf:li>
</rdf:Alt>
</dc:description>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
......@@ -392,8 +392,7 @@ test_xmp_regions (void)
g_assert_cmpint (2, ==, g_slist_length (data->regions));
/* Regions are stacked while parsing.*/
region = g_slist_nth_data (data->regions, 0);
region = g_slist_nth_data (data->regions, 1);
g_assert_cmpstr (region->x, ==, "0.51");
g_assert_cmpstr (region->y, ==, "0.51");
g_assert_cmpstr (region->width, ==, "0.01");
......@@ -402,7 +401,7 @@ test_xmp_regions (void)
g_assert_cmpstr (region->title, ==, "Fido");
g_assert_cmpstr (region->description, ==, "Fido looks happy!");
region = g_slist_nth_data (data->regions, 1);
region = g_slist_nth_data (data->regions, 0);
g_assert_cmpstr (region->x, ==, "0.5");
g_assert_cmpstr (region->y, ==, "0.5");
g_assert_cmpstr (region->width, ==, "0.06");
......@@ -438,7 +437,7 @@ test_xmp_regions_quill (void)
g_assert_cmpint (2, ==, g_slist_length (data->regions));
region = g_slist_nth_data (data->regions, 0);
region = g_slist_nth_data (data->regions, 1);
g_assert_cmpstr (region->x, ==, "0.4");
g_assert_cmpstr (region->y, ==, "0.3");
g_assert_cmpstr (region->width, ==, "0.17");
......@@ -448,7 +447,7 @@ test_xmp_regions_quill (void)
g_assert_cmpstr (region->link_class, ==, "nco:PersonContact");
g_assert_cmpstr (region->link_uri, ==, "urn:uuid:2");
region = g_slist_nth_data (data->regions, 1);
region = g_slist_nth_data (data->regions, 0);
g_assert_cmpstr (region->x, ==, "0.3");
g_assert_cmpstr (region->y, ==, "0.4");
g_assert_cmpstr (region->width, ==, "0.15");
......@@ -484,8 +483,7 @@ test_xmp_regions_ns_prefix (void)
g_assert_cmpint (2, ==, g_slist_length (data->regions));
/* Regions are stacked while parsing.*/
region = g_slist_nth_data (data->regions, 0);
region = g_slist_nth_data (data->regions, 1);
g_assert_cmpstr (region->x, ==, "0.51");
g_assert_cmpstr (region->y, ==, "0.51");
g_assert_cmpstr (region->width, ==, "0.01");
......@@ -494,7 +492,7 @@ test_xmp_regions_ns_prefix (void)
g_assert_cmpstr (region->title, ==, "Fidoz");
g_assert_cmpstr (region->description, ==, "Fido looks happy!");
region = g_slist_nth_data (data->regions, 1);
region = g_slist_nth_data (data->regions, 0);
g_assert_cmpstr (region->x, ==, "0.5");
g_assert_cmpstr (region->y, ==, "0.5");
g_assert_cmpstr (region->width, ==, "0.06");
......@@ -507,6 +505,40 @@ test_xmp_regions_ns_prefix (void)
tracker_xmp_free (data);
}
void
test_xmp_regions_nb282393 ()
{
TrackerXmpData *data;
TrackerXmpRegion *region;
GFile *f;
gchar *contents;
gsize size;
gchar *filepath;
filepath = g_build_filename (TOP_SRCDIR, "tests", "libtracker-extract", "nb282393.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.433333");
g_assert_cmpstr (region->y, ==, "0.370000");
g_assert_cmpstr (region->width, ==, "0.586667");
g_assert_cmpstr (region->height, ==, "0.440000");
g_assert_cmpstr (region->title, ==, " ");
//debug_print_sparql (data);
tracker_xmp_free (data);
}
int
main (int argc,
char **argv)
......@@ -539,8 +571,12 @@ main (int argc,
g_test_add_func ("/libtracker-extract/tracker-xmp/xmp_regions_2",
test_xmp_regions_quill);
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_ns_prefix",
test_xmp_regions_ns_prefix);
#endif
g_test_add_func ("/libtracker-extract/tracker-xmp/sparql_translation_location",
test_xmp_apply_location);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment