[poppler] poppler/qt4/tests: check_metadata.cpp,1.3,1.4

Brad Hards bradh at freedesktop.org
Wed Dec 7 00:31:12 PST 2005


Update of /cvs/poppler/poppler/qt4/tests
In directory gabe:/tmp/cvs-serv22115/qt4/tests

Modified Files:
	check_metadata.cpp 
Log Message:
Add infoKeys() - allows you to get a list of all the string names (keys)
for the metadata.


Index: check_metadata.cpp
===================================================================
RCS file: /cvs/poppler/poppler/qt4/tests/check_metadata.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- check_metadata.cpp	6 Dec 2005 09:58:04 -0000	1.3
+++ check_metadata.cpp	7 Dec 2005 08:31:09 -0000	1.4
@@ -11,6 +11,7 @@
     void checkStrings();
     void checkStrings2_data();
     void checkStrings2();
+    void checkStringKeys();
     void checkLinearised();
     void checkNumPages();
     void checkDate();
@@ -57,6 +58,8 @@
     QTest::newRow( "Creator" ) << "Creator" << "Safari: cgpdftops CUPS filter";
     QTest::newRow( "Producer" )  << "Producer" << "Acrobat Distiller 7.0 for Macintosh";
     QTest::newRow( "Keywords" ) << "Keywords" << "First\rSecond\rthird";
+    QTest::newRow( "Custom1" ) << "Custom1" << "CustomValue1";
+    QTest::newRow( "Custom2" ) << "Custom2" << "CustomValue2";
 }
 
 void TestMetaData::checkStrings2()
@@ -70,6 +73,21 @@
     QCOMPARE( doc->info(key), value );
 }
 
+void TestMetaData::checkStringKeys()
+{
+    Poppler::Document *doc;
+    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
+    QVERIFY( doc );
+
+    QStringList keyList;
+    keyList << "Title" << "Author" << "Creator" << "Keywords" << "CreationDate";
+    keyList << "Producer" << "ModDate" << "Custom1" << "Custom2";
+    keyList.sort();
+    QStringList keysInDoc = doc->infoKeys();
+    keysInDoc.sort();
+    QCOMPARE( keysInDoc, keyList );
+}
+
 void TestMetaData::checkLinearised()
 {
     Poppler::Document *doc;



More information about the poppler mailing list