diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cgalpngtest.cc | 21 | ||||
-rw-r--r-- | tests/cgaltest.cc | 18 | ||||
-rw-r--r-- | tests/csgtermtest.cc | 19 | ||||
-rw-r--r-- | tests/csgtestcore.cc | 15 | ||||
-rw-r--r-- | tests/csgtexttest.cc | 17 | ||||
-rw-r--r-- | tests/dumptest.cc | 21 | ||||
-rw-r--r-- | tests/echotest.cc | 17 |
7 files changed, 61 insertions, 67 deletions
diff --git a/tests/cgalpngtest.cc b/tests/cgalpngtest.cc index 59f0d53..7aa740d 100644 --- a/tests/cgalpngtest.cc +++ b/tests/cgalpngtest.cc @@ -26,6 +26,7 @@ #include "tests-common.h" #include "openscad.h" +#include "parsersettings.h" #include "node.h" #include "module.h" #include "polyset.h" @@ -43,10 +44,6 @@ #include "OffscreenView.h" #include <QApplication> -#include <QFile> -#include <QDir> -#include <QSet> -#include <QTextStream> #ifndef _MSC_VER #include <getopt.h> #endif @@ -54,8 +51,11 @@ #include <assert.h> #include <sstream> +#include <boost/filesystem.hpp> +namespace fs = boost::filesystem; + std::string commandline_commands; -QString currentdir; +std::string currentdir; QString examplesdir; using std::string; @@ -106,9 +106,11 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); QApplication app(argc, argv, false); - QDir original_path = QDir::current(); + fs::path original_path = fs::current_path(); + + currentdir = fs::current_path().generic_string(); - currentdir = QDir::currentPath(); + parser_init(); Context root_ctx; register_builtin(root_ctx); @@ -121,8 +123,7 @@ int main(int argc, char **argv) exit(1); } - QFileInfo fileInfo(filename); - QDir::setCurrent(fileInfo.absolutePath()); + fs::current_path(fs::path(filename).parent_path()); AbstractNode::resetIndexCounter(); AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); @@ -138,7 +139,7 @@ int main(int argc, char **argv) CGAL_Nef_polyhedron N = cgalevaluator.evaluateCGALMesh(*root_node); - QDir::setCurrent(original_path.absolutePath()); + current_path(original_path); // match with csgtest ends try { diff --git a/tests/cgaltest.cc b/tests/cgaltest.cc index 6412338..8bdf417 100644 --- a/tests/cgaltest.cc +++ b/tests/cgaltest.cc @@ -39,10 +39,6 @@ #include "PolySetCGALEvaluator.h" #include <QApplication> -#include <QFile> -#include <QDir> -#include <QSet> -#include <QTextStream> #ifndef _MSC_VER #include <getopt.h> #endif @@ -50,8 +46,11 @@ #include <assert.h> #include <sstream> +#include <boost/filesystem.hpp> +namespace fs = boost::filesystem; + std::string commandline_commands; -QString currentdir; +std::string currentdir; QString examplesdir; using std::string; @@ -86,9 +85,9 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); QApplication app(argc, argv, false); - QDir original_path = QDir::current(); + fs::path original_path = fs::current_path(); - currentdir = QDir::currentPath(); + currentdir = fs::current_path().generic_string(); parser_init(); @@ -103,8 +102,7 @@ int main(int argc, char **argv) exit(1); } - QFileInfo fileInfo(filename); - QDir::setCurrent(fileInfo.absolutePath()); + fs::current_path(fs::path(filename).parent_path()); AbstractNode::resetIndexCounter(); AbstractNode *absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); @@ -119,7 +117,7 @@ int main(int argc, char **argv) CGAL_Nef_polyhedron N = cgalevaluator.evaluateCGALMesh(*root_node); - QDir::setCurrent(original_path.absolutePath()); + current_path(original_path); if (!N.empty()) { export_stl(&N, std::cout, NULL); } diff --git a/tests/csgtermtest.cc b/tests/csgtermtest.cc index 52e55c4..7fae3fb 100644 --- a/tests/csgtermtest.cc +++ b/tests/csgtermtest.cc @@ -39,9 +39,6 @@ #include "csgterm.h" #include <QApplication> -#include <QFile> -#include <QDir> -#include <QSet> #ifndef _MSC_VER #include <getopt.h> #endif @@ -50,12 +47,15 @@ #include <sstream> #include <fstream> -using std::cout; +#include <boost/filesystem.hpp> +namespace fs = boost::filesystem; std::string commandline_commands; -QString currentdir; +std::string currentdir; QString examplesdir; +using std::cout; + int main(int argc, char **argv) { if (argc != 3) { @@ -71,9 +71,9 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); QApplication app(argc, argv, false); - QDir original_path = QDir::current(); + fs::path original_path = fs::current_path(); - currentdir = QDir::currentPath(); + currentdir = fs::current_path().generic_string(); parser_init(); @@ -89,8 +89,7 @@ int main(int argc, char **argv) exit(1); } - QFileInfo fileInfo(filename); - QDir::setCurrent(fileInfo.absolutePath()); + fs::current_path(fs::path(filename).parent_path()); AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); @@ -115,7 +114,7 @@ int main(int argc, char **argv) // if (evaluator.background) cout << "Background terms: " << evaluator.background->size() << "\n"; // if (evaluator.highlights) cout << "Highlights terms: " << evaluator.highlights->size() << "\n"; - QDir::setCurrent(original_path.absolutePath()); + current_path(original_path); std::ofstream outfile; outfile.open(outfilename); if (root_term) { diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index 7ad0a35..4cb612a 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -23,16 +23,16 @@ #include "OffscreenView.h" #include <QApplication> -#include <QFile> -#include <QDir> -#include <QSet> #include <QTimer> #include <sstream> #include <vector> #include <boost/program_options.hpp> +#include <boost/filesystem.hpp> + namespace po = boost::program_options; +namespace fs = boost::filesystem; using std::string; using std::vector; @@ -251,9 +251,9 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) QApplication app(argc, argv, false); - QDir original_path = QDir::current(); + fs::path original_path = fs::current_path(); - QString currentdir = QDir::currentPath(); + std::string currentdir = fs::current_path().generic_string(); parser_init(); @@ -273,8 +273,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) } if (!sysinfo_dump) { - QFileInfo fileInfo(filename); - QDir::setCurrent(fileInfo.absolutePath()); + fs::current_path(fs::path(filename).parent_path()); } AbstractNode::resetIndexCounter(); @@ -339,7 +338,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) } } - QDir::setCurrent(original_path.absolutePath()); + fs::current_path(original_path); try { csgInfo.glview = new OffscreenView(512,512); diff --git a/tests/csgtexttest.cc b/tests/csgtexttest.cc index 2c54ed4..d0d27ce 100644 --- a/tests/csgtexttest.cc +++ b/tests/csgtexttest.cc @@ -38,9 +38,6 @@ #include "Tree.h" #include <QApplication> -#include <QFile> -#include <QDir> -#include <QSet> #ifndef _MSC_VER #include <getopt.h> #endif @@ -49,8 +46,11 @@ #include <sstream> #include <fstream> +#include <boost/filesystem.hpp> +namespace fs = boost::filesystem; + std::string commandline_commands; -QString currentdir; +std::string currentdir; QString examplesdir; void csgTree(CSGTextCache &cache, const AbstractNode &root) @@ -75,9 +75,9 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); QApplication app(argc, argv, false); - QDir original_path = QDir::current(); + fs::path original_path = fs::current_path(); - currentdir = QDir::currentPath(); + currentdir = fs::current_path().generic_string(); parser_init(); @@ -93,8 +93,7 @@ int main(int argc, char **argv) exit(1); } - QFileInfo fileInfo(filename); - QDir::setCurrent(fileInfo.absolutePath()); + fs::current_path(fs::path(filename).parent_path()); AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); @@ -106,7 +105,7 @@ int main(int argc, char **argv) csgTree(csgcache, *root_node); // std::cout << tree.getString(*root_node) << "\n"; - QDir::setCurrent(original_path.absolutePath()); + current_path(original_path); std::ofstream outfile; outfile.open(outfilename); outfile << csgcache[*root_node] << "\n"; diff --git a/tests/dumptest.cc b/tests/dumptest.cc index 4b1d907..bc48011 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -36,9 +36,6 @@ #include "Tree.h" #include <QApplication> -#include <QFile> -#include <QDir> -#include <QSet> #ifndef _MSC_VER #include <getopt.h> #endif @@ -47,12 +44,15 @@ #include <sstream> #include <fstream> -using std::string; +#include <boost/filesystem.hpp> +namespace fs = boost::filesystem; std::string commandline_commands; -QString currentdir; +std::string currentdir; QString examplesdir; +using std::string; + string dumptree(const Tree &tree, const AbstractNode &node) { std::stringstream str; @@ -82,9 +82,9 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); QApplication app(argc, argv, false); - QDir original_path = QDir::current(); + fs::path original_path = fs::current_path(); - currentdir = QDir::currentPath(); + currentdir = fs::current_path().generic_string(); parser_init(); @@ -100,8 +100,7 @@ int main(int argc, char **argv) exit(1); } - QFileInfo fileInfo(filename); - QDir::setCurrent(fileInfo.absolutePath()); + fs::current_path(fs::path(filename).parent_path()); AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); @@ -116,7 +115,7 @@ int main(int argc, char **argv) exit(1); } - QDir::setCurrent(original_path.absolutePath()); + fs::current_path(original_path); std::ofstream outfile; outfile.open(outfilename); outfile << dumpstdstr << "\n"; @@ -130,7 +129,7 @@ int main(int argc, char **argv) fprintf(stderr, "Error: Unable to read back dumped file\n"); exit(1); } - QDir::setCurrent(fileInfo.absolutePath()); + fs::current_path(original_path); AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); diff --git a/tests/echotest.cc b/tests/echotest.cc index 9569f09..7f05149 100644 --- a/tests/echotest.cc +++ b/tests/echotest.cc @@ -35,9 +35,6 @@ #include "printutils.h" #include <QApplication> -#include <QFile> -#include <QDir> -#include <QSet> #ifndef _MSC_VER #include <getopt.h> #endif @@ -46,12 +43,15 @@ #include <sstream> #include <fstream> -using std::string; +#include <boost/filesystem.hpp> +namespace fs = boost::filesystem; std::string commandline_commands; -QString currentdir; +std::string currentdir; QString examplesdir; +using std::string; + static void outfile_handler(const std::string &msg, void *userdata) { std::ostream *str = static_cast<std::ostream*>(userdata); *str << msg << std::endl; @@ -83,9 +83,9 @@ int main(int argc, char **argv) Builtins::instance()->initialize(); QApplication app(argc, argv, false); - QDir original_path = QDir::current(); + fs::path original_path = fs::current_path(); - currentdir = QDir::currentPath(); + currentdir = fs::current_path().generic_string(); parser_init(); @@ -101,8 +101,7 @@ int main(int argc, char **argv) exit(1); } - QFileInfo fileInfo(filename); - QDir::setCurrent(fileInfo.absolutePath()); + fs::current_path(fs::path(filename).parent_path()); AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); |