[poppler] qt5/src qt5/tests
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Jan 5 23:35:54 UTC 2020
qt5/src/poppler-form.cc | 2 +-
qt5/tests/check_forms.cpp | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
New commits:
commit dd0ea681efc1e0a476803be1260f7a7691c26534
Author: David García Garzón <david.garcia at upf.edu>
Date: Sun Jan 5 23:35:51 2020 +0000
qt5: Fix FormField::name encoding
Also add a test for it
diff --git a/qt5/src/poppler-form.cc b/qt5/src/poppler-form.cc
index 26b583ba..cab25af6 100644
--- a/qt5/src/poppler-form.cc
+++ b/qt5/src/poppler-form.cc
@@ -147,7 +147,7 @@ QString FormField::name() const
QString name;
if (const GooString *goo = m_formData->fm->getPartialName())
{
- name = QString::fromLatin1(goo->c_str());
+ name = UnicodeParsedString(goo);
}
return name;
}
diff --git a/qt5/tests/check_forms.cpp b/qt5/tests/check_forms.cpp
index ac60fdc4..fb7c3baf 100644
--- a/qt5/tests/check_forms.cpp
+++ b/qt5/tests/check_forms.cpp
@@ -16,6 +16,7 @@ private slots:
void testSetIcon();// Test that setIcon will always be valid.
void testSetPrintable();
void testSetAppearanceText();
+ void testUnicodeFieldAttributes();
};
void TestForms::testCheckbox()
@@ -208,5 +209,22 @@ void TestForms::testSetAppearanceText()
QCOMPARE( nTextForms, 5 );
}
+void TestForms::testUnicodeFieldAttributes()
+{
+ QScopedPointer< Poppler::Document > document(Poppler::Document::load(TESTDATADIR "/unittestcases/fieldWithUtf16Names.pdf"));
+ QVERIFY( document );
+
+ QScopedPointer< Poppler::Page > page(document->page(0));
+ QVERIFY( page );
+
+ QList<Poppler::FormField*> forms = page->formFields();
+
+ Poppler::FormField * field = forms.first();
+
+ QCOMPARE(field->name(), QStringLiteral("Tex"));
+ QCOMPARE(field->uiName(), QStringLiteral("Texto de ayuda"));
+}
+
+
QTEST_GUILESS_MAIN(TestForms)
#include "check_forms.moc"
More information about the poppler
mailing list