tracker r2811 - in trunk: . src/tracker-extract tests/tracker-extract tests/tracker-extract/data/jpeg
- From: mottela svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2811 - in trunk: . src/tracker-extract tests/tracker-extract tests/tracker-extract/data/jpeg
- Date: Tue, 20 Jan 2009 21:49:13 +0000 (UTC)
Author: mottela
Date: Tue Jan 20 21:49:12 2009
New Revision: 2811
URL: http://svn.gnome.org/viewvc/tracker?rev=2811&view=rev
Log:
Minor fixes to image metadata extraction and added tests
Added:
trunk/tests/tracker-extract/data/jpeg/
trunk/tests/tracker-extract/data/jpeg/basic_size_1.data
trunk/tests/tracker-extract/data/jpeg/basic_size_2.data
trunk/tests/tracker-extract/data/jpeg/basic_size_3.data
trunk/tests/tracker-extract/data/jpeg/basic_size_4.data
trunk/tests/tracker-extract/data/jpeg/basic_size_5.data
trunk/tests/tracker-extract/data/jpeg/create_jpeg_testdata (contents, props changed)
trunk/tests/tracker-extract/data/jpeg/exif_artist_1.data
trunk/tests/tracker-extract/data/jpeg/exif_comment_1.data
trunk/tests/tracker-extract/data/jpeg/exif_datetime_1.data
trunk/tests/tracker-extract/data/jpeg/exif_datetime_2.data
trunk/tests/tracker-extract/data/jpeg/exif_description_1.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_1.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_10.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_11.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_12.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_13.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_14.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_15.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_16.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_17.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_18.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_19.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_2.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_20.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_21.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_22.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_23.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_24.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_25.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_26.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_27.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_3.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_4.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_5.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_6.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_7.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_8.data
trunk/tests/tracker-extract/data/jpeg/exif_flash_9.data
trunk/tests/tracker-extract/data/jpeg/exif_fnumber_1.data
trunk/tests/tracker-extract/data/jpeg/exif_focal_1.data
trunk/tests/tracker-extract/data/jpeg/exif_iso_1.data
trunk/tests/tracker-extract/data/jpeg/exif_metering_1.data
trunk/tests/tracker-extract/data/jpeg/exif_name_1.data
trunk/tests/tracker-extract/data/jpeg/exif_orientation_1.data
trunk/tests/tracker-extract/data/jpeg/exif_size_1.data
trunk/tests/tracker-extract/data/jpeg/exif_software_1.data
trunk/tests/tracker-extract/data/jpeg/exif_white_1.data
trunk/tests/tracker-extract/tracker-extract-jpeg-test.c
trunk/tests/tracker-extract/tracker-extract-testsuite-jpeg.c
trunk/tests/tracker-extract/tracker-extract-testsuite-jpeg.h
Modified:
trunk/ChangeLog
trunk/src/tracker-extract/tracker-extract-jpeg.c
trunk/src/tracker-extract/tracker-xmp.c
trunk/tests/tracker-extract/Makefile.am
trunk/tests/tracker-extract/tracker-extract-gstreamer-test.c
trunk/tests/tracker-extract/tracker-extract-test-utils.c
trunk/tests/tracker-extract/tracker-extract-test-utils.h
trunk/tests/tracker-extract/tracker-extract-testsuite-generic.c
trunk/tests/tracker-extract/tracker-extract-testsuite-mp3.c
Modified: trunk/src/tracker-extract/tracker-extract-jpeg.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-jpeg.c (original)
+++ trunk/src/tracker-extract/tracker-extract-jpeg.c Tue Jan 20 21:49:12 2009
@@ -19,6 +19,10 @@
* Boston, MA 02110-1301, USA.
*/
+/*
+ * FIXME: Use EXIF_DATA_OPTION_FOLLOW_SPECIFICATION for libexif to get raw data.
+ */
+
#include "config.h"
#include <stdio.h>
@@ -113,16 +117,16 @@
static gchar *
fix_focal_length (const gchar *fl)
{
- return g_strndup (fl, strstr (fl, "mm") - fl);
+ return g_strndup (fl, strstr (fl, " mm") - fl);
}
static gchar *
fix_flash (const gchar *flash)
{
- if (g_str_has_prefix (flash, "No")) {
- return g_strdup ("0");
- } else {
+ if (g_str_has_prefix (flash, "Flash fired")) {
return g_strdup ("1");
+ } else {
+ return g_strdup ("0");
}
}
@@ -143,7 +147,7 @@
new_fn[0] = new_fn[1] = ' ';
}
- return new_fn;
+ return g_strstrip(new_fn);
}
static gchar *
Modified: trunk/src/tracker-extract/tracker-xmp.c
==============================================================================
--- trunk/src/tracker-extract/tracker-xmp.c (original)
+++ trunk/src/tracker-extract/tracker-xmp.c Tue Jan 20 21:49:12 2009
@@ -9,7 +9,7 @@
*
* 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
+ * MERCHANTABILITY or FITNESS FOR PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
@@ -33,6 +33,86 @@
#include <exempi/xmp.h>
#include <exempi/xmpconsts.h>
+static gchar *
+fix_metering_mode (const gchar *mode)
+{
+ gint value;
+ value = atoi(mode);
+
+ switch (value) {
+ case 0:
+ return "unknown";
+ case 1:
+ return "Average";
+ case 2:
+ return "CenterWeightedAverage";
+ case 3:
+ return "Spot";
+ case 4:
+ return "MultiSpot";
+ case 5:
+ return "Pattern";
+ case 6:
+ return "Partial";
+ }
+
+ return "unknown";
+}
+
+static gchar *
+fix_flash (const gchar *flash)
+{
+ static const gint fired_mask = 0x1;
+ gint value;
+ value = atoi(flash);
+ if (value & fired_mask) {
+ return "1";
+ } else {
+ return "0";
+ }
+
+}
+
+static gchar *
+fix_white_balance (const gchar *wb)
+{
+ gint value;
+ value = atoi(wb);
+ if (wb) {
+ return "Manual white balance";
+ } else {
+ return "Auto white balance";
+ }
+}
+
+static gchar *
+fix_orientation (const gchar *orientation)
+{
+ gint value;
+ value = atoi(orientation);
+
+ switch (value) {
+ case 1:
+ return "top - left";
+ case 2:
+ return "top - right";
+ case 3:
+ return "bottom - right";
+ case 4:
+ return "bottom - left";
+ case 5:
+ return "left - top";
+ case 6:
+ return "right - top";
+ case 7:
+ return "right - bottom";
+ case 8:
+ return "left - bottom";
+ }
+
+ return "top - left";
+}
+
static void tracker_xmp_iter (XmpPtr xmp,
XmpIteratorPtr iter,
GHashTable *metadata,
@@ -263,7 +343,22 @@
tracker_append_string_to_hash_table (metadata, "Image:CameraModel", value, append);
}
else if (strcmp (name, "Orientation") == 0) {
- tracker_append_string_to_hash_table (metadata, "Image:Orientation", value, append);
+ tracker_append_string_to_hash_table (metadata,
+ "Image:Orientation",
+ fix_orientation(value),
+ append);
+ }
+ else if (strcmp (name, "Flash") == 0) {
+ tracker_append_string_to_hash_table (metadata,
+ "Image:Flash",
+ fix_flash (value),
+ append);
+ }
+ else if (strcmp (name, "MeteringMode") == 0) {
+ tracker_append_string_to_hash_table (metadata,
+ "Image:MeteringMode",
+ fix_metering_mode (value),
+ append);
}
else if (strcmp (name, "ExposureProgram") == 0) {
tracker_append_string_to_hash_table (metadata, "Image:ExposureProgram", value, append);
@@ -281,7 +376,8 @@
tracker_append_string_to_hash_table (metadata, "Image:ISOSpeed", value, append);
}
else if (strcmp (name, "WhiteBalance") == 0) {
- tracker_append_string_to_hash_table (metadata, "Image:WhiteBalance", value, append);
+ tracker_append_string_to_hash_table (metadata, "Image:WhiteBalance",
+ fix_white_balance (value), append);
}
else if (strcmp (name, "Copyright") == 0) {
tracker_append_string_to_hash_table (metadata, "File:Copyright", value, append);
Modified: trunk/tests/tracker-extract/Makefile.am
==============================================================================
--- trunk/tests/tracker-extract/Makefile.am (original)
+++ trunk/tests/tracker-extract/Makefile.am Tue Jan 20 21:49:12 2009
@@ -10,6 +10,11 @@
test-tracker-extract-gstreamer
endif
+if HAVE_LIBJPEG
+TEST_PROGS += \
+ test-tracker-extract-jpeg
+endif
+
INCLUDES = \
-DG_LOG_DOMAIN=\"Tracker\" \
-DTEST_DATA_DIR=\""$(abs_top_builddir)/tests/tracker-extract/data"\"\
@@ -22,17 +27,19 @@
$(PANGO_CFLAGS) \
$(GLIB2_CFLAGS)
-test_utils_sources = \
+TEST_UTILS_SOURCES = \
tracker-extract-test-utils.c \
tracker-extract-test-utils.h \
tracker-extract-testsuite-generic.c \
tracker-extract-testsuite-generic.h \
tracker-extract-testsuite-mp3.c \
- tracker-extract-testsuite-mp3.h
+ tracker-extract-testsuite-mp3.h \
+ tracker-extract-testsuite-jpeg.c \
+ tracker-extract-testsuite-jpeg.h
test_tracker_extract_mp3_SOURCES = \
tracker-extract-mp3-test.c \
- $(test_utils_sources)
+ $(TEST_UTILS_SOURCES)
test_tracker_extract_mp3_LDADD = \
$(top_builddir)/src/tracker-extract/libextract-mp3.la \
@@ -41,11 +48,9 @@
$(GTHREAD_LIBS) \
$(GLIB2_LIBS)
-if HAVE_GSTREAMER
-
test_tracker_extract_gstreamer_SOURCES = \
tracker-extract-gstreamer-test.c \
- $(test_utils_sources)
+ $(TEST_UTILS_SOURCES)
test_tracker_extract_gstreamer_LDADD = \
$(top_builddir)/src/tracker-extract/libextract-gstreamer.la \
@@ -55,4 +60,17 @@
$(GLIB2_LIBS) \
$(GSTREAMER_LIBS)
-endif
+
+test_tracker_extract_jpeg_SOURCES = \
+ tracker-extract-jpeg-test.c \
+ $(TEST_UTILS_SOURCES)
+
+test_tracker_extract_jpeg_LDADD = \
+ $(top_builddir)/src/tracker-extract/libextract-jpeg.la \
+ $(top_builddir)/src/libtracker-common/libtracker-common.la \
+ $(GMODULE_LIBS) \
+ $(GTHREAD_LIBS) \
+ $(GLIB2_LIBS) \
+ $(LIBJPEG_LIBS) \
+ $(LIBEXIF_LIBS) \
+ $(EXEMPI_LIBS)
Added: trunk/tests/tracker-extract/data/jpeg/basic_size_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/basic_size_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1,2 @@
+Image:Width = "320"
+Image:Height = "240"
Added: trunk/tests/tracker-extract/data/jpeg/basic_size_2.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/basic_size_2.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1,2 @@
+Image:Width = "640"
+Image:Height = "480"
Added: trunk/tests/tracker-extract/data/jpeg/basic_size_3.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/basic_size_3.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1,2 @@
+Image:Width = "1280"
+Image:Height = "1024"
Added: trunk/tests/tracker-extract/data/jpeg/basic_size_4.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/basic_size_4.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1,2 @@
+Image:Width = "1600"
+Image:Height = "1400"
Added: trunk/tests/tracker-extract/data/jpeg/basic_size_5.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/basic_size_5.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1,2 @@
+Image:Width = "11"
+Image:Height = "2483"
Added: trunk/tests/tracker-extract/data/jpeg/create_jpeg_testdata
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/create_jpeg_testdata Tue Jan 20 21:49:12 2009
@@ -0,0 +1,176 @@
+#!/bin/sh
+
+# Basic properties
+
+#size
+convert -size 320x240 pattern:checkerboard header_size_1.jpg
+convert -size 640x480 pattern:checkerboard header_size_2.jpg
+convert -size 1280x1024 pattern:checkerboard header_size_3.jpg
+convert -size 1600x1400 pattern:checkerboard header_size_4.jpg
+convert -size 11x2483 pattern:checkerboard header_size_5.jpg
+
+#EXIF
+convert -size 320x240 pattern:checkerboard exif_size_1.jpg
+exiftool -exif:ImageWidth=640 -exif:ImageHeight=480 exif_size_1.jpg
+
+#orientation
+convert -size 320x240 pattern:checkerboard exif_orientation_1.jpg
+exiftool -exif:Orientation=1 -n exif_orientation_1.jpg
+
+convert -size 320x240 pattern:checkerboard exif_orientation_2.jpg
+exiftool -exif:Orientation=2 -n exif_orientation_2.jpg
+
+convert -size 320x240 pattern:checkerboard exif_orientation_3.jpg
+exiftool -exif:Orientation=3 -n exif_orientation_3.jpg
+
+convert -size 320x240 pattern:checkerboard exif_orientation_4.jpg
+exiftool -exif:Orientation=4 -n exif_orientation_4.jpg
+
+convert -size 320x240 pattern:checkerboard exif_orientation_5.jpg
+exiftool -exif:Orientation=5 -n exif_orientation_5.jpg
+
+convert -size 320x240 pattern:checkerboard exif_orientation_6.jpg
+exiftool -exif:Orientation=6 -n exif_orientation_6.jpg
+
+convert -size 320x240 pattern:checkerboard exif_orientation_7.jpg
+exiftool -exif:Orientation=7 -n exif_orientation_7.jpg
+
+convert -size 320x240 pattern:checkerboard exif_orientation_8.jpg
+exiftool -exif:Orientation=8 -n exif_orientation_8.jpg
+
+#datetime
+convert -size 320x240 pattern:checkerboard exif_datetime_1.jpg
+exiftool -exif:ModifyDate=2190:12:23 exif_datetime_1.jpg
+
+convert -size 320x240 pattern:checkerboard exif_datetime_2.jpg
+exiftool -exif:DateTimeOriginal=1930:12:23 exif_datetime_2.jpg
+#image name
+convert -size 320x240 pattern:checkerboard exif_name_1.jpg
+exiftool -exif:DocumentName="Test name" exif_name_1.jpg
+
+#artist
+convert -size 320x240 pattern:checkerboard exif_artist_1.jpg
+exiftool -exif:Artist="Artist name" exif_artist_1.jpg
+
+#comment
+convert -size 320x240 pattern:checkerboard exif_comment_1.jpg
+exiftool -exif:UserComment="I am commenting" exif_comment_1.jpg
+
+#description
+convert -size 320x240 pattern:checkerboard exif_description_1.jpg
+exiftool -exif:ImageDescription="I am describing" exif_description_1.jpg
+
+#software
+convert -size 320x240 pattern:checkerboard exif_software_1.jpg
+exiftool -exif:Software="Softa" exif_software_1.jpg
+
+#fnumber
+convert -size 320x240 pattern:checkerboard exif_fnumber_1.jpg
+exiftool -exif:FNumber=2.3 exif_fnumber_1.jpg
+
+#flash
+convert -size 320x240 pattern:checkerboard exif_flash_1.jpg
+exiftool -exif:Flash=0x0 -n exif_flash_1.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_2.jpg
+exiftool -exif:Flash=0x1 -n exif_flash_2.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_3.jpg
+exiftool -exif:Flash=0x5 -n exif_flash_3.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_4.jpg
+exiftool -exif:Flash=0x7 -n exif_flash_4.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_5.jpg
+exiftool -exif:Flash=0x8 -n exif_flash_5.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_6.jpg
+exiftool -exif:Flash=0x9 -n exif_flash_6.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_7.jpg
+exiftool -exif:Flash=0xd -n exif_flash_7.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_8.jpg
+exiftool -exif:Flash=0xf -n exif_flash_8.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_9.jpg
+exiftool -exif:Flash=0x10 -n exif_flash_9.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_10.jpg
+exiftool -exif:Flash=0x14 -n exif_flash_10.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_11.jpg
+exiftool -exif:Flash=0x18 -n exif_flash_11.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_12.jpg
+exiftool -exif:Flash=0x19 -n exif_flash_12.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_13.jpg
+exiftool -exif:Flash=0x1d -n exif_flash_13.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_14.jpg
+exiftool -exif:Flash=0x1f -n exif_flash_14.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_15.jpg
+exiftool -exif:Flash=0x20 -n exif_flash_15.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_16.jpg
+exiftool -exif:Flash=0x30 -n exif_flash_16.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_17.jpg
+exiftool -exif:Flash=0x41 -n exif_flash_17.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_18.jpg
+exiftool -exif:Flash=0x45 -n exif_flash_18.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_19.jpg
+exiftool -exif:Flash=0x47 -n exif_flash_19.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_20.jpg
+exiftool -exif:Flash=0x49 -n exif_flash_20.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_21.jpg
+exiftool -exif:Flash=0x4d -n exif_flash_21.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_22.jpg
+exiftool -exif:Flash=0x4f -n exif_flash_22.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_23.jpg
+exiftool -exif:Flash=0x50 -n exif_flash_23.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_24.jpg
+exiftool -exif:Flash=0x58 -n exif_flash_24.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_25.jpg
+exiftool -exif:Flash=0x59 -n exif_flash_25.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_26.jpg
+exiftool -exif:Flash=0x5d -n exif_flash_26.jpg
+
+convert -size 320x240 pattern:checkerboard exif_flash_27.jpg
+exiftool -exif:Flash=0x5f -n exif_flash_27.jpg
+
+#focal lenght
+convert -size 320x240 pattern:checkerboard exif_focal_1.jpg
+exiftool -exif:FocalLength=5.3 exif_focal_1.jpg
+
+#iso
+convert -size 320x240 pattern:checkerboard exif_iso_1.jpg
+exiftool -exif:ISO=5 exif_iso_1.jpg
+
+#white balance
+convert -size 320x240 pattern:checkerboard exif_white_1.jpg
+exiftool -exif:WhiteBalance=0 -n exif_white_1.jpg
+
+#metering mode
+convert -size 320x240 pattern:checkerboard exif_metering_1.jpg
+exiftool -exif:MeteringMode=5 -n exif_metering_1.jpg
+
+# { EXIF_TAG_MAKE, "Image:CameraMake", NULL },
+# { EXIF_TAG_MODEL, "Image:CameraModel", NULL },
+# { EXIF_TAG_ORIENTATION, "Image:Orientation", NULL },
+# { EXIF_TAG_EXPOSURE_PROGRAM, "Image:ExposureProgram", NULL },
+# { EXIF_TAG_EXPOSURE_TIME, "Image:ExposureTime", fix_exposure_time },
+# { EXIF_TAG_COPYRIGHT, "File:Copyright", NULL },
+
+
Added: trunk/tests/tracker-extract/data/jpeg/exif_artist_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_artist_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Creator = "Artist name"
Added: trunk/tests/tracker-extract/data/jpeg/exif_comment_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_comment_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Comments = "I am commenting"
Added: trunk/tests/tracker-extract/data/jpeg/exif_datetime_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_datetime_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Date = "2190:12:23T"
Added: trunk/tests/tracker-extract/data/jpeg/exif_datetime_2.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_datetime_2.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Date = "1930:12:23T"
Added: trunk/tests/tracker-extract/data/jpeg/exif_description_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_description_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Description = "I am describing"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "0"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_10.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_10.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "0"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_11.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_11.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "0"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_12.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_12.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_13.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_13.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_14.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_14.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_15.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_15.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "0"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_16.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_16.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "0"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_17.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_17.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_18.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_18.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_19.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_19.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_2.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_2.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_20.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_20.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_21.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_21.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_22.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_22.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_23.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_23.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "0"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_24.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_24.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "0"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_25.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_25.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_26.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_26.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_27.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_27.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_3.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_3.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "0"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_4.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_4.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "0"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_5.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_5.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "0"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_6.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_6.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_7.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_7.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_8.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_8.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_flash_9.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_flash_9.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Flash = "0"
Added: trunk/tests/tracker-extract/data/jpeg/exif_fnumber_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_fnumber_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:FNumber = "2.3"
Added: trunk/tests/tracker-extract/data/jpeg/exif_focal_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_focal_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:FocalLength = "5.3"
Added: trunk/tests/tracker-extract/data/jpeg/exif_iso_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_iso_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:ISOSpeed = "5"
Added: trunk/tests/tracker-extract/data/jpeg/exif_metering_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_metering_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:MeteringMode = "Pattern"
Added: trunk/tests/tracker-extract/data/jpeg/exif_name_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_name_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Title = "Test name"
Added: trunk/tests/tracker-extract/data/jpeg/exif_orientation_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_orientation_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Orientation = "1"
Added: trunk/tests/tracker-extract/data/jpeg/exif_size_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_size_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1,2 @@
+Image:Width = "320"
+Image:Height = "240"
Added: trunk/tests/tracker-extract/data/jpeg/exif_software_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_software_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:Software = "Softa"
Added: trunk/tests/tracker-extract/data/jpeg/exif_white_1.data
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/data/jpeg/exif_white_1.data Tue Jan 20 21:49:12 2009
@@ -0,0 +1 @@
+Image:WhiteBalance = "Auto white balance"
Modified: trunk/tests/tracker-extract/tracker-extract-gstreamer-test.c
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-gstreamer-test.c (original)
+++ trunk/tests/tracker-extract/tracker-extract-gstreamer-test.c Tue Jan 20 21:49:12 2009
@@ -52,8 +52,8 @@
data, test_tracker_extract_mp3_id3v23_basic);
g_test_add_data_func ("/tracker-extract/tracker-extract-gstreamer/id3v23_tags",
data, test_tracker_extract_mp3_id3v23_tags);
-/* g_test_add_data_func ("/tracker-extract/tracker-extract-gstreamer/header_bitrate",
- data, test_tracker_extract_mp3_header_bitrate); Gstreamer gets these wrong. reported */
+ g_test_add_data_func ("/tracker-extract/tracker-extract-gstreamer/header_bitrate",
+ data, test_tracker_extract_mp3_header_bitrate);
g_test_add_data_func ("/tracker-extract/tracker-extract-gstreamer/header_sampling",
data, test_tracker_extract_mp3_header_sampling);
Added: trunk/tests/tracker-extract/tracker-extract-jpeg-test.c
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/tracker-extract-jpeg-test.c Tue Jan 20 21:49:12 2009
@@ -0,0 +1,75 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008, Nokia (urho konttori 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 <string.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <glib.h>
+
+#include <tracker-extract/tracker-extract.h>
+
+#include "tracker-extract-test-utils.h"
+#include "tracker-extract-testsuite-generic.h"
+#include "tracker-extract-testsuite-jpeg.h"
+
+int
+main (int argc, char **argv) {
+
+ gint result;
+
+ g_type_init ();
+ g_thread_init (NULL);
+ g_test_init (&argc, &argv, NULL);
+
+ TrackerExtractorData *data;
+
+ g_test_message ("Testing extractor functionality");
+ g_test_add_func ("/tracker-extract/tracker-extract-jpeg/check-extractor-data",
+ test_tracker_extract_check_extractor_data);
+
+#if 0
+ data = tracker_test_extract_get_extractor ("image/jpeg");
+
+ g_test_add_data_func ("/tracker-extract/tracker-extract-jpeg/basic_size",
+ data, test_tracker_extract_jpeg_basic_size);
+
+ g_test_add_data_func ("/tracker-extract/tracker-extract-jpeg/exif_size",
+ data, test_tracker_extract_jpeg_exif_size);
+
+/* g_test_add_data_func ("/tracker-extract/tracker-extract-jpeg/exif_orientation", */
+/* data, test_tracker_extract_jpeg_exif_orientation); */
+
+ g_test_add_data_func ("/tracker-extract/tracker-extract-jpeg/exif_flash",
+ data, test_tracker_extract_jpeg_exif_flash);
+
+ g_test_add_data_func ("/tracker-extract/tracker-extract-jpeg/exif_tags",
+ data, test_tracker_extract_jpeg_exif_tags);
+
+ if (g_test_perf()) {
+
+ }
+
+#endif
+
+
+ result = g_test_run ();
+
+ return result;
+}
Modified: trunk/tests/tracker-extract/tracker-extract-test-utils.c
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-test-utils.c (original)
+++ trunk/tests/tracker-extract/tracker-extract-test-utils.c Tue Jan 20 21:49:12 2009
@@ -45,6 +45,86 @@
return NULL;
}
+void
+extract_file (const TrackerExtractorData *data, const gchar *file, const gchar *testdatafile)
+{
+ GHashTable *metadata;
+ GHashTable *testdata;
+
+ gchar *filename;
+ gchar *testdata_filename;
+
+ GHashTableIter iter;
+ gpointer key, value;
+
+ g_assert (data != NULL);
+ g_assert (file != NULL);
+ g_assert (testdatafile != NULL);
+
+ filename = g_strconcat (TEST_DATA_DIR, file, NULL);
+ testdata_filename = g_strconcat (TEST_DATA_DIR, testdatafile, NULL);
+
+ metadata = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ g_free);
+
+ (*data->extractor) (filename, metadata);
+
+ testdata = parse_testdata_file (testdata_filename);
+
+ g_hash_table_iter_init (&iter, testdata);
+
+/* dump_metadata(metadata); */
+
+ while (g_hash_table_iter_next (&iter, &key, &value)) {
+ check_metadata (metadata, (gchar *)key, (gchar *)value);
+ }
+
+ g_hash_table_destroy (metadata);
+ g_hash_table_destroy (testdata);
+}
+
+void
+performance_extract_files (const TrackerExtractorData *data, const gchar *filematch, guint filecount)
+{
+ double perftime;
+ guint i;
+
+ g_assert (data != NULL);
+ g_assert (filematch != NULL);
+ g_assert (filecount >0 );
+
+ g_test_timer_start();
+
+ for (i=1;i<=filecount;i++) {
+ char filename[256];
+ GHashTable *metadata;
+
+ metadata = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ g_free);
+
+ if (sprintf (filename, "%s%s%d.mp3",TEST_DATA_DIR,filematch,i) < 0) {
+ g_assert_not_reached();
+ }
+
+ (*data->extractor) (filename, metadata);
+
+ g_assert (g_hash_table_size (metadata) > 0);
+
+ g_hash_table_destroy (metadata);
+ }
+
+ perftime = g_test_timer_elapsed();
+
+ g_debug ("Time was: %f", perftime);
+
+ g_test_minimized_result (perftime, "Time of the performance tests");
+}
+
+
TrackerExtractorData *
search_mime_extractor (const gchar *mime)
{
Modified: trunk/tests/tracker-extract/tracker-extract-test-utils.h
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-test-utils.h (original)
+++ trunk/tests/tracker-extract/tracker-extract-test-utils.h Tue Jan 20 21:49:12 2009
@@ -30,6 +30,13 @@
#include <tracker-extract/tracker-extract.h>
TrackerExtractorData * tracker_test_extract_get_extractor (const gchar *mime);
+void extract_file (const TrackerExtractorData *data,
+ const gchar *file,
+ const gchar *testdatafile);
+void performance_extract_files (const TrackerExtractorData *data,
+ const gchar *filematch,
+ guint filecount);
+
GHashTable * parse_testdata_file (const gchar *filename);
void dump_metadata (GHashTable *metadata);
void check_metadata (GHashTable *metadata,
Modified: trunk/tests/tracker-extract/tracker-extract-testsuite-generic.c
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-testsuite-generic.c (original)
+++ trunk/tests/tracker-extract/tracker-extract-testsuite-generic.c Tue Jan 20 21:49:12 2009
@@ -40,5 +40,5 @@
data++;
}
- g_assert (extractors > 1);
+ g_assert (extractors > 0);
}
Added: trunk/tests/tracker-extract/tracker-extract-testsuite-jpeg.c
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/tracker-extract-testsuite-jpeg.c Tue Jan 20 21:49:12 2009
@@ -0,0 +1,156 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008, Nokia (urho konttori 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 "tracker-extract-testsuite-mp3.h"
+
+#include <glib.h>
+
+#include "tracker-extract-test-utils.h"
+
+typedef struct {
+ gchar *filename;
+ gchar *testdata;
+} ExtractData;
+
+static const ExtractData data_basic_size[] = {
+ { "/jpeg/basic_size_1.jpg", "/jpeg/basic_size_1.data" },
+ { "/jpeg/basic_size_2.jpg", "/jpeg/basic_size_2.data" },
+ { "/jpeg/basic_size_3.jpg", "/jpeg/basic_size_3.data" },
+ { "/jpeg/basic_size_4.jpg", "/jpeg/basic_size_4.data" },
+ { "/jpeg/basic_size_5.jpg", "/jpeg/basic_size_5.data" },
+ { NULL, NULL }
+};
+
+static const ExtractData data_exif_size[] = {
+ { "/jpeg/exif_size_1.jpg", "/jpeg/exif_size_1.data" },
+ { NULL, NULL }
+};
+
+static const ExtractData data_exif_orientation[] = {
+ { "/jpeg/exif_orientation_1.jpg", "/jpeg/exif_orientation_1.data" },
+ { NULL, NULL }
+};
+
+static const ExtractData data_exif_flash[] = {
+ { "/jpeg/exif_flash_1.jpg", "/jpeg/exif_flash_1.data" },
+ { "/jpeg/exif_flash_2.jpg", "/jpeg/exif_flash_2.data" },
+ { "/jpeg/exif_flash_3.jpg", "/jpeg/exif_flash_3.data" },
+ { "/jpeg/exif_flash_4.jpg", "/jpeg/exif_flash_4.data" },
+ { "/jpeg/exif_flash_5.jpg", "/jpeg/exif_flash_5.data" },
+ { "/jpeg/exif_flash_6.jpg", "/jpeg/exif_flash_6.data" },
+ { "/jpeg/exif_flash_7.jpg", "/jpeg/exif_flash_7.data" },
+ { "/jpeg/exif_flash_8.jpg", "/jpeg/exif_flash_8.data" },
+ { "/jpeg/exif_flash_9.jpg", "/jpeg/exif_flash_9.data" },
+ { "/jpeg/exif_flash_10.jpg", "/jpeg/exif_flash_10.data" },
+ { "/jpeg/exif_flash_11.jpg", "/jpeg/exif_flash_11.data" },
+ { "/jpeg/exif_flash_12.jpg", "/jpeg/exif_flash_12.data" },
+ { "/jpeg/exif_flash_13.jpg", "/jpeg/exif_flash_13.data" },
+ { "/jpeg/exif_flash_14.jpg", "/jpeg/exif_flash_14.data" },
+ { "/jpeg/exif_flash_15.jpg", "/jpeg/exif_flash_15.data" },
+ { "/jpeg/exif_flash_16.jpg", "/jpeg/exif_flash_16.data" },
+ { "/jpeg/exif_flash_17.jpg", "/jpeg/exif_flash_17.data" },
+ { "/jpeg/exif_flash_18.jpg", "/jpeg/exif_flash_18.data" },
+ { "/jpeg/exif_flash_19.jpg", "/jpeg/exif_flash_19.data" },
+ { "/jpeg/exif_flash_20.jpg", "/jpeg/exif_flash_20.data" },
+ { "/jpeg/exif_flash_21.jpg", "/jpeg/exif_flash_21.data" },
+ { "/jpeg/exif_flash_22.jpg", "/jpeg/exif_flash_22.data" },
+ { "/jpeg/exif_flash_23.jpg", "/jpeg/exif_flash_23.data" },
+ { "/jpeg/exif_flash_24.jpg", "/jpeg/exif_flash_24.data" },
+ { "/jpeg/exif_flash_25.jpg", "/jpeg/exif_flash_25.data" },
+ { "/jpeg/exif_flash_26.jpg", "/jpeg/exif_flash_26.data" },
+ { "/jpeg/exif_flash_27.jpg", "/jpeg/exif_flash_27.data" },
+ { NULL, NULL },
+};
+
+static const ExtractData data_exif_tags[] = {
+ { "/jpeg/exif_artist_1.jpg", "/jpeg/exif_artist_1.data" },
+ { "/jpeg/exif_flash_1.jpg", "/jpeg/exif_flash_1.data" },
+ { "/jpeg/exif_focal_1.jpg", "/jpeg/exif_focal_1.data" },
+ { "/jpeg/exif_fnumber_1.jpg", "/jpeg/exif_fnumber_1.data" },
+ { "/jpeg/exif_name_1.jpg", "/jpeg/exif_name_1.data" },
+ { "/jpeg/exif_white_1.jpg", "/jpeg/exif_white_1.data" },
+ { "/jpeg/exif_comment_1.jpg", "/jpeg/exif_comment_1.data" },
+ { "/jpeg/exif_description_1.jpg", "/jpeg/exif_description_1.data" },
+ { "/jpeg/exif_iso_1.jpg", "/jpeg/exif_iso_1.data" },
+ { "/jpeg/exif_software_1.jpg", "/jpeg/exif_software_1.data" },
+ { "/jpeg/exif_metering_1.jpg", "/jpeg/exif_metering_1.data" },
+ { NULL, NULL }
+};
+
+void test_tracker_extract_jpeg_basic_size(gconstpointer data)
+{
+ const TrackerExtractorData *extractor = data;
+ guint i;
+
+ for (i=0; data_basic_size[i].filename; i++) {
+ extract_file (data,
+ data_basic_size[i].filename,
+ data_basic_size[i].testdata);
+ }
+}
+
+void test_tracker_extract_jpeg_exif_size(gconstpointer data)
+{
+ const TrackerExtractorData *extractor = data;
+ guint i;
+
+ for (i=0; data_exif_size[i].filename; i++) {
+ extract_file (data,
+ data_exif_size[i].filename,
+ data_exif_size[i].testdata);
+ }
+}
+
+void test_tracker_extract_jpeg_exif_orientation(gconstpointer data)
+{
+ const TrackerExtractorData *extractor = data;
+ guint i;
+
+ for (i=0; data_exif_orientation[i].filename; i++) {
+ extract_file (data,
+ data_exif_orientation[i].filename,
+ data_exif_orientation[i].testdata);
+ }
+}
+
+void test_tracker_extract_jpeg_exif_flash(gconstpointer data)
+{
+ const TrackerExtractorData *extractor = data;
+ guint i;
+
+ for (i=0; data_exif_flash[i].filename; i++) {
+ extract_file (data,
+ data_exif_flash[i].filename,
+ data_exif_flash[i].testdata);
+ }
+}
+
+void test_tracker_extract_jpeg_exif_tags(gconstpointer data)
+{
+ const TrackerExtractorData *extractor = data;
+ guint i;
+
+ for (i=0; data_exif_tags[i].filename; i++) {
+ extract_file (data,
+ data_exif_tags[i].filename,
+ data_exif_tags[i].testdata);
+ }
+}
+
Added: trunk/tests/tracker-extract/tracker-extract-testsuite-jpeg.h
==============================================================================
--- (empty file)
+++ trunk/tests/tracker-extract/tracker-extract-testsuite-jpeg.h Tue Jan 20 21:49:12 2009
@@ -0,0 +1,33 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2009, Nokia (urho konttori 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.
+ */
+
+#ifndef __TRACKER_EXTRACT_TESTSUITE_JPEG_H__
+#define __TRACKER_EXTRACT_TESTSUITE_JPEG_H__
+
+#include <tracker-extract/tracker-extract.h>
+
+void test_tracker_extract_jpeg_basic_size (gconstpointer data);
+void test_tracker_extract_jpeg_exif_size (gconstpointer data);
+void test_tracker_extract_jpeg_exif_orientation (gconstpointer data);
+void test_tracker_extract_jpeg_exif_flash (gconstpointer data);
+
+void test_tracker_extract_jpeg_exif_tags (gconstpointer data);
+
+#endif
Modified: trunk/tests/tracker-extract/tracker-extract-testsuite-mp3.c
==============================================================================
--- trunk/tests/tracker-extract/tracker-extract-testsuite-mp3.c (original)
+++ trunk/tests/tracker-extract/tracker-extract-testsuite-mp3.c Tue Jan 20 21:49:12 2009
@@ -92,86 +92,6 @@
{ NULL, NULL }
};
-void
-extract_file (const TrackerExtractorData *data, const gchar *file, const gchar *testdatafile)
-{
- GHashTable *metadata;
- GHashTable *testdata;
-
- gchar *filename;
- gchar *testdata_filename;
-
- GHashTableIter iter;
- gpointer key, value;
-
- g_assert (data != NULL);
- g_assert (file != NULL);
- g_assert (testdatafile != NULL);
-
- filename = g_strconcat (TEST_DATA_DIR, file, NULL);
- testdata_filename = g_strconcat (TEST_DATA_DIR, testdatafile, NULL);
-
- metadata = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- g_free);
-
- (*data->extractor) (filename, metadata);
-
- testdata = parse_testdata_file (testdata_filename);
-
- g_hash_table_iter_init (&iter, testdata);
-
-/* dump_metadata(metadata); */
-
- while (g_hash_table_iter_next (&iter, &key, &value)) {
- check_metadata (metadata, (gchar *)key, (gchar *)value);
- }
-
- g_hash_table_destroy (metadata);
- g_hash_table_destroy (testdata);
-}
-
-void
-performance_extract_files (const TrackerExtractorData *data, const gchar *filematch, guint filecount)
-{
- double perftime;
- guint i;
-
- g_assert (data != NULL);
- g_assert (filematch != NULL);
- g_assert (filecount >0 );
-
- g_test_timer_start();
-
- for (i=1;i<=filecount;i++) {
- char filename[256];
- GHashTable *metadata;
-
- metadata = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- g_free);
-
- if (sprintf (filename, "%s%s%d.mp3",TEST_DATA_DIR,filematch,i) < 0) {
- g_assert_not_reached();
- }
-
- (*data->extractor) (filename, metadata);
-
- g_assert (g_hash_table_size (metadata) > 0);
-
- g_hash_table_destroy (metadata);
- }
-
- perftime = g_test_timer_elapsed();
-
- g_debug ("Time was: %f", perftime);
-
- g_test_minimized_result (perftime, "Time of the mp3 performance tests");
-}
-
-
void test_tracker_extract_mp3_id3v1_basic(gconstpointer data)
{
const TrackerExtractorData *extractor = data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]