summaryrefslogtreecommitdiff
path: root/tests/csgtestcore.cc
diff options
context:
space:
mode:
authorDon Bright <hugh.m.bright@gmail.com>2011-11-06 14:26:59 (GMT)
committerDon Bright <hugh.m.bright@gmail.com>2011-11-06 14:26:59 (GMT)
commit31a97f34e1122690cbad2c9bf01f3ede6d3da135 (patch)
treed34435cb6eada42b83aed18a9e83083b43efd8cb /tests/csgtestcore.cc
parent9ab95e6d7230dc5deb06a8e6e3f647e8b48b87c6 (diff)
parenta221eeee99ca772605c0ac6473cae2466e4cc07a (diff)
Merge remote branch 'upstream/master'
Diffstat (limited to 'tests/csgtestcore.cc')
-rw-r--r--tests/csgtestcore.cc30
1 files changed, 7 insertions, 23 deletions
diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc
index 8460a59..57e397e 100644
--- a/tests/csgtestcore.cc
+++ b/tests/csgtestcore.cc
@@ -1,9 +1,9 @@
// csg test core, used by throwntegether test and opencsg test
#include "csgtestcore.h"
+#include "tests-common.h"
#include "system-gl.h"
#include "openscad.h"
-#include "handle_dep.h"
#include "builtin.h"
#include "context.h"
#include "node.h"
@@ -74,8 +74,8 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
exit(1);
}
- std::string filename(argv[1]);
- std::string outfile(argv[2]);
+ const char *filename = argv[1];
+ const char *outfilename = argv[2];
initialize_builtin_functions();
initialize_builtin_modules();
@@ -111,28 +111,12 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
AbstractModule *root_module;
ModuleInstantiation root_inst;
- QFileInfo fileInfo(filename.c_str());
- handle_dep(filename);
- FILE *fp = fopen(filename.c_str(), "rt");
- if (!fp) {
- fprintf(stderr, "Can't open input file `%s'!\n", filename.c_str());
+ root_module = parsefile(filename);
+ if (!root_module) {
exit(1);
- } else {
- std::stringstream text;
- char buffer[513];
- int ret;
- while ((ret = fread(buffer, 1, 512, fp)) > 0) {
- buffer[ret] = 0;
- text << buffer;
- }
- fclose(fp);
- text << commandline_commands;
- root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false);
- if (!root_module) {
- exit(1);
- }
}
+ QFileInfo fileInfo(filename);
QDir::setCurrent(fileInfo.absolutePath());
AbstractNode::resetIndexCounter();
@@ -231,7 +215,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
csgInfo.glview->paintGL();
- csgInfo.glview->save(outfile.c_str());
+ csgInfo.glview->save(outfilename);
destroy_builtin_functions();
destroy_builtin_modules();
contact: Jan Huwald // Impressum