summaryrefslogtreecommitdiff
path: root/tests/libtracker-extract
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libtracker-extract')
-rw-r--r--tests/libtracker-extract/.gitignore8
-rw-r--r--tests/libtracker-extract/Makefile.am70
-rw-r--r--tests/libtracker-extract/areas-ns.xmp32
-rw-r--r--tests/libtracker-extract/areas-with-contacts.xmp53
-rw-r--r--tests/libtracker-extract/areas.xmp31
-rw-r--r--tests/libtracker-extract/encoding-detect.bin1
-rw-r--r--tests/libtracker-extract/exif-free-img.jpgbin839 -> 0 bytes
-rw-r--r--tests/libtracker-extract/exif-img.jpgbin1637 -> 0 bytes
-rw-r--r--tests/libtracker-extract/getline-test.txt3
-rw-r--r--tests/libtracker-extract/guarantee-mtime-test.txt1
-rw-r--r--tests/libtracker-extract/iptc-img.jpgbin3782 -> 0 bytes
-rw-r--r--tests/libtracker-extract/meson.build59
-rw-r--r--tests/libtracker-extract/nb282393.xmp105
-rw-r--r--tests/libtracker-extract/nb282393_simple.xmp37
-rw-r--r--tests/libtracker-extract/tracker-encoding-test.c76
-rw-r--r--tests/libtracker-extract/tracker-exif-test.c96
-rw-r--r--tests/libtracker-extract/tracker-extract-info-test.c73
-rw-r--r--tests/libtracker-extract/tracker-guarantee-test.c164
-rw-r--r--tests/libtracker-extract/tracker-iptc-test.c161
-rw-r--r--tests/libtracker-extract/tracker-test-utils.c305
-rw-r--r--tests/libtracker-extract/tracker-test-xmp.c588
21 files changed, 0 insertions, 1863 deletions
diff --git a/tests/libtracker-extract/.gitignore b/tests/libtracker-extract/.gitignore
deleted file mode 100644
index d3fbec9bc..000000000
--- a/tests/libtracker-extract/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-tracker-encoding
-tracker-test-utils
-tracker-test-xmp
-tracker-exif-test
-tracker-extract-info-test
-tracker-guarantee-test
-tracker-iptc-test
-
diff --git a/tests/libtracker-extract/Makefile.am b/tests/libtracker-extract/Makefile.am
deleted file mode 100644
index 932531f26..000000000
--- a/tests/libtracker-extract/Makefile.am
+++ /dev/null
@@ -1,70 +0,0 @@
-include $(top_srcdir)/Makefile.decl
-
-noinst_PROGRAMS += $(test_programs)
-
-test_programs = \
- tracker-test-utils \
- tracker-test-xmp \
- tracker-extract-info-test \
- tracker-guarantee-test
-
-if HAVE_EXIF
-test_programs += tracker-exif-test
-endif
-
-if HAVE_IPTC
-if HAVE_LIBJPEG
-test_programs += tracker-iptc-test
-endif
-endif
-
-if HAVE_ENCA
-test_programs += tracker-encoding
-endif
-
-AM_CPPFLAGS = \
- -DTOP_SRCDIR=\"$(abs_top_srcdir)\" \
- -DTOP_BUILDDIR=\"$(abs_top_builddir)\" \
- $(BUILD_CFLAGS) \
- -I$(top_srcdir)/src \
- -I$(top_builddir)/src \
- -I$(top_srcdir)/tests/common \
- $(LIBTRACKER_EXTRACT_CFLAGS)
-
-LDADD = \
- $(top_builddir)/tests/common/libtracker-testcommon.la \
- $(top_builddir)/src/libtracker-common/libtracker-common.la \
- $(top_builddir)/src/libtracker-extract/libtracker-extract.la \
- $(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql-@TRACKER_API_VERSION@.la \
- $(BUILD_LIBS) \
- $(LIBTRACKER_EXTRACT_LIBS)
-
-tracker_encoding_SOURCES = tracker-encoding-test.c
-
-tracker_test_utils_SOURCES = tracker-test-utils.c
-
-tracker_test_xmp_SOURCES = tracker-test-xmp.c
-
-tracker_extract_info_test_SOURCES = tracker-extract-info-test.c
-
-tracker_exif_test_SOURCES = tracker-exif-test.c
-
-tracker_guarantee_test_SOURCES = tracker-guarantee-test.c
-
-tracker_iptc_test_SOURCES = tracker-iptc-test.c
-tracker_iptc_test_LDADD = $(LDADD) $(LIBJPEG_LIBS)
-tracker_iptc_test_CFLAGS = $(LIBJPEG_CFLAGS)
-
-EXTRA_DIST += \
- encoding-detect.bin \
- areas.xmp \
- areas-with-contacts.xmp \
- areas-ns.xmp \
- nb282393.xmp \
- nb282393_simple.xmp \
- exif-img.jpg \
- exif-free-img.jpg \
- guarantee-mtime-test.txt \
- getline-test.txt \
- iptc-img.jpg \
- meson.build
diff --git a/tests/libtracker-extract/areas-ns.xmp b/tests/libtracker-extract/areas-ns.xmp
deleted file mode 100644
index d558ee599..000000000
--- a/tests/libtracker-extract/areas-ns.xmp
+++ /dev/null
@@ -1,32 +0,0 @@
-<!-- Same XMP with areas but using a different namespace prefix -->
-<x:xmpmeta
- 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/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="">
- <my-ns:Regions rdf:parseType="Resource">
- <my-ns:AppliedToDimensions my-dym:w="4288" my-dym:h="2848" my-dym:unit="pixel"/>
- <my-ns:RegionList>
- <rdf:Bag>
- <rdf:li rdf:parseType="Resource">
- <my-ns:Area my-area:x="0.5" my-area:y="0.5" my-area:w="0.06"
- my-area:h="0.09" my-area:unit="normalized"/>
- <my-ns:Type>Face</my-ns:Type>
- <my-ns:Name>Average Joe</my-ns:Name>
- </rdf:li>
- <rdf:li rdf:parseType="Resource">
- <my-ns:Area my-area:x="0.51" my-area:y="0.51" my-area:w="0.01"
- my-area:h="0.09" my-area:unit="normalized"/>
- <my-ns:Type>Pet</my-ns:Type>
- <my-ns:Name>Fidoz</my-ns:Name>
- <my-ns:Description>Fido looks happy!</my-ns:Description>
- </rdf:li>
- </rdf:Bag>
- </my-ns:RegionList>
- </my-ns:Regions>
- </rdf:Description>
- </rdf:RDF>
-</x:xmpmeta>
diff --git a/tests/libtracker-extract/areas-with-contacts.xmp b/tests/libtracker-extract/areas-with-contacts.xmp
deleted file mode 100644
index ca707702b..000000000
--- a/tests/libtracker-extract/areas-with-contacts.xmp
+++ /dev/null
@@ -1,53 +0,0 @@
-<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 8.60'>
-<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
- <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/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/'>
- <mwg-rs:Regions rdf:parseType='Resource'>
- <mwg-rs:AppliedToDimensions rdf:parseType='Resource'>
- <stDim:h>2848</stDim:h>
- <stDim:unit>pixel</stDim:unit>
- <stDim:w>4288</stDim:w>
- </mwg-rs:AppliedToDimensions>
- <mwg-rs:RegionList>
- <rdf:Bag>
- <rdf:li rdf:parseType='Resource'>
- <mwg-rs:Area rdf:parseType='Resource'>
- <stArea:h>0.17</stArea:h>
- <stArea:unit>normalized</stArea:unit>
- <stArea:w>0.15</stArea:w>
- <stArea:x>0.3</stArea:x>
- <stArea:y>0.4</stArea:y>
- </mwg-rs:Area>
- <mwg-rs:Extensions rdf:parseType='Resource'>
- <nco:PersonContact>urn:uuid:1</nco:PersonContact>
- </mwg-rs:Extensions>
- <mwg-rs:Name>Albert Einstein</mwg-rs:Name>
- <mwg-rs:Type>Face</mwg-rs:Type>
- <rdfs:seeAlso rdf:resource='dc:subject'/>
- </rdf:li>
- <rdf:li rdf:parseType='Resource'>
- <mwg-rs:Area rdf:parseType='Resource'>
- <stArea:h>0.15</stArea:h>
- <stArea:unit>normalized</stArea:unit>
- <stArea:w>0.17</stArea:w>
- <stArea:x>0.4</stArea:x>
- <stArea:y>0.3</stArea:y>
- </mwg-rs:Area>
- <mwg-rs:Extensions rdf:parseType='Resource'>
- <nco:PersonContact>urn:uuid:2</nco:PersonContact>
- </mwg-rs:Extensions>
- <mwg-rs:Name>Dilbert</mwg-rs:Name>
- <mwg-rs:Type>Face</mwg-rs:Type>
- <rdfs:seeAlso rdf:resource='dc:subject'/>
- </rdf:li>
- </rdf:Bag>
- </mwg-rs:RegionList>
- </mwg-rs:Regions>
- </rdf:Description>
-</rdf:RDF>
-</x:xmpmeta>
diff --git a/tests/libtracker-extract/areas.xmp b/tests/libtracker-extract/areas.xmp
deleted file mode 100644
index e6a996c02..000000000
--- a/tests/libtracker-extract/areas.xmp
+++ /dev/null
@@ -1,31 +0,0 @@
-<x:xmpmeta
- 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/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="">
- <mwg-rs:Regions rdf:parseType="Resource">
- <mwg-rs:AppliedToDimensions stDim:w="4288" stDim:h="2848" stDim:unit="pixel"/>
- <mwg-rs:RegionList>
- <rdf:Bag>
- <rdf:li rdf:parseType="Resource">
- <mwg-rs:Area stArea:x="0.5" stArea:y="0.5" stArea:w="0.06"
- stArea:h="0.09" stArea:unit="normalized"/>
- <mwg-rs:Type>Face</mwg-rs:Type>
- <mwg-rs:Name>John Doe</mwg-rs:Name>
- </rdf:li>
- <rdf:li rdf:parseType="Resource">
- <mwg-rs:Area stArea:x="0.51" stArea:y="0.51" stArea:w="0.01"
- stArea:h="0.09" stArea:unit="normalized"/>
- <mwg-rs:Type>Pet</mwg-rs:Type>
- <mwg-rs:Name>Fido</mwg-rs:Name>
- <mwg-rs:Description>Fido looks happy!</mwg-rs:Description>
- </rdf:li>
- </rdf:Bag>
- </mwg-rs:RegionList>
- </mwg-rs:Regions>
- </rdf:Description>
- </rdf:RDF>
-</x:xmpmeta>
diff --git a/tests/libtracker-extract/encoding-detect.bin b/tests/libtracker-extract/encoding-detect.bin
deleted file mode 100644
index 530d5a381..000000000
--- a/tests/libtracker-extract/encoding-detect.bin
+++ /dev/null
@@ -1 +0,0 @@
-ÊîñìîíàâòRadiotrance (Ðàäèîòðàíñ)Ê Çâ¸çäàì \ No newline at end of file
diff --git a/tests/libtracker-extract/exif-free-img.jpg b/tests/libtracker-extract/exif-free-img.jpg
deleted file mode 100644
index 6ac4a4565..000000000
--- a/tests/libtracker-extract/exif-free-img.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/libtracker-extract/exif-img.jpg b/tests/libtracker-extract/exif-img.jpg
deleted file mode 100644
index 2a3c7cc31..000000000
--- a/tests/libtracker-extract/exif-img.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/libtracker-extract/getline-test.txt b/tests/libtracker-extract/getline-test.txt
deleted file mode 100644
index 62d617f65..000000000
--- a/tests/libtracker-extract/getline-test.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Line 1
-line 2
-line 3
diff --git a/tests/libtracker-extract/guarantee-mtime-test.txt b/tests/libtracker-extract/guarantee-mtime-test.txt
deleted file mode 100644
index 587be6b4c..000000000
--- a/tests/libtracker-extract/guarantee-mtime-test.txt
+++ /dev/null
@@ -1 +0,0 @@
-x
diff --git a/tests/libtracker-extract/iptc-img.jpg b/tests/libtracker-extract/iptc-img.jpg
deleted file mode 100644
index d40001062..000000000
--- a/tests/libtracker-extract/iptc-img.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/libtracker-extract/meson.build b/tests/libtracker-extract/meson.build
deleted file mode 100644
index 6859510c5..000000000
--- a/tests/libtracker-extract/meson.build
+++ /dev/null
@@ -1,59 +0,0 @@
-test_c_args = tracker_c_args + [
- '-DTOP_BUILDDIR="@0@/"'.format(meson.build_root()),
- '-DTOP_SRCDIR="@0@/"'.format(meson.source_root()),
-]
-
-guarantee_test = executable('tracker-guarantee-test',
- 'tracker-guarantee-test.c',
- dependencies: [tracker_common_dep, tracker_extract_dep],
- c_args: test_c_args,
-)
-test('extract-guarantee', guarantee_test)
-
-extract_info_test = executable('tracker-extract-info-test',
- 'tracker-extract-info-test.c',
- dependencies: [tracker_common_dep, tracker_extract_dep],
- c_args: test_c_args,
-)
-test('extract-info-test', extract_info_test)
-
-utils_test = executable('tracker-test-utils',
- 'tracker-test-utils.c',
- dependencies: [tracker_common_dep, tracker_extract_dep],
- c_args: test_c_args,
-)
-test('extract-utils', utils_test)
-
-xmp_test = executable('tracker-test-xmp',
- 'tracker-test-xmp.c',
- dependencies: [tracker_common_dep, tracker_extract_dep],
- c_args: test_c_args,
-)
-test('extract-xmp', xmp_test)
-
-if libexif.found()
- exif_test = executable('tracker-exif-test',
- 'tracker-exif-test.c',
- dependencies: [tracker_common_dep, tracker_extract_dep],
- c_args: test_c_args,
- )
- test('extract-exif', exif_test)
-endif
-
-if libiptcdata.found() and libjpeg.found()
- iptc_test = executable('tracker-iptc-test',
- 'tracker-iptc-test.c',
- dependencies: [tracker_common_dep, tracker_extract_dep, libjpeg],
- c_args: test_c_args,
- )
- test('extract-iptc', iptc_test)
-endif
-
-if charset_library_name != 'none'
- encoding_test = executable('tracker-encoding-test',
- 'tracker-encoding-test.c',
- dependencies: [tracker_common_dep, tracker_extract_dep],
- c_args: test_c_args,
- )
- test('extract-encoding', encoding_test)
-endif
diff --git a/tests/libtracker-extract/nb282393.xmp b/tests/libtracker-extract/nb282393.xmp
deleted file mode 100644
index bd006f1c8..000000000
--- a/tests/libtracker-extract/nb282393.xmp
+++ /dev/null
@@ -1,105 +0,0 @@
-<?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>
diff --git a/tests/libtracker-extract/nb282393_simple.xmp b/tests/libtracker-extract/nb282393_simple.xmp
deleted file mode 100644
index 9309a1813..000000000
--- a/tests/libtracker-extract/nb282393_simple.xmp
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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-encoding-test.c b/tests/libtracker-extract/tracker-encoding-test.c
deleted file mode 100644
index cd1408890..000000000
--- a/tests/libtracker-extract/tracker-encoding-test.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-
-#include <glib-object.h>
-#include <libtracker-extract/tracker-encoding.h>
-#include <libtracker-common/tracker-locale.h>
-#include <locale.h>
-
-static void
-test_encoding_guessing ()
-{
- gchar *output;
- GMappedFile *file = NULL;
- gchar *prefix, *filen;
-
- prefix = g_build_path (G_DIR_SEPARATOR_S, TOP_SRCDIR, "tests", "libtracker-extract", NULL);
- filen = g_build_filename (prefix, "encoding-detect.bin", NULL);
-
- file = g_mapped_file_new (filen, FALSE, NULL);
-
- output = tracker_encoding_guess (g_mapped_file_get_contents (file),
- g_mapped_file_get_length (file),
- NULL);
-
- g_assert_cmpstr (output, ==, "UTF-8");
-
- g_mapped_file_unref (file);
-
- g_free (prefix);
- g_free (filen);
- g_free (output);
-}
-
-static void
-test_encoding_can_guess (void)
-{
- /* This just duplicates the function code... */
-#if defined (HAVE_ENCA) || defined (HAVE_LIBICU_CHARSET_DETECTION)
- g_assert (tracker_encoding_can_guess ());
-#else
- g_assert (!tracker_encoding_can_guess ());
-#endif
-}
-
-int
-main (int argc, char **argv)
-{
- g_test_init (&argc, &argv, NULL);
-
- setlocale (LC_ALL, "");
- g_test_add_func ("/libtracker-extract/tracker-encoding/encoding_guessing",
- test_encoding_guessing);
- g_test_add_func ("/libtracker-extract/tracker-encoding/can_guess",
- test_encoding_can_guess);
-
- return g_test_run ();
-}
diff --git a/tests/libtracker-extract/tracker-exif-test.c b/tests/libtracker-extract/tracker-exif-test.c
deleted file mode 100644
index b56c01176..000000000
--- a/tests/libtracker-extract/tracker-exif-test.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2011, Nokia <ivan.frade@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <glib-object.h>
-
-#include <libtracker-extract/tracker-extract.h>
-
-static void
-test_exif_parse (void)
-{
- TrackerExifData *exif;
- gchar *blob;
- gsize length;
-
-
- g_assert (g_file_get_contents (TOP_SRCDIR "/tests/libtracker-extract/exif-img.jpg", &blob, &length, NULL));
-
- exif = tracker_exif_new ((guchar *)blob, length, "test://file");
-
- /* Ignored on purpose on the code (?) */
- //g_assert_cmpstr (exif->x_dimension, ==, );
- //g_assert_cmpstr (exif->y_dimenstion, ==, );
- //g_assert_cmpstr (exif->image_width, ==, );
-
- g_assert_cmpstr (exif->document_name, ==, "test-documentname");
- //g_assert_cmpstr (exif->time, ==, "test-documentname");
- g_assert (exif->time_original);
- g_assert_cmpstr (exif->artist, ==, "EXIFspec"); // -Exif:Artist
- g_assert_cmpstr (exif->user_comment, ==, "libexif demonstration image");
- g_assert_cmpstr (exif->description, ==, "Justfortest"); //-Exif:ImageDescription
- g_assert_cmpstr (exif->make, ==, "Nikon"); //-Exif:Make
- g_assert_cmpstr (exif->model, ==, "SD3000"); //-Exif:Model
- g_assert_cmpstr (exif->orientation, ==, "nfo:orientation-left-mirror"); //-n -Exif:Orientation=5
- g_assert_cmpstr (exif->exposure_time, ==, "0.002"); // -Exif:ExposureTime=1/500
- g_assert_cmpstr (exif->fnumber, ==, "5.6"); // -Exif:FNumber
- g_assert_cmpstr (exif->flash, ==, "nmm:flash-off"); // -n -Exif:Flash=88
- g_assert_cmpstr (exif->focal_length, ==, "35.0"); // -n -Exif:FocalLength=35
- g_assert_cmpstr (exif->iso_speed_ratings, ==, "400"); // -n -Exif:ISO=400
- g_assert_cmpstr (exif->metering_mode, ==, "nmm:metering-mode-multispot"); // -n -Exif:MeteringMode=4
- g_assert_cmpstr (exif->white_balance, ==, "nmm:white-balance-auto"); // -n -Exif:WhiteBalance=0
- g_assert_cmpstr (exif->copyright, ==, "From the exif demo with exiftool metadata"); // -Exif:Copyright
- g_assert_cmpstr (exif->software, ==, "bunchof1s"); // -Exif:Software
- g_assert_cmpstr (exif->x_resolution, ==, "72");
- g_assert_cmpstr (exif->y_resolution, ==, "72");
- g_assert_cmpint (exif->resolution_unit, ==, 2);
-
- g_assert_cmpstr (exif->gps_altitude, ==, "237.000000"); // -n -exif:gpsaltitude=237
- g_assert_cmpstr (exif->gps_latitude, ==, "-42.500000"); // -exif:gpslatitude="42 30 0.00" -exif:gpslatituderef=S
- g_assert_cmpstr (exif->gps_longitude, ==, "-10.166675"); // -exif:gpslongitude="10 10 0.03" -exif:gpslongituderef=W
- g_assert_cmpstr (exif->gps_direction, ==, "12.3"); // -n -Exif:GPSImgDirection=12.3
-
- tracker_exif_free (exif);
-}
-
-static void
-test_exif_parse_empty (void)
-{
- TrackerExifData *exif;
- gchar *blob;
- gsize length;
-
- g_assert (g_file_get_contents (TOP_SRCDIR "/tests/libtracker-extract/exif-free-img.jpg", &blob, &length, NULL));
-
- exif = tracker_exif_new ((guchar *)blob, length, "test://file");
-
- tracker_exif_free (exif);
-}
-
-int
-main (int argc, char **argv)
-{
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/libtracker-extract/exif/parse",
- test_exif_parse);
- g_test_add_func ("/libtracker-extract/exif/parse_empty",
- test_exif_parse_empty);
-
- return g_test_run ();
-}
diff --git a/tests/libtracker-extract/tracker-extract-info-test.c b/tests/libtracker-extract/tracker-extract-info-test.c
deleted file mode 100644
index d189d44c3..000000000
--- a/tests/libtracker-extract/tracker-extract-info-test.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2011, Nokia <ivan.frade@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <glib.h>
-
-#include <libtracker-extract/tracker-extract.h>
-
-static void
-test_extract_info_setters (void)
-{
- TrackerExtractInfo *info, *info_ref;
- GFile *file;
-
- file = g_file_new_for_path ("./imaginary-file-2");
-
- info = tracker_extract_info_new (file, "imaginary/mime");
- info_ref = tracker_extract_info_ref (info);
-
- g_assert (g_file_equal (file, tracker_extract_info_get_file (info)));
-
- g_assert_cmpstr (tracker_extract_info_get_mimetype (info), ==, "imaginary/mime");
-
- tracker_extract_info_unref (info_ref);
- tracker_extract_info_unref (info);
-
- g_object_unref (file);
-}
-
-static void
-test_extract_info_empty_objects (void)
-{
- TrackerExtractInfo *info, *info_ref;
- GFile *file;
-
- file = g_file_new_for_path ("./imaginary-file");
-
- info = tracker_extract_info_new (file, "imaginary/mime");
- info_ref = tracker_extract_info_ref (info);
-
- tracker_extract_info_unref (info_ref);
- tracker_extract_info_unref (info);
-
- g_object_unref (file);
-}
-
-int
-main (int argc, char **argv)
-{
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/libtracker-extract/extract-info/empty_objects",
- test_extract_info_empty_objects);
- g_test_add_func ("/libtracker-extract/extract-info/setters",
- test_extract_info_setters);
-
- return g_test_run ();
-}
diff --git a/tests/libtracker-extract/tracker-guarantee-test.c b/tests/libtracker-extract/tracker-guarantee-test.c
deleted file mode 100644
index b296d39de..000000000
--- a/tests/libtracker-extract/tracker-guarantee-test.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (C) 2011, Nokia <ivan.frade@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "config.h"
-
-#include <locale.h>
-
-#include <glib.h>
-
-#include <libtracker-sparql/tracker-sparql.h>
-#include <libtracker-extract/tracker-guarantee.h>
-
-typedef struct {
- const gchar *test_name;
- gchar *uri;
- const gchar *extracted;
- const gchar *expected;
- TrackerResource *resource;
-} TestInfo;
-
-TestInfo title_tests [] = {
- { "normal-extraction", "file:///a/b/a_video_with_metadata.avi", "extracted title", "extracted title" },
- { "empty-extraction", "file:///a/b/a_video_with_no_metadata.avi", NULL, "a video with no metadata" },
- { "underscore-separators", "file:///a/b/a_video_with_no_metadata.avi", "", "a video with no metadata" },
- { "dot-separators", "file:///a/b/a.video.with.no.metadata.avi", NULL, "a.video.with.no.metadata" },
- { "no-extension", "file:///a/b/a video without extension", NULL, "a video without extension" },
- { "hidden-files", "file:///a/b/.hidden_file", NULL, "hidden file" },
-
- { NULL, NULL, NULL }
-};
-
-TestInfo date_tests [] = {
- { "date-normal", "file:///does/not/matter/here", NULL, "2011-10-10T12:13:14Z0300" },
- { "date-is-null", NULL, NULL, NULL },
- { "date-is-empty-string", NULL, NULL, NULL },
- { NULL, NULL, NULL }
-};
-
-static void
-test_title (TestInfo *info,
- gconstpointer context)
-{
-#ifdef GUARANTEE_METADATA
- gchar *title_guaranteed;
- gboolean title_retrieved;
-
- title_retrieved = tracker_guarantee_resource_title_from_file (info->resource, "nie:title", info->extracted, info->uri, &title_guaranteed);
- g_assert_true (title_retrieved);
-
- g_assert_cmpstr (tracker_resource_get_first_string (info->resource, "nie:title"), ==, info->expected);
- g_assert_cmpstr (title_guaranteed, ==, info->expected);
-
- g_free (title_guaranteed);
-#else /* GUARANTEE_METADATA */
- g_test_skip ("Not built with --enable-guarantee-metadata");
-#endif /* GUARANTEE_METADATA */
-}
-
-static void
-test_date (TestInfo *info,
- gconstpointer context)
-{
-#ifdef GUARANTEE_METADATA
- gboolean date_retrieved;
-
- date_retrieved = tracker_guarantee_resource_date_from_file_mtime (info->resource, "test:mtime", info->extracted, info->uri);
- g_assert_true (date_retrieved);
-
- /* mtime can change in the file so we just check that the property is in the output */
- g_assert_nonnull (tracker_resource_get_first_string (info->resource, "test:mtime"));
-#else /* GUARANTEE_METADATA */
- g_test_skip ("Not built with --enable-guarantee-metadata");
-#endif /* GUARANTEE_METADATA */
-}
-
-static void
-setup (TestInfo *info,
- gint i)
-{
- info->resource = tracker_resource_new (NULL);
- g_assert_nonnull (info->resource);
-
- if (strstr (info->test_name, "date")) {
- GFile *f;
-
- f = g_file_new_for_path (TOP_SRCDIR "/tests/libtracker-extract/guarantee-mtime-test.txt");
- info->uri = g_file_get_uri (f);
- g_object_unref (f);
- }
-}
-
-static void
-setup_title (TestInfo *info,
- gconstpointer context)
-{
- gint i = GPOINTER_TO_INT (context);
-
- *info = title_tests[i];
- setup (info, i);
-}
-
-static void
-setup_date (TestInfo *info,
- gconstpointer context)
-{
- gint i = GPOINTER_TO_INT (context);
-
- *info = date_tests[i];
- setup (info, i);
-}
-
-static void
-teardown (TestInfo *info,
- gconstpointer context)
-{
- if (strstr (info->test_name, "date")) {
- g_free (info->uri);
- }
-
- g_object_unref (info->resource);
-}
-
-int
-main (int argc, char** argv)
-{
- gint i;
-
- setlocale (LC_COLLATE, "en_US.utf8");
-
- g_test_init (&argc, &argv, NULL);
-
- for (i = 0; title_tests[i].test_name != NULL; i++) {
- gchar *testpath;
-
- testpath = g_strdup_printf ("/libtracker-extract/guarantee/title/%s", title_tests[i].test_name);
- g_test_add (testpath, TestInfo, GINT_TO_POINTER(i), setup_title, test_title, teardown);
- g_free (testpath);
- }
-
- for (i = 0; date_tests[i].test_name != NULL; i++) {
- gchar *testpath;
-
- testpath = g_strdup_printf ("/libtracker-extract/guarantee/date/%s", date_tests[i].test_name);
- g_test_add (testpath, TestInfo, GINT_TO_POINTER(i), setup_date, test_date, teardown);
- g_free (testpath);
- }
-
- return g_test_run ();
-}
diff --git a/tests/libtracker-extract/tracker-iptc-test.c b/tests/libtracker-extract/tracker-iptc-test.c
deleted file mode 100644
index 2306c08fd..000000000
--- a/tests/libtracker-extract/tracker-iptc-test.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2011, Nokia <ivan.frade@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <setjmp.h>
-
-#include <jpeglib.h>
-
-#include <glib.h>
-#include <gio/gio.h>
-#include <libtracker-extract/tracker-iptc.h>
-
-#define PS3_NAMESPACE "Photoshop 3.0\0"
-#define PS3_NAMESPACE_LENGTH 14
-#include <libiptcdata/iptc-jpeg.h>
-
-struct tej_error_mgr {
- struct jpeg_error_mgr jpeg;
- jmp_buf setjmp_buffer;
-};
-
-
-static void
-extract_jpeg_error_exit (j_common_ptr cinfo)
-{
- struct tej_error_mgr *h = (struct tej_error_mgr *) cinfo->err;
- (*cinfo->err->output_message)(cinfo);
- longjmp (h->setjmp_buffer, 1);
-}
-
-/*
- * libiptcdata doesn't scan the file until find the IPTC blob.
- * We need to find the blob ourselves. This code comes from tracker-extract-jpeg
- */
-static TrackerIptcData *
-load_iptc_blob (const gchar *filename)
-{
- struct jpeg_decompress_struct cinfo;
- struct tej_error_mgr tejerr;
- struct jpeg_marker_struct *marker;
- TrackerIptcData *id = NULL;
- FILE *f;
- gchar *uri;
- GFile *file;
-
- file = g_file_new_for_path (filename);
- uri = g_file_get_uri (file);
- g_object_unref (file);
-
- f = fopen (filename, "r");
-
- cinfo.err = jpeg_std_error (&tejerr.jpeg);
- tejerr.jpeg.error_exit = extract_jpeg_error_exit;
- if (setjmp (tejerr.setjmp_buffer)) {
- fclose (f);
- g_free (uri);
- return NULL;
- }
-
- jpeg_create_decompress (&cinfo);
-
- jpeg_save_markers (&cinfo, JPEG_COM, 0xFFFF);
- jpeg_save_markers (&cinfo, JPEG_APP0 + 1, 0xFFFF);
- jpeg_save_markers (&cinfo, JPEG_APP0 + 13, 0xFFFF);
-
- jpeg_stdio_src (&cinfo, f);
-
- jpeg_read_header (&cinfo, TRUE);
-
- marker = (struct jpeg_marker_struct *) &cinfo.marker_list;
-
- while (marker) {
- gchar *str;
- gsize len;
- gint offset;
- guint sublen;
-
- switch (marker->marker) {
- case JPEG_COM:
- break;
-
- case JPEG_APP0 + 1:
- break;
-
- case JPEG_APP0 + 13:
- str = (gchar*) marker->data;
- len = marker->data_length;
- if (len > 0 && strncmp (PS3_NAMESPACE, str, PS3_NAMESPACE_LENGTH) == 0) {
- offset = iptc_jpeg_ps3_find_iptc ((guchar *)str, len, &sublen);
- if (offset > 0 && sublen > 0) {
- id = tracker_iptc_new ((const guchar *)str + offset, sublen, uri);
- }
- }
- break;
-
- default:
- marker = marker->next;
- continue;
- }
-
- marker = marker->next;
- }
-
- g_free (uri);
- fclose (f);
-
- return id;
-}
-
-static void
-test_iptc_extraction (void)
-{
- TrackerIptcData *data;
-
- data = load_iptc_blob (TOP_SRCDIR "/tests/libtracker-extract/iptc-img.jpg");
- g_assert (data);
-
- g_assert_cmpstr (data->keywords, ==, "Coverage, test");
- g_assert (g_str_has_prefix (data->date_created, "2011-10-22"));
- g_assert_cmpstr (data->byline, ==, "BylineValue");
- g_assert_cmpstr (data->byline_title, ==, "BylineTitleValue");
- g_assert_cmpstr (data->credit, ==, "CreditValue");
- g_assert_cmpstr (data->copyright_notice, ==, "IptcToolAuthors");
- g_assert_cmpstr (data->image_orientation, ==, "nfo:orientation-left");
- g_assert_cmpstr (data->city, ==, "Helsinki");
- g_assert_cmpstr (data->state, ==, "N/A");
- g_assert_cmpstr (data->sublocation, ==, "Ruoholahti");
- g_assert_cmpstr (data->country_name, ==, "Finland");
- g_assert_cmpstr (data->contact, ==, "Dilbert");
-
- tracker_iptc_free (data);
-}
-
-int
-main (int argc, char **argv)
-{
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/libtracker-extract/iptc/extraction",
- test_iptc_extraction);
- return g_test_run ();
-}
diff --git a/tests/libtracker-extract/tracker-test-utils.c b/tests/libtracker-extract/tracker-test-utils.c
deleted file mode 100644
index 33cd685d8..000000000
--- a/tests/libtracker-extract/tracker-test-utils.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Copyright (C) 2009, Nokia <ivan.frade@nokia.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Authors: Philip Van Hoof <philip@codeminded.be>
- */
-
-#include "config.h"
-
-#include <time.h>
-#include <string.h>
-
-#include <glib-object.h>
-
-#include <libtracker-extract/tracker-extract.h>
-
-static void
-test_guess_date_failures_subprocess ()
-{
- gchar *result;
-
- result = tracker_date_guess (NULL);
- g_free (result);
-}
-
-static void
-test_guess_date_failures ()
-{
- g_test_trap_subprocess ("/libtracker-extract/tracker-utils/guess_date_failures/subprocess", 0, G_TEST_SUBPROCESS_INHERIT_STDERR);
- g_test_trap_assert_passed ();
-
- /* Should be NO output when using NULL with tracker_date_guess() */
-}
-
-static void
-test_guess_date (void)
-{
- gchar *result;
-
- result = tracker_date_guess ("");
- g_assert (result == NULL);
-
- result = tracker_date_guess ("2008-06-14");
- g_assert_cmpstr (result, ==, "2008-06-14T00:00:00");
- g_free (result);
-
- result = tracker_date_guess ("20080614000000");
- g_assert_cmpstr (result, ==, "2008-06-14T00:00:00");
- g_free (result);
-
- result = tracker_date_guess ("20080614000000Z");
- g_assert_cmpstr (result, ==, "2008-06-14T00:00:00Z");
- g_free (result);
-
- result = tracker_date_guess ("Mon Jun 14 04:20:20 2008"); /* MS Office */
- g_assert_cmpstr (result, ==, "2008-06-14T04:20:20");
- g_free (result);
-
- result = tracker_date_guess ("2008:06:14 04:20:20"); /* Exif style */
- g_assert_cmpstr (result, ==, "2008-06-14T04:20:20");
- g_free (result);
-
- result = tracker_date_guess ("2010");
- g_assert_cmpstr (result, ==, "2010-01-01T00:00:00Z");
- g_free (result);
-
- result = tracker_date_guess ("201a");
- g_assert (!result);
-
- result = tracker_date_guess ("A2010");
- g_assert (!result);
-
- /* Guessing from the code */
- result = tracker_date_guess ("20100318010203-00:03Z");
- g_assert_cmpstr (result, ==, "2010-03-18T01:02:03-00:03");
- g_free (result);
-
- result = tracker_date_guess ("20100318010203+00:03Z");
- g_assert_cmpstr (result, ==, "2010-03-18T01:02:03+00:03");
- g_free (result);
-
- /* "YYYY-MM-DDThh:mm:ss.ff+zz:zz" */
- result = tracker_date_guess ("2010-03-18T01:02:03.10-00:03");
- g_assert_cmpstr (result, ==, "2010-03-18T01:02:03.10-00:03");
- g_free (result);
-
- result = tracker_date_guess ("2010-03-18T01:02:03.100");
- g_assert_cmpstr (result, ==, "2010-03-18T01:02:03.100");
- g_free (result);
-}
-
-static void
-test_text_validate_utf8 ()
-{
- GString *s = NULL;
- gsize utf8_len = 0;
- gint i;
- gboolean result;
- const gchar *valid_utf8[] = {
- "GNU's not Unix",
- "abcdefghijklmnopqrstuvwxyz0123456789?!,.-_",
- "\xF0\x90\x80\x80",
- "\x41" "\xCE\xA9" "\xE8\xAA\x9E" "\xF0\x90\x8E\x84",
- NULL
- };
-
- /* If text is empty, FALSE should be returned */
- result = tracker_text_validate_utf8 ("", 0, NULL, NULL);
- g_assert_cmpuint (result, ==, 0);
-
- /* If a fully valid UTF-8 string is given as input, output
- * length should be equal to the input length, and the
- * output GString should contain exactly the same contents
- * as the input */
- for (i = 0; valid_utf8[i] != NULL; i++) {
- s = NULL;
- utf8_len = 0;
- result = tracker_text_validate_utf8 (valid_utf8[i],
- strlen (valid_utf8[i]),
- &s,
- &utf8_len);
- g_assert_cmpuint (result, ==, 1);
- g_assert_cmpuint (utf8_len, ==, strlen (valid_utf8[i]));
- g_assert (s);
- g_assert_cmpuint (s->len, ==, strlen (valid_utf8[i]));
- g_assert_cmpstr (s->str, ==, valid_utf8[i]);
- g_string_free (s, TRUE);
- }
-
- /* Same as previous, passing -1 as input text length */
- for (i = 0; valid_utf8[i] != NULL; i++) {
- s = NULL;
- utf8_len = 0;
- result = tracker_text_validate_utf8 (valid_utf8[i],
- -1,
- &s,
- &utf8_len);
- g_assert_cmpuint (result, ==, 1);
- g_assert_cmpuint (utf8_len, ==, strlen (valid_utf8[i]));
- g_assert (s);
- g_assert_cmpuint (s->len, ==, strlen (valid_utf8[i]));
- g_assert_cmpstr (s->str, ==, valid_utf8[i]);
- g_string_free (s, TRUE);
- }
-
- /* Same as previous, only wanting output text */
- for (i = 0; valid_utf8[i] != NULL; i++) {
- s = NULL;
- result = tracker_text_validate_utf8 (valid_utf8[i],
- -1,
- &s,
- NULL);
- g_assert_cmpuint (result, ==, 1);
- g_assert (s);
- g_assert_cmpuint (s->len, ==, strlen (valid_utf8[i]));
- g_assert_cmpstr (s->str, ==, valid_utf8[i]);
- g_string_free (s, TRUE);
- }
-
- /* Same as previous, only wanting number of valid UTF-8 bytes */
- for (i = 0; valid_utf8[i] != NULL; i++) {
- utf8_len = 0;
- result = tracker_text_validate_utf8 (valid_utf8[i],
- -1,
- NULL,
- &utf8_len);
- g_assert_cmpuint (result, ==, 1);
- g_assert_cmpuint (utf8_len, ==, strlen (valid_utf8[i]));
- }
-
- /* If the input string starts with non-valid UTF-8 already, FALSE
- * should be returned */
- result = tracker_text_validate_utf8 ("\xF0\x90\x80" "a", -1, NULL, NULL);
- g_assert_cmpuint (result, ==, 0);
-
- /* If the input string suddenly has some non-valid UTF-8 bytes,
- * TRUE should be returned, and the outputs should contain only info
- * about the valid first chunk of UTF-8 bytes */
- s = NULL;
- utf8_len = 0;
- result = tracker_text_validate_utf8 ("abcdefghijk" "\xF0\x90\x80" "a",
- -1,
- &s,
- &utf8_len);
- g_assert_cmpuint (result, ==, 1);
- g_assert_cmpuint (utf8_len, ==, strlen ("abcdefghijk"));
- g_assert (s);
- g_assert_cmpuint (s->len, ==, strlen ("abcdefghijk"));
- g_assert_cmpstr (s->str, ==, "abcdefghijk");
- g_string_free (s, TRUE);
-}
-
-static void
-test_date_to_iso8601 ()
-{
- /* Not much to test here because it uses strptime/strftime */
- gchar *result;
-
- result = tracker_date_format_to_iso8601 ("2010:03:13 12:12:12", "%Y:%m:%d %H:%M:%S");
- g_assert (g_str_has_prefix (result, "2010-03-13T12:12:12"));
- g_assert_cmpint (strlen (result), <=, 25);
-
- /* Pattern and string don't match */
- result = tracker_date_format_to_iso8601 ("2010:03:13 12:12", "%Y:%m:%d %H:%M:%S");
- g_assert (result == NULL);
-}
-
-static void
-test_coalesce_strip ()
-{
- /* Used in other tests, but this one can try some corner cases */
- g_assert (!tracker_coalesce_strip (0, NULL));
-
- /* Allocate, do not use constant strings */
- char *e = g_strdup ("");
- char *a = g_strdup ("a");
- g_assert_cmpstr (tracker_coalesce_strip (2, e, a, NULL), ==, "a");
- g_free (e);
- g_free (a);
-}
-
-static void
-test_merge_const ()
-{
- gchar *result;
-
- result = tracker_merge_const ("*", 3, "a", "b", NULL);
- g_assert_cmpstr (result, ==, "a*b");
- g_free (result);
-
- result = tracker_merge_const ("****", 3, "a", "b", NULL);
- g_assert_cmpstr (result, ==, "a****b");
- g_free (result);
-
- result = tracker_merge_const (NULL, 3, "a", "b", NULL);
- g_assert_cmpstr (result, ==, "ab");
- g_free (result);
-
- result = tracker_merge_const ("", 3, "a", "b", NULL);
- g_assert_cmpstr (result, ==, "ab");
- g_free (result);
-
- result = tracker_merge_const ("*", 0, NULL);
- g_assert (!result);
-}
-
-static void
-test_getline (void)
-{
- FILE *f;
- gchar *line = NULL;
- gsize n = 0;
-
- f = fopen (TOP_SRCDIR "/tests/libtracker-extract/getline-test.txt", "r");
- g_assert_cmpint (tracker_getline (&line, &n, f), >, 0);
- g_assert_cmpstr (line, ==, "Line 1\n");
-
- g_assert_cmpint (tracker_getline (&line, &n, f), >, 0);
- g_assert_cmpstr (line, ==, "line 2\n");
-
- g_assert_cmpint (tracker_getline (&line, &n, f), >, 0);
- g_assert_cmpstr (line, ==, "line 3\n");
-}
-
-int
-main (int argc, char **argv)
-{
- gint result;
-
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/libtracker-extract/tracker-utils/guess_date",
- test_guess_date);
- g_test_add_func ("/libtracker-extract/tracker-utils/guess_date_failures",
- test_guess_date_failures);
- g_test_add_func ("/libtracker-extract/tracker-utils/guess_date_failures/subprocess",
- test_guess_date_failures_subprocess);
- g_test_add_func ("/libtracker-extract/tracker-utils/text-validate-utf8",
- test_text_validate_utf8);
- g_test_add_func ("/libtracker-extract/tracker-utils/date_to_iso8601",
- test_date_to_iso8601);
- g_test_add_func ("/libtracker-extract/tracker-utils/coalesce_strip",
- test_coalesce_strip);
- g_test_add_func ("/libtracker-extract/tracker-utils/merge_const",
- test_merge_const);
- g_test_add_func ("/libtracker-extract/tracker-utils/getline",
- test_getline);
- result = g_test_run ();
-
- return result;
-}
diff --git a/tests/libtracker-extract/tracker-test-xmp.c b/tests/libtracker-extract/tracker-test-xmp.c
deleted file mode 100644
index 0cf7afcc2..000000000
--- a/tests/libtracker-extract/tracker-test-xmp.c
+++ /dev/null
@@ -1,588 +0,0 @@
-/*
- * Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-
-#include <glib-object.h>
-
-#include <libtracker-extract/tracker-extract.h>
-
-#define BROKEN_XMP "This is not even XML"
-#define EXAMPLE_XMP \
-" <x:xmpmeta " \
-" xmlns:x=\'adobe:ns:meta/\'" \
-" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"" \
-" xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\"" \
-" xmlns:exif=\"http://ns.adobe.com/exif/1.0/\"" \
-" xmlns:tiff=\"http://ns.adobe.com/tiff/1.0/\">" \
-" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">" \
-" <rdf:Description rdf:about=\"\">" \
-" <dc:format>application/pdf</dc:format>" \
-" <dc:title>Title of the content</dc:title>" \
-" <dc:rights>CC share alike</dc:rights> " \
-" <dc:description>Description of the content</dc:description>" \
-" <dc:date>2010-03-18T15:17:04Z</dc:date>" \
-" <dc:keywords>test, data, xmp</dc:keywords>" \
-" <dc:subject>Subject of the content</dc:subject>" \
-" <dc:publisher>A honest developer</dc:publisher>" \
-" <dc:contributor>A honest contributor</dc:contributor>" \
-" <dc:type>PhysicalObject</dc:type>" \
-" <dc:identifier>12345</dc:identifier>" \
-" <dc:source>My dirty mind</dc:source>" \
-" <dc:language>Spanglish</dc:language>" \
-" <dc:relation>Single</dc:relation>" \
-" <dc:coverage>Pretty high after this test</dc:coverage>" \
-" <dc:creator>The ultimate creator</dc:creator>" \
-" <exif:Title>Title in exif</exif:Title>" \
-" <exif:DateTimeOriginal>2010-03-18T15:17:04Z</exif:DateTimeOriginal>" \
-" <exif:Artist>Artist in exif</exif:Artist>" \
-" <exif:Make>Make in exif</exif:Make>" \
-" <exif:Model>Model in exif</exif:Model>" \
-" <exif:Flash>0</exif:Flash>" \
-" <exif:MeteringMode>3</exif:MeteringMode>" \
-" <exif:ExposureTime>1000</exif:ExposureTime>" \
-" <exif:FNumber>12</exif:FNumber>" \
-" <exif:FocalLength>50</exif:FocalLength>" \
-" <exif:ISOSpeedRatings>400</exif:ISOSpeedRatings>" \
-" <exif:WhiteBalance>1</exif:WhiteBalance>" \
-" <exif:Copyright>Copyright in exif</exif:Copyright>" \
-" <tiff:Orientation>1</tiff:Orientation>" \
-" <xmp:CreateDate>2002-08-15T17:10:04Z</xmp:CreateDate>" \
-" </rdf:Description> " \
-" </rdf:RDF> " \
-" </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> "
-
-#define ORIENTATION_XMP \
-" <x:xmpmeta " \
-" xmlns:x=\'adobe:ns:meta/\'" \
-" xmlns:tiff=\"http://ns.adobe.com/tiff/1.0/\">" \
-" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">" \
-" <rdf:Description rdf:about=\"\">" \
-" <tiff:Orientation>%s</tiff:Orientation>" \
-" </rdf:Description>" \
-" </rdf:RDF></x:xmpmeta> "
-
-
-typedef struct {
- 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}
-};
-
-static ExifNepomuk ORIENTATIONS [] = {
- {"2", "nfo:orientation-top-mirror"},
- {"3", "nfo:orientation-bottom"},
- {"4", "nfo:orientation-bottom-mirror"},
- {"5", "nfo:orientation-left-mirror"},
- {"6", "nfo:orientation-right"},
- {"7", "nfo:orientation-right-mirror"},
- {"8", "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;
-};
-
-static void
-test_parsing_xmp_invalid_file_subprocess (void)
-{
- TrackerXmpData *data;
-
- data = tracker_xmp_new (BROKEN_XMP, strlen (BROKEN_XMP), "test://file");
- g_assert (data != NULL);
-
- tracker_xmp_free (data);
-}
-
-static void
-test_parsing_xmp_invalid_file (void)
-{
- g_test_trap_subprocess ("/libtracker-extract/tracker-xmp/parsing_xmp_invalid_file/subprocess", 0, 0);
- g_test_trap_assert_passed ();
- g_test_trap_assert_stderr ("*parsing failure*");
-}
-
-static void
-test_parsing_xmp (void)
-{
- TrackerXmpData *data;
- TrackerXmpData *expected;
-
- 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);
- g_assert_cmpstr (data->model, ==, expected->model);
- g_assert_cmpstr (data->orientation, ==, expected->orientation);
- g_assert_cmpstr (data->flash, ==, expected->flash);
- g_assert_cmpstr (data->metering_mode, ==, expected->metering_mode);
- g_assert_cmpstr (data->exposure_time, ==, expected->exposure_time);
- g_assert_cmpstr (data->fnumber, ==, expected->fnumber);
- g_assert_cmpstr (data->focal_length, ==, expected->focal_length);
-
- g_assert_cmpstr (data->iso_speed_ratings, ==, expected->iso_speed_ratings);
- g_assert_cmpstr (data->white_balance, ==, expected->white_balance);
- g_assert_cmpstr (data->copyright, ==, expected->copyright);
-
- tracker_xmp_free (expected);
- tracker_xmp_free (data);
-}
-
-static void
-test_xmp_metering_mode (void)
-{
- gint 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);
-
- g_assert_cmpstr (data->metering_mode, ==, METERING_MODES[i].nepomuk_translation);
- tracker_xmp_free (data);
- }
-}
-
-static void
-test_xmp_orientation (void)
-{
- guint 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);
-
- g_assert_cmpstr (data->orientation, ==, ORIENTATIONS[i].nepomuk_translation);
- tracker_xmp_free (data);
- }
-}
-
-static void
-test_xmp_apply (void)
-{
- TrackerResource *resource;
- TrackerResource *artist;
- TrackerXmpData *data;
-
- resource = tracker_resource_new ("urn:uuid:test");
-
- data = tracker_xmp_new (EXAMPLE_XMP, strlen (EXAMPLE_XMP), "urn:uuid:test");
- g_assert (data != NULL);
-
- g_assert (tracker_xmp_apply_to_resource (resource, data));
-
- /* We just check a few of the properties at random. */
- g_assert_cmpstr (tracker_resource_get_first_string (resource, "nie:description"), ==,
- "Description of the content");
-
- artist = tracker_resource_get_first_relation (resource, "nco:contributor");
- g_assert_cmpstr (tracker_resource_get_first_string(artist, "nco:fullname"), ==,
- "Artist in exif");
-
- tracker_xmp_free (data);
-}
-
-static void
-test_xmp_apply_location (void)
-{
- TrackerXmpData data = { 0, };
- TrackerResource *resource, *location, *address;
-
- data.address = g_strdup ("Itamerenkatu 11-13");
- data.city = g_strdup ("Helsinki");
- data.state = g_strdup ("N/A");
- data.country = g_strdup ("Findland");
-
- resource = tracker_resource_new ("urn:uuid:test");
-
- g_assert (tracker_xmp_apply_to_resource (resource, &data));
-
- location = tracker_resource_get_first_relation (resource, "slo:location");
- address = tracker_resource_get_first_relation (location, "slo:postalAddress");
-
- g_assert_cmpstr (tracker_resource_get_first_string (address, "nco:streetAddress"), ==, data.address);
- g_assert_cmpstr (tracker_resource_get_first_string (address, "nco:region"), ==, data.state);
- g_assert_cmpstr (tracker_resource_get_first_string (address, "nco:locality"), ==, data.city);
- g_assert_cmpstr (tracker_resource_get_first_string (address, "nco:country"), ==, data.country);
-}
-
-
-static void
-test_xmp_regions (void)
-{
- TrackerXmpData *data;
- TrackerXmpRegion *region;
-
- GFile *f;
- gchar *contents;
- gsize size;
- gchar *filepath;
-
- filepath = g_build_filename (TOP_SRCDIR, "tests", "libtracker-extract", "areas.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_free (contents);
-
- g_assert_cmpint (2, ==, g_slist_length (data->regions));
-
- 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");
- g_assert_cmpstr (region->height, ==, "0.09");
- g_assert_cmpstr (region->type, ==, "Pet");
- g_assert_cmpstr (region->title, ==, "Fido");
- g_assert_cmpstr (region->description, ==, "Fido looks happy!");
-
- 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");
- g_assert_cmpstr (region->height, ==, "0.09");
- g_assert_cmpstr (region->type, ==, "Face");
- g_assert_cmpstr (region->title, ==, "John Doe");
-
- tracker_xmp_free (data);
-}
-
-static void
-test_xmp_regions_quill (void)
-{
- TrackerXmpData *data;
- TrackerXmpRegion *region;
-
- GFile *f;
- gchar *contents;
- gsize size;
- gchar *filepath;
-
- filepath = g_build_filename (TOP_SRCDIR, "tests", "libtracker-extract", "areas-with-contacts.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_free (contents);
-
- g_assert_cmpint (2, ==, g_slist_length (data->regions));
-
- 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");
- g_assert_cmpstr (region->height, ==, "0.15");
- g_assert_cmpstr (region->type, ==, "Face");
- g_assert_cmpstr (region->title, ==, "Dilbert");
- g_assert_cmpstr (region->link_class, ==, "nco:PersonContact");
- g_assert_cmpstr (region->link_uri, ==, "urn:uuid:2");
-
- 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");
- g_assert_cmpstr (region->height, ==, "0.17");
- g_assert_cmpstr (region->type, ==, "Face");
- g_assert_cmpstr (region->title, ==, "Albert Einstein");
- g_assert_cmpstr (region->link_class, ==, "nco:PersonContact");
- g_assert_cmpstr (region->link_uri, ==, "urn:uuid:1");
-
- tracker_xmp_free (data);
-}
-
-static void
-test_xmp_regions_ns_prefix (void)
-{
- TrackerXmpData *data;
- TrackerXmpRegion *region;
-
- GFile *f;
- gchar *contents;
- gsize size;
- gchar *filepath;
-
- filepath = g_build_filename (TOP_SRCDIR, "tests", "libtracker-extract", "areas-ns.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_free (contents);
-
- g_assert_cmpint (2, ==, g_slist_length (data->regions));
-
- 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");
- g_assert_cmpstr (region->height, ==, "0.09");
- g_assert_cmpstr (region->type, ==, "Pet");
- g_assert_cmpstr (region->title, ==, "Fidoz");
- g_assert_cmpstr (region->description, ==, "Fido looks happy!");
-
- 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");
- g_assert_cmpstr (region->height, ==, "0.09");
- g_assert_cmpstr (region->type, ==, "Face");
- g_assert_cmpstr (region->title, ==, "Average Joe");
-
- tracker_xmp_free (data);
-}
-
-static 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_free (contents);
-
- 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, ==, " ");
-
- tracker_xmp_free (data);
-}
-
-static 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_free (contents);
-
- 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");
-
- tracker_xmp_free (data);
-}
-
-int
-main (int argc,
- char **argv)
-{
- gint result;
-
- g_test_init (&argc, &argv, NULL);
-
- g_test_message ("Testing XMP");
-
-#ifdef HAVE_EXEMPI
-
- g_test_add_func ("/libtracker-extract/tracker-xmp/parsing_xmp",
- test_parsing_xmp);
-
- g_test_add_func ("/libtracker-extract/tracker-xmp/parsing_xmp_invalid_file",
- test_parsing_xmp_invalid_file);
- g_test_add_func ("/libtracker-extract/tracker-xmp/parsing_xmp_invalid_file/subprocess",
- test_parsing_xmp_invalid_file_subprocess);
-
- 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/sparql_translation",
- test_xmp_apply);
-
- g_test_add_func ("/libtracker-extract/tracker-xmp/xmp_regions",
- test_xmp_regions);
-
- 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_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);
-
-#endif
- g_test_add_func ("/libtracker-extract/tracker-xmp/sparql_translation_location",
- test_xmp_apply_location);
-
- result = g_test_run ();
-
- return result;
-}