diff options
author | Marius Kintel <marius@kintel.net> | 2013-05-24 14:16:20 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-05-24 14:16:20 (GMT) |
commit | 26046f6f0c4a774cbbb2af8ae7dc0e687963440c (patch) | |
tree | 38ff04fc460e8aa55134fb1ee6167fafb90a3423 /tests/csgtestcore.cc | |
parent | eefcd6d0b271642d470cd55bc47d1579d943938e (diff) | |
parent | 95e399e06c6522f3fa67679808a1d52815368efa (diff) |
Merge branch 'master' into epec-kernel
Diffstat (limited to 'tests/csgtestcore.cc')
-rw-r--r-- | tests/csgtestcore.cc | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index 7583a41..7b9dbab 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -6,7 +6,7 @@ #include "openscad.h" #include "parsersettings.h" #include "builtin.h" -#include "context.h" +#include "modcontext.h" #include "node.h" #include "module.h" #include "polyset.h" @@ -23,9 +23,6 @@ #include "csgtermnormalizer.h" #include "OffscreenView.h" -#include <QCoreApplication> -#include <QTimer> - #include <sstream> #include <vector> @@ -128,20 +125,18 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) Builtins::instance()->initialize(); - QCoreApplication app(argc, argv); - fs::path original_path = fs::current_path(); std::string currentdir = boosty::stringy( fs::current_path() ); - parser_init(QCoreApplication::instance()->applicationDirPath().toStdString()); - add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries")); + parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); + add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext top_ctx; + top_ctx.registerBuiltin(); - AbstractModule *root_module; - ModuleInstantiation root_inst; + FileModule *root_module; + ModuleInstantiation root_inst("group"); if (sysinfo_dump) root_module = parse("sphere();","",false); @@ -153,13 +148,14 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) } if (!sysinfo_dump) { - if (fs::path(filename).has_parent_path()) { - fs::current_path(fs::path(filename).parent_path()); - } + fs::path fpath = boosty::absolute(fs::path(filename)); + fs::path fparent = fpath.parent_path(); + fs::current_path(fparent); + top_ctx.setDocumentPath(fparent.string()); } AbstractNode::resetIndexCounter(); - AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); + AbstractNode *absolute_root_node = root_module->instantiate(&top_ctx, &root_inst); AbstractNode *root_node; // Do we have an explicit root node (! modifier)? if (!(root_node = find_root_tag(absolute_root_node))) root_node = absolute_root_node; |