2
Gwenview: an image viewer
3
Copyright 2010 Aurélien Gâteau <agateau@kde.org>
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 2
8
of the License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
#include <qtest_kde.h>
29
#include "../lib/document/documentfactory.h"
30
#include "../lib/imageutils.h"
31
#include "../lib/transformimageoperation.h"
32
#include "testutils.h"
34
#include "transformimageoperationtest.moc"
36
QTEST_KDEMAIN(TransformImageOperationTest, GUI)
38
using namespace Gwenview;
40
void TransformImageOperationTest::initTestCase()
42
qRegisterMetaType<KUrl>("KUrl");
45
void TransformImageOperationTest::init()
47
DocumentFactory::instance()->clearCache();
50
void TransformImageOperationTest::testRotate90()
52
KUrl url = urlForTestFile("test.png");
55
bool ok = image.load(url.toLocalFile());
56
QVERIFY2(ok, "Could not load 'test.png'");
57
QMatrix matrix = ImageUtils::transformMatrix(ROT_90);
58
image = image.transformed(matrix);
60
Document::Ptr doc = DocumentFactory::instance()->load(url);
62
TransformImageOperation* op = new TransformImageOperation(ROT_90);
64
connect(doc.data(), SIGNAL(allTasksDone()), &loop, SLOT(quit()));
65
op->applyToDocument(doc);
68
QCOMPARE(image, doc->image());