[poppler] 2 commits - poppler/Gfx.cc qt4/tests

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Jun 30 15:44:31 PDT 2008


 poppler/Gfx.cc                 |   10 +---------
 qt4/tests/CMakeLists.txt       |    1 +
 qt4/tests/check_actualtext.cpp |   33 +++++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 9 deletions(-)

New commits:
commit 5ed2503003d973b5461594af15485af49591451d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Jul 1 00:43:26 2008 +0200

    unittesting about ActualText

diff --git a/qt4/tests/CMakeLists.txt b/qt4/tests/CMakeLists.txt
index bd8512c..0dffb89 100644
--- a/qt4/tests/CMakeLists.txt
+++ b/qt4/tests/CMakeLists.txt
@@ -53,3 +53,4 @@ qt4_add_qtest(check_pagemode check_pagemode.cpp)
 qt4_add_qtest(check_password check_password.cpp)
 qt4_add_qtest(check_permissions check_permissions.cpp)
 qt4_add_qtest(check_search check_search.cpp)
+qt4_add_qtest(check_actualtext check_actualtext.cpp)
diff --git a/qt4/tests/check_actualtext.cpp b/qt4/tests/check_actualtext.cpp
new file mode 100644
index 0000000..64fae8f
--- /dev/null
+++ b/qt4/tests/check_actualtext.cpp
@@ -0,0 +1,33 @@
+#include <QtTest/QtTest>
+
+#include <poppler-qt4.h>
+
+#include <QtCore/QFile>
+
+class TestActualText: public QObject
+{
+    Q_OBJECT
+private slots:
+    void checkActualText1();
+};
+
+void TestActualText::checkActualText1()
+{
+    Poppler::Document *doc;
+    doc = Poppler::Document::load("../../../test/unittestcases/WithActualText.pdf");
+    QVERIFY( doc );
+
+    Poppler::Page *page = doc->page(0);
+    QVERIFY( page );
+
+    QCOMPARE( page->text(QRectF()), QString("The slow brown fox jumps over the black dog.") );
+
+    delete page;
+
+    delete doc;
+}
+
+QTEST_MAIN(TestActualText)
+
+#include "check_actualtext.moc"
+
commit f3bb2eb556f5248242f6db85052ef045fcb697c6
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Jul 1 00:41:35 2008 +0200

    Unbreak ActualText extraction

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 1841873..41ccdb7 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -4130,11 +4130,9 @@ void Gfx::opEndIgnoreUndef(Object args[], int numArgs) {
 void Gfx::opBeginMarkedContent(Object args[], int numArgs) {
   // TODO: we really need to be adding this to the markedContentStack
   OCGs *contentConfig = catalog->getOptContentConfig();
-  if (!contentConfig)
-    return;
 	
   char* name0 = args[0].getName();
-  if ( strncmp( name0, "OC", 2) == 0 ) {
+  if ( strncmp( name0, "OC", 2) == 0 && contentConfig) {
     if ( numArgs >= 2 ) {
       if (!args[1].isName()) {
 	error(getPos(), "Unexpected MC Type: %i", args[1].getType());
@@ -4172,17 +4170,11 @@ void Gfx::opBeginMarkedContent(Object args[], int numArgs) {
 
 void Gfx::opEndMarkedContent(Object args[], int numArgs) {
   // TODO: we should turn this off based on the markedContentStack
-  if (!catalog->getOptContentConfig())
-    return;
-  
   ocSuppressed = false;
   out->endMarkedContent(state);
 }
 
 void Gfx::opMarkPoint(Object args[], int numArgs) {
-  if (!catalog->getOptContentConfig())
-    return;
-  
   if (printCommands) {
     printf("  mark point: %s ", args[0].getName());
     if (numArgs == 2)


More information about the poppler mailing list