Added test directory and some initial test data and scripts. Needs work.

v0.27.3
Andreas Huggel 21 years ago
parent 974d5e4637
commit 5e8980a445

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

@ -0,0 +1 @@
<EFBFBD>Exiv2<76><32>

@ -0,0 +1,9 @@
Iptc.Application2.Caption 0x0078 A picture of a glider being built
Iptc.Application2.Headline 0x0069 The headline I am
Iptc.Application2.Keywords 0x0019 Yet another keyword
Iptc.Application2.DateCreated 0x0037 2004-08-03
Iptc.Application2.Urgency 0x000a 3
Iptc.Application2.SuppCategory 0x0014 bla bla ba
Iptc.Envelope.ModelVersion 0x0000 2
Iptc.Envelope.TimeSent 0x0050 14:41:00-05:00
Iptc.Application2.RasterizedCaption 0x007d 230 42 34 2 90 84 23 146

@ -0,0 +1 @@
Iptc.Application2.Caption 0x0078 A picture of a glider being built

@ -0,0 +1 @@
Caught Exiv2 exception 'temp: No Iptc data found in the file'

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -0,0 +1,20 @@
Iptc.Application2.Caption 0x0078 yelimS green faced dude (iptc caption)
Iptc.Application2.Writer 0x007a Nobody
Iptc.Application2.Byline 0x0050 Its me
Iptc.Application2.ObjectName 0x0005 GreeenDude
Iptc.Application2.DateCreated 0x0037 2004-08-03
Iptc.Application2.City 0x005a Seattle
Iptc.Application2.ProvinceState 0x005f WA
Iptc.Application2.CountryName 0x0065 USA
Iptc.Application2.Category 0x000f Things
Iptc.Application2.Keywords 0x0019 Green
Iptc.Application2.Keywords 0x0019 Smiley
Iptc.Application2.Keywords 0x0019 Dude
Iptc.Application2.Copyright 0x0074 © 2004 Nobody
Iptc.Application2.Headline 0x0069 The headline I am
Iptc.Application2.Keywords 0x0019 Yet another keyword
Iptc.Application2.Urgency 0x000a 3
Iptc.Application2.SuppCategory 0x0014 bla bla ba
Iptc.Envelope.ModelVersion 0x0000 2
Iptc.Envelope.TimeSent 0x0050 14:41:00-05:00
Iptc.Application2.RasterizedCaption 0x007d 230 42 34 2 90 84 23 146

@ -0,0 +1,13 @@
Iptc.Application2.Caption 0x0078 yelimS green faced dude (iptc caption)
Iptc.Application2.Writer 0x007a Nobody
Iptc.Application2.Byline 0x0050 Its me
Iptc.Application2.ObjectName 0x0005 GreeenDude
Iptc.Application2.DateCreated 0x0037 2004-07-13
Iptc.Application2.City 0x005a Seattle
Iptc.Application2.ProvinceState 0x005f WA
Iptc.Application2.CountryName 0x0065 USA
Iptc.Application2.Category 0x000f Things
Iptc.Application2.Keywords 0x0019 Green
Iptc.Application2.Keywords 0x0019 Smiley
Iptc.Application2.Keywords 0x0019 Dude
Iptc.Application2.Copyright 0x0074 © 2004 Nobody

@ -0,0 +1,7 @@
Iptc.Application2.Writer 0x007a Nobody
Iptc.Application2.ObjectName 0x0005 GreeenDude
Iptc.Application2.DateCreated 0x0037 2004-07-13
Iptc.Application2.City 0x005a Seattle
Iptc.Application2.ProvinceState 0x005f WA
Iptc.Application2.Category 0x000f Things
Iptc.Application2.Copyright 0x0074 © 2004 Nobody

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -0,0 +1,14 @@
Iptc.Application2.RecordVersion 0x0000 2
Iptc.Application2.Caption 0x0078 A bunch of squares
Iptc.Application2.Byline 0x0050 Brad
Iptc.Application2.ObjectName 0x0005 This is a title
Iptc.Application2.Keywords 0x0019 nothing
Iptc.Application2.Keywords 0x0019 really
Iptc.Application2.Headline 0x0069 The headline I am
Iptc.Application2.Keywords 0x0019 Yet another keyword
Iptc.Application2.DateCreated 0x0037 2004-08-03
Iptc.Application2.Urgency 0x000a 3
Iptc.Application2.SuppCategory 0x0014 bla bla ba
Iptc.Envelope.ModelVersion 0x0000 2
Iptc.Envelope.TimeSent 0x0050 14:41:00-05:00
Iptc.Application2.RasterizedCaption 0x007d 230 42 34 2 90 84 23 146

@ -0,0 +1,6 @@
Iptc.Application2.RecordVersion 0x0000 2
Iptc.Application2.Caption 0x0078 A bunch of squares
Iptc.Application2.Byline 0x0050 Brad
Iptc.Application2.ObjectName 0x0005 This is a title
Iptc.Application2.Keywords 0x0019 nothing
Iptc.Application2.Keywords 0x0019 really

@ -0,0 +1,2 @@
Iptc.Application2.RecordVersion 0x0000 2
Iptc.Application2.ObjectName 0x0005 This is a title

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

@ -0,0 +1,20 @@
Iptc.Application2.Caption 0x0078 Smiley green faced dude (iptc caption)
Iptc.Application2.Writer 0x007a Nobody
Iptc.Application2.Byline 0x0050 Its me
Iptc.Application2.ObjectName 0x0005 GreeenDude
Iptc.Application2.DateCreated 0x0037 2004-08-03
Iptc.Application2.City 0x005a Seattle
Iptc.Application2.ProvinceState 0x005f WA
Iptc.Application2.CountryName 0x0065 USA
Iptc.Application2.Category 0x000f Things
Iptc.Application2.Keywords 0x0019 Green
Iptc.Application2.Keywords 0x0019 Smiley
Iptc.Application2.Keywords 0x0019 Dude
Iptc.Application2.Copyright 0x0074 © 2004 Nobody
Iptc.Application2.Headline 0x0069 The headline I am
Iptc.Application2.Keywords 0x0019 Yet another keyword
Iptc.Application2.Urgency 0x000a 3
Iptc.Application2.SuppCategory 0x0014 bla bla ba
Iptc.Envelope.ModelVersion 0x0000 2
Iptc.Envelope.TimeSent 0x0050 14:41:00-05:00
Iptc.Application2.RasterizedCaption 0x007d 230 42 34 2 90 84 23 146

@ -0,0 +1,13 @@
Iptc.Application2.Caption 0x0078 Smiley green faced dude (iptc caption)
Iptc.Application2.Writer 0x007a Nobody
Iptc.Application2.Byline 0x0050 Its me
Iptc.Application2.ObjectName 0x0005 GreeenDude
Iptc.Application2.DateCreated 0x0037 2004-07-13
Iptc.Application2.City 0x005a Seattle
Iptc.Application2.ProvinceState 0x005f WA
Iptc.Application2.CountryName 0x0065 USA
Iptc.Application2.Category 0x000f Things
Iptc.Application2.Keywords 0x0019 Green
Iptc.Application2.Keywords 0x0019 Smiley
Iptc.Application2.Keywords 0x0019 Dude
Iptc.Application2.Copyright 0x0074 © 2004 Nobody

@ -0,0 +1,7 @@
Iptc.Application2.Writer 0x007a Nobody
Iptc.Application2.ObjectName 0x0005 GreeenDude
Iptc.Application2.DateCreated 0x0037 2004-07-13
Iptc.Application2.City 0x005a Seattle
Iptc.Application2.ProvinceState 0x005f WA
Iptc.Application2.Category 0x000f Things
Iptc.Application2.Copyright 0x0074 © 2004 Nobody

File diff suppressed because one or more lines are too long

@ -0,0 +1,62 @@
#! /bin/sh
# Test driver for exiv2 utility tests
(
images="exiv2-empty.jpg \
exiv2-canon-powershot-s40.jpg \
exiv2-nikon-e990.jpg \
exiv2-nikon-d70.jpg \
exiv2-nikon-e950.jpg \
exiv2-canon-eos-300d.jpg \
exiv2-kodak-dc210.jpg \
exiv2-fujifilm-finepix-s2pro.jpg \
exiv2-sigma-d10.jpg"
for i in $images; do cp -f data/$i tmp/; done
echo "Test directory -----------------------------------------------------------"
cd tmp/ || exit 1;
exiv2="../../src/exiv2"
echo
echo "Exiv2 version ------------------------------------------------------------"
which $exiv2 || exit 2;
$exiv2 -V
echo
echo "Exiv2 help ---------------------------------------------------------------"
$exiv2 -h
echo
echo "Adjust -------------------------------------------------------------------"
$exiv2 -v -a-12:01:01 adjust *.jpg
echo
echo "Rename -------------------------------------------------------------------"
$exiv2 -vf rename *.jpg
echo
echo "Print --------------------------------------------------------------------"
$exiv2 -v print *.jpg
$exiv2 -v -pi print *.jpg
$exiv2 -v -pi print *.jpg > iii
echo
echo "Extract Exif data --------------------------------------------------------"
$exiv2 -vf extract *.jpg
echo
echo "Extract Thumbnail --------------------------------------------------------"
$exiv2 -vf -et extract *.jpg
$exiv2 -v -pi print *.exv > jjj
echo
echo "Compare image data and extracted data ------------------------------------"
diff iii jjj
echo
echo "Delete Thumbnail ---------------------------------------------------------"
$exiv2 -v -dt delete *.jpg
$exiv2 -vf -et extract *.jpg
echo
echo "Delete Exif data ---------------------------------------------------------"
$exiv2 -v delete *.jpg
$exiv2 -v print *.jpg
echo
echo "Insert Exif data ---------------------------------------------------------"
$exiv2 -v insert *.jpg
$exiv2 -v -pi print *.exv > kkk
echo
echo "Compare original and inserted image data ---------------------------------"
diff iii kkk
) > exiv2-test.out 2>&1

@ -0,0 +1,104 @@
#! /bin/bash
# Test driver for image file i/o
eraseTest()
{
src=$1
test=${src}.etst
good=${src}.egd
#setup
cp $src $test
#run tests
../src/metacopy $test $test
#check results
diffCheck $test $good
echo -n "."
}
copyTest()
{
num=$1
src=$2
dst=$3
test=${dst}.c${num}tst
good=${dst}.c${num}gd
#setup
cp $dst $test
#run tests
../src/metacopy -a $src $test
#check results
diffCheck $test $good
echo -n "."
}
iptcTest()
{
num=$1
src=$2
dst=$3
test=${dst}.i${num}tst
good=${dst}.i${num}gd
#setup
cp $dst $test
#run tests
../src/metacopy -ip $src $test
#check results
diffCheck $test $good
echo -n "."
}
# Make sure to pass the test file first and the known good file second
diffCheck()
{
test=$1
good=$2
#run diff and check results
diff -q --binary $test $good
if [ $? -ne 0 ]; then
let ++errors
else
rm $test
fi
}
test_files="table.jpg smiley1.jpg smiley2.jpg"
let errors=0
cd ../test
echo
echo -n "Erase all tests"
for i in $test_files; do eraseTest $i; done
eraseTest "glider.exv" #extra test
echo -ne "\nCopy all tests"
let c=0
for src in $test_files; do
let ++c
for dst in $test_files; do copyTest $c $src $dst; done
done
echo -ne "\nCopy iptc tests"
let c=0
for src in $test_files; do
let ++c
for dst in $test_files; do iptcTest $c $src $dst; done
done
echo -e "\n---------------------------------------------------------"
if [ $errors -eq 0 ]; then
echo 'All test cases passed'
else
echo $errors 'test case(s) failed!'
fi

@ -0,0 +1,133 @@
#! /bin/bash
# Test driver for Iptc metadata
printTest()
{
src=$1
test=${src}.iptst
good=${src}.ipgd
#run tests
../src/iptcprint $src > $test
#check results
diffCheck $test $good
echo -n "."
}
removeTest()
{
src=$1
tmp="temp"
test=${src}.irtst
good=${src}.irgd
#setup
cp $src $tmp
#run tests
../src/iptctest $tmp <<-eoc
r Iptc.Application2.Byline
r Iptc.Application2.Caption
r Iptc.Application2.Keywords
r Iptc.Application2.Keywords
r Iptc.Application2.Keywords
r Iptc.Application2.CountryName
eoc
../src/iptcprint $tmp > $test
#check results
diffCheck $test $good
echo -n "."
rm $tmp
}
addModTest()
{
src=$1
tmp="temp"
test=${src}.iatst
good=${src}.iagd
#setup
cp $src $tmp
#run tests
../src/iptctest $tmp <<-eoc
a Iptc.Application2.Headline The headline I am
a Iptc.Application2.Keywords Yet another keyword
m Iptc.Application2.DateCreated 2004-8-3
a Iptc.Application2.Urgency 3
m Iptc.Application2.SuppCategory "bla bla ba"
a Iptc.Envelope.ModelVersion 2
a Iptc.Envelope.TimeSent 14:41:0-05:00
a Iptc.Application2.RasterizedCaption 230 42 34 2 90 84 23 146
eoc
../src/iptcprint $tmp > $test
#check results
diffCheck $test $good
echo -n "."
rm $tmp
}
extendedTest()
{
src=$1
tmp="temp"
test=${src}.ixtst
good=${src}.ixgd
#setup
cp $src $tmp
#run tests
../src/iptctest $tmp < ext.dat
../src/iptcprint $tmp > $test
#check results
diffCheck $test $good
echo -n "."
rm $tmp
}
# Make sure to pass the test file first and the known good file second
diffCheck()
{
test=$1
good=$2
#run diff and check results
diff -q --strip-trailing-cr $test $good
if [ $? -ne 0 ]; then
let ++errors
else
rm $test
fi
}
test_files="smiley1.jpg smiley2.jpg glider.exv table.jpg"
let errors=0
cd ../test
echo
echo -n "Read tests"
for i in $test_files; do printTest $i; done
echo -ne "\nRemove tests"
for i in $test_files; do removeTest $i; done
echo -ne "\nAdd/Mod tests"
for i in $test_files; do addModTest $i; done
echo -ne "\nExtended tests"
for i in $test_files; do extendedTest $i; done
echo -e "\n---------------------------------------------------------"
if [ $errors -eq 0 ]; then
echo 'All test cases passed'
else
echo $errors 'test case(s) failed!'
fi

@ -0,0 +1,53 @@
#! /bin/sh
# Test driver for the write unit tests
# Function:
# runTestCase number file
# Params:
# number: Test case number
# file : Input file
# Abstract:
# Run the requested test case number with the given file
runTestCase()
{
rtc_number=$1
rtc_infile=$2
rtc_outfile=test${rtc_number}.jpg
rtc_jpgthumb=thumb${rtc_number}.jpg
rtc_tifthumb=thumb${rtc_number}.tif
rm -f $rtc_outfile $rtc_jpgthumb $rtc_tifthumb
rm -f iii ttt;
echo "------------------------------------------------------------"
./exifprint $rtc_infile > iii;
cp $rtc_infile $rtc_outfile;
./write-test $rtc_infile $rtc_number > ttt;
diff iii ttt
}
# **********************************************************************
# main
images="img_1771.jpg \
kodak-dc210.jpg \
dscf0176.jpg \
sigma-d10-IMG10086.jpg \
nikon-coolpix-990-DSCN1180.jpg \
nikon-d70-dsc_0063.jpg \
nikon-e950.jpg"
for i in $images; do cp -f ../test/images/$i ./; done
runTestCase 1 ./img_1771.jpg
runTestCase 2 ./img_1771.jpg
runTestCase 3 ./kodak-dc210.jpg
runTestCase 4 ./img_1771.jpg
runTestCase 5 ./img_1771.jpg
runTestCase 6 ./kodak-dc210.jpg
runTestCase 7 ./dscf0176.jpg
runTestCase 8 ./sigma-d10-IMG10086.jpg
runTestCase 9 ./nikon-coolpix-990-DSCN1180.jpg
runTestCase 10 ./nikon-e950.jpg
runTestCase 11 ./nikon-d70-dsc_0063.jpg
Loading…
Cancel
Save