summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulien Rebetez <julien@fhtagn.net>2008-01-19 13:02:17 +0100
committerAlbert Astals Cid <tsdgeos@bluebox.localdomain>2008-01-19 13:02:17 +0100
commita20468cc38bb590124b2b028a08f364f90f2487f (patch)
tree7f539d171a18135803b05c793404afdebe980497 /test
parent246294714c6011651fd0e5b3649bd65919058c72 (diff)
Adds a test application to test full rewrite functionnality.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am11
-rw-r--r--test/pdf-fullrewrite.cc44
2 files changed, 54 insertions, 1 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index df1809a2..d46b988e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -33,6 +33,9 @@ perf_test = \
endif
+pdf_fullrewrite = \
+ pdf-fullrewrite
+
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/poppler \
@@ -42,7 +45,7 @@ INCLUDES = \
$(GTK_TEST_CFLAGS) \
$(FONTCONFIG_CFLAGS)
-noinst_PROGRAMS = $(gtk_splash_test) $(gtk_cairo_test) $(pdf_inspector) $(perf_test)
+noinst_PROGRAMS = $(gtk_splash_test) $(gtk_cairo_test) $(pdf_inspector) $(perf_test) $(pdf_fullrewrite)
gtk_splash_test_SOURCES = \
gtk-splash-test.cc
@@ -79,5 +82,11 @@ perf_test_LDADD = \
$(top_builddir)/poppler/libpoppler.la \
$(FREETYPE_LIBS)
+pdf_fullrewrite_SOURCES = \
+ pdf-fullrewrite.cc
+
+pdf_fullrewrite_LDADD = \
+ $(top_builddir)/poppler/libpoppler.la
+
EXTRA_DIST = \
pdf-operators.c
diff --git a/test/pdf-fullrewrite.cc b/test/pdf-fullrewrite.cc
new file mode 100644
index 00000000..b782bc40
--- /dev/null
+++ b/test/pdf-fullrewrite.cc
@@ -0,0 +1,44 @@
+//========================================================================
+//
+// pdf-fullrewrite.cc
+//
+// Copyright 2007 Julien Rebetez
+//
+//========================================================================
+#include "config.h"
+#include <poppler-config.h>
+#include "GlobalParams.h"
+#include "Error.h"
+#include "PDFDoc.h"
+#include "goo/GooString.h"
+
+int main (int argc, char *argv[])
+{
+ PDFDoc *doc;
+ GooString *inputName, *outputName;
+
+ // parse args
+ if (argc < 3) {
+ fprintf(stderr, "usage: %s INPUT-FILE OUTPUT-FILE\n", argv[0]);
+ return 1;
+ }
+
+ inputName = new GooString(argv[1]);
+ outputName = new GooString(argv[2]);
+
+ globalParams = new GlobalParams();
+
+ doc = new PDFDoc(inputName);
+
+ if (!doc->isOk()) {
+ delete doc;
+ fprintf(stderr, "Error loading document !\n");
+ return 1;
+ }
+
+
+ doc->saveAs(outputName, writeForceRewrite);
+
+ delete doc;
+ delete globalParams;
+}