Commit e7a66021 authored by Mikael Ottela's avatar Mikael Ottela

Added extractor file access testing

svn path=/trunk/; revision=2850
parent acdef467
2009-01-27 Mikael Ottela <mikael.ottela@ixonos.com>
* tests/tracker-extract/data/jpeg/create_jpeg_testdata
* tests/tracker-extract/tracker-extract-testsuite-mp3.h
* tests/tracker-extract/tracker-extract-mp3-test.c
* tests/tracker-extract/tracker-extract-test-utils.c
* tests/tracker-extract/tracker-extract-test-utils.h
* tests/tracker-extract/tracker-extract-testsuite-mp3.c
* tests/tracker-extract/data/mp3/create_mp3_testdata: Added file
access testing.
2009-01-27 Martyn Russell <martyn@imendio.com>
* src/trackerd/tracker-monitor.c: (get_module_name_from_gfile):
......
......@@ -2,6 +2,19 @@
# Basic properties
#file access test
convert -size 320x240 pattern:checkerboard access_1.jpg
chmod 777 access_1.jpg
convert -size 320x240 pattern:checkerboard access_2.jpg
chmod 777 access_2.jpg
convert -size 320x240 pattern:checkerboard access_3.jpg
chmod 555 access_3.jpg
convert -size 320x240 pattern:checkerboard access_4.jpg
chmod 444 access_4.jpg
#size
convert -size 320x240 pattern:checkerboard basic_size_1.jpg
convert -size 640x480 pattern:checkerboard basic_size_2.jpg
......
#!/bin/sh
#file access test
echo Basic id3v1 tags 1| text2wave - | lame --resample 48 - "access_1.mp3"
chmod 777 access_1.mp3
echo Basic id3v1 tags 1| text2wave - | lame --resample 48 - "access_2.mp3"
chmod 666 access_2.mp3
echo Basic id3v1 tags 1| text2wave - | lame --resample 48 - "access_3.mp3"
chmod 555 access_3.mp3
echo Basic id3v1 tags 1| text2wave - | lame --resample 48 - "access_4.mp3"
chmod 444 access_4.mp3
# *** Basic id3v1 tags (ver 1 layer 3) ***
echo Basic id3v1 tags 1| text2wave - | lame --resample 48 - "id3v1_basic_1.mp3"
......
......@@ -44,9 +44,13 @@ main (int argc, char **argv) {
g_test_add_func ("/tracker-extract/tracker-extract-mp3/check-extractor-data",
test_tracker_extract_check_extractor_data);
#if 0
data = tracker_test_extract_get_extractor ("audio/mpeg");
g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/access",
data, access_tracker_extract_mp3);
#if 0
g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v1_basic",
data, test_tracker_extract_mp3_id3v1_basic);
g_test_add_data_func ("/tracker-extract/tracker-extract-mp3/id3v23_basic",
......
......@@ -131,6 +131,43 @@ performance_extract_files (const TrackerExtractorData *data, const gchar *filema
g_test_minimized_result (perftime, "Time of the performance tests");
}
void
access_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 );
for (i=1;i<=filecount;i++) {
char filename[256];
char tmp[256];
GHashTable *metadata;
metadata = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_free);
if (sprintf (tmp, "%s%s",TEST_DATA_DIR,filematch) < 0) {
g_assert_not_reached();
}
if (sprintf (filename, tmp, i) < 0) {
g_assert_not_reached();
}
(*data->extractor) (filename, metadata);
g_assert (g_hash_table_size (metadata) > 0);
g_hash_table_destroy (metadata);
}
}
TrackerExtractorData *
search_mime_extractor (const gchar *mime)
......
......@@ -36,6 +36,9 @@ void extract_file (const TrackerExtractorData *data,
void performance_extract_files (const TrackerExtractorData *data,
const gchar *filematch,
guint filecount);
void access_extract_files (const TrackerExtractorData *data,
const gchar *filematch,
guint filecount);
GHashTable * parse_testdata_file (const gchar *filename);
void dump_metadata (GHashTable *metadata);
......
......@@ -102,6 +102,13 @@ static const ExtractData data_header_sampling[] = {
{ NULL, NULL }
};
void access_tracker_extract_mp3(gconstpointer data)
{
const TrackerExtractorData *extractor = data;
access_extract_files (data, "/mp3/access_%d.mp3", 4);
}
void test_tracker_extract_mp3_id3v1_basic(gconstpointer data)
{
const TrackerExtractorData *extractor = data;
......@@ -192,6 +199,6 @@ void performance_tracker_extract_mp3(gconstpointer data)
{
const TrackerExtractorData *extractor = data;
performance_extract_files (data, "/mp3/perf_cbr_id3v1_", 1000);
performance_extract_files (data, "/mp3/perf_cbr_id3v1_%d.mp3", 1000);
}
......@@ -23,6 +23,8 @@
#include <tracker-extract/tracker-extract.h>
void access_tracker_extract_mp3 (gconstpointer data);
void test_tracker_extract_mp3_id3v1_basic (gconstpointer data);
void test_tracker_extract_mp3_id3v23_basic (gconstpointer data);
void test_tracker_extract_mp3_id3v23_tcon (gconstpointer data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment