File indexing completed on 2024-05-12 04:19:58
0001 /* 0002 Gwenview: an image viewer 0003 Copyright 2012 Aurélien Gâteau <agateau@kde.org> 0004 0005 This program is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU General Public License 0007 as published by the Free Software Foundation; either version 2 0008 of the License, or (at your option) any later version. 0009 0010 This program is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 GNU General Public License for more details. 0014 0015 You should have received a copy of the GNU General Public License 0016 along with this program; if not, write to the Free Software 0017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0018 0019 */ 0020 0021 // STL 0022 #include <memory> 0023 0024 // Qt 0025 #include <QTest> 0026 0027 // KF 0028 0029 // Local 0030 #include "../lib/exiv2imageloader.h" 0031 #include "../lib/imagemetainfomodel.h" 0032 #include "testutils.h" 0033 0034 // Exiv2 0035 #include <exiv2/exiv2.hpp> 0036 0037 #include "imagemetainfomodeltest.h" 0038 0039 QTEST_MAIN(ImageMetaInfoModelTest) 0040 0041 using namespace Gwenview; 0042 0043 void ImageMetaInfoModelTest::testCatchExiv2Errors() 0044 { 0045 QByteArray data; 0046 { 0047 QString path = pathForTestFile("302350_exiv_0.23_exception.jpg"); 0048 QFile file(path); 0049 QVERIFY(file.open(QIODevice::ReadOnly)); 0050 data = file.readAll(); 0051 } 0052 0053 std::unique_ptr<Exiv2::Image> image; 0054 { 0055 Exiv2ImageLoader loader; 0056 QVERIFY(loader.load(data)); 0057 image = loader.popImage(); 0058 } 0059 0060 ImageMetaInfoModel model; 0061 model.setExiv2Image(image.get()); 0062 } 0063 0064 #include "moc_imagemetainfomodeltest.cpp"