mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 11:40:07 +00:00
![Albert Astals Cid](/assets/img/avatar_default.png)
QLinkedList is gone from Qt6 The almost 1:1 port is std::list but we don't need iterator stability on removal/insertion so just port to QList
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2018 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#include <QTest>
|
|
|
|
#include <QMimeDatabase>
|
|
#include <QMimeType>
|
|
|
|
#include "../settings_core.h"
|
|
#include <core/document.h>
|
|
#include <core/form.h>
|
|
#include <core/page.h>
|
|
|
|
class SignatureFormTest : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private Q_SLOTS:
|
|
void initTestCase();
|
|
void cleanupTestCase();
|
|
void testSignatureForm();
|
|
|
|
private:
|
|
Okular::Document *m_document;
|
|
};
|
|
|
|
void SignatureFormTest::initTestCase()
|
|
{
|
|
Okular::SettingsCore::instance(QStringLiteral("signatureformtest"));
|
|
m_document = new Okular::Document(nullptr);
|
|
}
|
|
|
|
void SignatureFormTest::cleanupTestCase()
|
|
{
|
|
delete m_document;
|
|
}
|
|
|
|
void SignatureFormTest::testSignatureForm()
|
|
{
|
|
const QString testFile = QStringLiteral(KDESRCDIR "data/pdf_with_signature.pdf");
|
|
QMimeDatabase db;
|
|
const QMimeType mime = db.mimeTypeForFile(testFile);
|
|
QCOMPARE(m_document->openDocument(testFile, QUrl(), mime), Okular::Document::OpenSuccess);
|
|
|
|
const Okular::Page *page = m_document->page(0);
|
|
const QList<Okular::FormField *> pageFields = page->formFields();
|
|
QCOMPARE(pageFields.size(), 1);
|
|
QCOMPARE(pageFields.first()->type(), Okular::FormField::FormSignature);
|
|
|
|
Okular::FormFieldSignature *sf = static_cast<Okular::FormFieldSignature *>(pageFields.first());
|
|
QCOMPARE(sf->signatureType(), Okular::FormFieldSignature::AdbePkcs7detached);
|
|
}
|
|
|
|
QTEST_MAIN(SignatureFormTest)
|
|
#include "signatureformtest.moc"
|