From 179fa413b047bede6e32109e2ce82437c5fb8d34 Mon Sep 17 00:00:00 2001 From: MenTaLguY Date: Mon, 16 Jan 2006 02:36:01 +0000 Subject: moving trunk for module inkscape (bzr r1) --- src/extension/script/bindtest.cpp | 86 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 src/extension/script/bindtest.cpp (limited to 'src/extension/script/bindtest.cpp') diff --git a/src/extension/script/bindtest.cpp b/src/extension/script/bindtest.cpp new file mode 100644 index 000000000..97970381d --- /dev/null +++ b/src/extension/script/bindtest.cpp @@ -0,0 +1,86 @@ + +#include + +#include "InkscapeScript.h" + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +static char *pythonCodeStr = +//"\n" +//"inkscape = _inkscape_py.getInkscape()\n" +"desktop = inkscape.getDesktop()\n" +"document = desktop.getDocument()\n" +"document.hello()\n" +""; + +int testPython() +{ + Inkscape::Extension::Script::InkscapeScript scriptEngine; + printf("##### Python Test #####\n"); + printf("===== CODE ====\n%s\n==============\n", pythonCodeStr); + scriptEngine.interpretScript(pythonCodeStr, + Inkscape::Extension::Script::InkscapeScript::PYTHON); + printf("##### End Python #####\n\n"); + return TRUE; +} + +static char *perlCodeStr = +//"\n" +//"$inkscape = inkscape_perlc::getInkscape();\n" +"print \"inkscape: '$inkscape'\\n\"; \n" +"$desktop = $inkscape->getDesktop();\n" +"$document = $desktop->getDocument();\n" +"$document->hello()\n" +//"reverse 'rekcaH lreP rehtonA tsuJ'\n" +""; + +int testPerl() +{ + Inkscape::Extension::Script::InkscapeScript scriptEngine; + printf("##### Perl Test #####\n"); + printf("===== CODE ====\n%s\n==============\n", perlCodeStr); + scriptEngine.interpretScript(perlCodeStr, + Inkscape::Extension::Script::InkscapeScript::PERL); + printf("##### End Perl #####\n\n"); + return TRUE; +} + + + +int doTest() +{ + if (!testPython()) + { + printf("Failed Python test\n"); + return FALSE; + } + if (!testPerl()) + { + printf("Failed Perl test\n"); + return FALSE; + } + return TRUE; +} + + + +int main(int argc, char **argv) +{ + + if (doTest()) + printf("Tests succeeded\n"); + else + printf("Tests failed\n"); + return 0; +} + + + + + + -- cgit v1.2.3