1
// vim: set tabstop=4 shiftwidth=4 expandtab:
3
Gwenview: an image viewer
4
Copyright 2012 Aurélien Gâteau <agateau@kde.org>
6
This program is free software; you can redistribute it and/or
7
modify it under the terms of the GNU General Public License
8
as published by the Free Software Foundation; either version 2
9
of the License, or (at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
22
#include "cmsprofiletest.moc"
25
#include <lib/cms/cmsprofile.h>
26
#include <lib/exiv2imageloader.h>
27
#include <testutils.h>
30
#include <qtest_kde.h>
34
QTEST_KDEMAIN(CmsProfileTest, GUI)
36
using namespace Gwenview;
38
void CmsProfileTest::testLoadFromImageData()
40
QFETCH(QString, fileName);
41
QFETCH(QByteArray, format);
44
QString path = pathForTestFile(fileName);
46
QVERIFY(file.open(QIODevice::ReadOnly));
47
data = file.readAll();
49
Cms::Profile::Ptr ptr = Cms::Profile::loadFromImageData(data, format);
50
QVERIFY(!ptr.isNull());
53
#define NEW_ROW(fileName, format) QTest::newRow(fileName) << fileName << QByteArray(format)
54
void CmsProfileTest::testLoadFromImageData_data()
56
QTest::addColumn<QString>("fileName");
57
QTest::addColumn<QByteArray>("format");
58
NEW_ROW("cms/colourTestFakeBRG.png", "png");
59
NEW_ROW("cms/colourTestsRGB.png", "png");
60
NEW_ROW("cms/Upper_Left.jpg", "jpeg");
61
NEW_ROW("cms/Upper_Right.jpg", "jpeg");
62
NEW_ROW("cms/Lower_Left.jpg", "jpeg");
63
NEW_ROW("cms/Lower_Right.jpg", "jpeg");
69
void CmsProfileTest::testLoadFromExiv2Image()
71
QFETCH(QString, fileName);
72
Exiv2::Image::AutoPtr image;
75
QString path = pathForTestFile(fileName);
78
QVERIFY(file.open(QIODevice::ReadOnly));
79
data = file.readAll();
81
Exiv2ImageLoader loader;
82
QVERIFY(loader.load(data));
83
image = loader.popImage();
85
Cms::Profile::Ptr ptr = Cms::Profile::loadFromExiv2Image(image.get());
86
QVERIFY(!ptr.isNull());
89
#define NEW_ROW(fileName) QTest::newRow(fileName) << fileName
90
void CmsProfileTest::testLoadFromExiv2Image_data()
92
QTest::addColumn<QString>("fileName");