File indexing completed on 2024-05-12 04:22:23

0001 # SPDX-FileCopyrightText: 2018-2020 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
0002 #
0003 # SPDX-License-Identifier: BSD-2-Clause
0004 
0005 _checks[check_stripexif]="Feature: Strip Camera Generated Default Descriptions"
0006 _context[check_stripexif]="<h2>What this test will do:</h2>
0007 <ul>
0008 <li>This test checks whether Exif comments are properly imported into the description field of the database.</li>
0009 <li>The filter for stripping camera generated default descriptions is also tested.</li>
0010 <li>After you close this dialog, KPhotoAlbum will be started and it will search for new images.</li>
0011 </ul>
0012 <h2>How you can check manually</h2>
0013 <ol>
0014 <li>Go to <em>Untagged Images</em> and check that two new images show up.</li>
0015 <li>Check if the image with text <em>DEFAULT_DESCRIPTION</em> has an empty description field.</li>
0016 <li>Check if the image with text <em>NO DEFAULT_DESCRIPTION</em> has the description \"NO DEFAULT DESCRIPTION\".</li>
0017 </ol>
0018 <h2>What you have to do:</h2>
0019 <ol>
0020 <li>When KPhotoAlbum starts, save the database and exit KPhotoAlbum.</li>
0021 </ol>"
0022 _check_db_file[check_stripexif]=integration-tests/check_stripexif.result.xml
0023 
0024 check_stripexif_exifhelper()
0025 # generate an image with exiv description
0026 {
0027         convert -size 700x460  label:"$1" "$check_dir/db/$1.jpg"
0028         exiv2 -M"set Exif.Image.ImageDescription $1" "$check_dir/db/$1.jpg"
0029         exiv2 -M"set Exif.Photo.DateTimeOriginal '2000-01-01 00:00:00'" "$check_dir/db/$1.jpg"
0030 }
0031 
0032 prepare_check_stripexif()
0033 {
0034         local check_dir="$1"
0035         # useEXIFComments is set by default
0036         # stripEXIFComments contains several descriptions, line by line
0037         # make sure there's more than one line so that escaping is also checked:
0038         echo -e "[General]\nstripEXIFComments=true\ncommentsToStrip=SOME DEFAULT-,-DEFAULT_DESCRIPTION-,-OTHER-,-\n$BASE_RC" > "$check_dir/kphotoalbumrc"
0039 
0040         # instead of generating the files on the fly, copy a pre-generated version instead:
0041         #check_stripexif_exifhelper "DEFAULT_DESCRIPTION"
0042         #check_stripexif_exifhelper "NO DEFAULT_DESCRIPTION"
0043         # ...this way, we are guaranteed to get the same md5 sum every time:
0044         cp -a "$mydir/integration-tests/check_stripexif/DEFAULT_DESCRIPTION.jpg" "$check_dir/db/"
0045         cp -a "$mydir/integration-tests/check_stripexif/NO DEFAULT_DESCRIPTION.jpg" "$check_dir/db/"
0046 }
0047 call_check_stripexif()
0048 {
0049         local check_dir="$1"
0050         kphotoalbum --db "$check_dir/db/index.xml" --search
0051 }
0052 check_stripexif()
0053 {
0054         generic_check check_stripexif
0055 }