Commit 578fcd7d authored by Ivan Frade's avatar Ivan Frade

tests/libtracker-extract: Yet another test for the Regions of interest

parent b025c0aa
......@@ -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
<?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>
......@@ -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);
......
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