File indexing completed on 2024-05-12 15:55:47

0001 # SPDX-FileCopyrightText: 2019-2020 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
0002 #
0003 # SPDX-License-Identifier: BSD-2-Clause
0004 
0005 _checks[check_old-index.xml]="Compatibility: Old/ancient file formats"
0006 _context[check_old-index.xml]="<h2>What this test will do:</h2>
0007 <p><ul>
0008 <li>This test checks whether old file versions are still correctly read. </li>
0009 <li>After you close this dialog, KPhotoAlbum will be started 2 times in a row.</li>
0010 </ul>
0011 </p>
0012 <h2>What you have to do:</h2>
0013 <ol>
0014 <li>Each time KPhotoAlbum starts, save the database and exit KPhotoAlbum.</li>
0015 </ol>"
0016 check_old-index.xml()
0017 {
0018         local check_name="check_old-index.xml"
0019         local check_dir="$TEMPDIR/$check_name"
0020         local data_dir="$mydir/db/old-index.xml"
0021         setup_check "$check_dir" || return $result_err_setup
0022         # not needed in this scenario:
0023         rm -r "$check_dir/db"
0024 
0025         kdialog --msgbox "<h1>$check_name</h1>${_context[$check_name]}"
0026 
0027         for subcheck in v2.2 v3.0
0028         do
0029                 local subcheck_dir="$check_dir/$subcheck"
0030                 mkdir "$subcheck_dir" || return $result_err_setup
0031 
0032                 local add_rc="[General]\nuntaggedCategory=\nuntaggedTag=\n"
0033                 echo -e "$add_rc$BASE_RC" > "$subcheck_dir/kphotoalbumrc" || return $result_err_setup
0034 
0035                 # set logging rules:
0036                 cp -a "$check_dir/QtProject" "$subcheck_dir"
0037                 # prepare database:
0038                 cp "$data_dir/$subcheck.orig.xml" "$subcheck_dir/index.xml" || return $result_err_setup
0039 
0040                 export XDG_CONFIG_HOME="$subcheck_dir"
0041                 kphotoalbum --db "$subcheck_dir/index.xml" > "$subcheck_dir/log" 2>&1 || return $result_err_crash
0042 
0043                 if ! diff -u "$data_dir/$subcheck.result.xml" "$subcheck_dir/index.xml"
0044                 then
0045                         log notice "$check_name/$subcheck: Mismatch in index.xml!"
0046                         return $result_failed
0047                 fi
0048                 if ! grep -q '^kphotoalbum.DB: "Standard category names are no longer used since index.xml version 7. Standard categories will be left untranslated from now on."$' "$subcheck_dir/log"
0049                 then
0050                         log notice "$check_name/$subcheck: Missing expected log message!"
0051                         return $result_failed
0052                 fi
0053         done
0054         return $result_ok
0055 }