summaryrefslogtreecommitdiffstats
path: root/ksvg/test/external/printnodetest.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit47d455dd55be855e4cc691c32f687f723d9247ee (patch)
tree52e236aaa2576bdb3840ebede26619692fed6d7d /ksvg/test/external/printnodetest.cpp
downloadtdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz
tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksvg/test/external/printnodetest.cpp')
-rw-r--r--ksvg/test/external/printnodetest.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/ksvg/test/external/printnodetest.cpp b/ksvg/test/external/printnodetest.cpp
new file mode 100644
index 00000000..b2547e7f
--- /dev/null
+++ b/ksvg/test/external/printnodetest.cpp
@@ -0,0 +1,63 @@
+#include <DocumentFactory.h>
+#include <SVGSVGElement.h>
+#include <SVGDocument.h>
+#include <SVGWindow.h>
+
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+#include <kaboutdata.h>
+#include <kdebug.h>
+
+#include "printnodetest.moc"
+
+using namespace KSVG;
+
+static KCmdLineOptions options[] =
+{
+ { "+URL", I18N_NOOP("SVG file to open"), 0 },
+ KCmdLineLastOption
+};
+
+Worker::Worker(const KURL &url)
+{
+ m_doc = DocumentFactory::self()->requestDocument(this, SLOT(slotParsingFinished(bool, const QString &)));
+
+ if(!m_doc)
+ return;
+
+ if(!DocumentFactory::self()->startParsing(m_doc, url))
+ return;
+}
+
+Worker::~Worker()
+{
+ delete m_doc;
+}
+
+void Worker::slotParsingFinished(bool, const QString &)
+{
+ SVGWindow win = m_doc->window();
+ SVGSVGElement root = m_doc->rootElement();
+
+ kdDebug() << win.printNode(root).string() << endl;
+ exit(0);
+}
+
+int main(int argc, char **argv)
+{
+ KAboutData *about = new KAboutData("KSVG printNode test app", I18N_NOOP("KSVG test"), "0.1", I18N_NOOP("KSVG printNode test app"));
+ KCmdLineArgs::init(argc, argv, about);
+ KCmdLineArgs::addCmdLineOptions(options);
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ if(args->count() == 0)
+ {
+ args->usage();
+ return -1;
+ }
+
+ KApplication a(argc, argv);
+ (void) new Worker(args->url(0));
+ return a.exec();
+}
+