File indexing completed on 2024-12-15 04:13:44
0001 /* 0002 SPDX-FileCopyrightText: 2020 Albert Astals Cid <aacid@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include <QTest> 0008 0009 #include "core/document.h" 0010 #include "core/generator.h" 0011 #include "core/observer.h" 0012 #include "core/page.h" 0013 0014 #include "../document.h" 0015 0016 #include "settings_core.h" 0017 0018 class ComicBookGeneratorTest : public QObject 0019 { 0020 Q_OBJECT 0021 0022 private Q_SLOTS: 0023 void initTestCase(); 0024 void testRotatedImage(); 0025 void cleanupTestCase(); 0026 }; 0027 0028 void ComicBookGeneratorTest::initTestCase() 0029 { 0030 Okular::SettingsCore::instance(QStringLiteral("ComicBookGeneratorTest")); 0031 } 0032 0033 void ComicBookGeneratorTest::cleanupTestCase() 0034 { 0035 } 0036 0037 void ComicBookGeneratorTest::testRotatedImage() 0038 { 0039 ComicBook::Document document; 0040 const QString testFile = QStringLiteral(KDESRCDIR "autotests/data/rotated_cb.cbz"); 0041 QVERIFY(document.open(testFile)); 0042 0043 QVector<Okular::Page *> pagesVector; 0044 document.pages(&pagesVector); 0045 0046 const Okular::Page *p = pagesVector[0]; 0047 QVERIFY(p->height() > p->width()); 0048 0049 const QImage image = document.pageImage(0); 0050 QVERIFY(image.height() > image.width()); 0051 } 0052 0053 QTEST_MAIN(ComicBookGeneratorTest) 0054 #include "comicbooktest.moc" 0055 0056 /* kate: replace-tabs on; tab-width 4; */