summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ProgressWidget.cc5
-rw-r--r--src/ProgressWidget.h1
-rw-r--r--src/func.cc2
-rw-r--r--src/mainwin.cc3
-rw-r--r--src/value.cc5
-rw-r--r--testdata/scad/misc/echo-tests.scad (renamed from testdata/scad/features/echo-tests.scad)2
-rw-r--r--tests/CMakeLists.txt2
-rw-r--r--tests/regression/dumptest/echo-tests-expected.txt9
-rw-r--r--tests/regression/echotest/echo-tests-expected.txt1
9 files changed, 16 insertions, 14 deletions
diff --git a/src/ProgressWidget.cc b/src/ProgressWidget.cc
index a386192..112e239 100644
--- a/src/ProgressWidget.cc
+++ b/src/ProgressWidget.cc
@@ -29,3 +29,8 @@ void ProgressWidget::setValue(int progress)
{
this->progressBar->setValue(progress);
}
+
+int ProgressWidget::value() const
+{
+ return this->progressBar->value();
+}
diff --git a/src/ProgressWidget.h b/src/ProgressWidget.h
index 715272b..83e4d40 100644
--- a/src/ProgressWidget.h
+++ b/src/ProgressWidget.h
@@ -15,6 +15,7 @@ public:
public slots:
void setRange(int minimum, int maximum);
void setValue(int progress);
+ int value() const;
void cancel();
signals:
diff --git a/src/func.cc b/src/func.cc
index a9d5948..4451267 100644
--- a/src/func.cc
+++ b/src/func.cc
@@ -311,7 +311,7 @@ Value builtin_str(const Context *, const std::vector<std::string>&, const std::v
std::stringstream stream;
for (size_t i = 0; i < args.size(); i++) {
- stream << args[i];
+ stream << args[i].toString();
}
return Value(stream.str());
}
diff --git a/src/mainwin.cc b/src/mainwin.cc
index a6f5be6..22fb82c 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -433,7 +433,8 @@ static void report_func(const class AbstractNode*, void *vp, int mark)
#ifdef USE_PROGRESSWIDGET
ProgressWidget *pw = static_cast<ProgressWidget*>(vp);
int v = (int)((mark*100.0) / progress_report_count);
- pw->setValue(v < 100 ? v : 99);
+ int percent = v < 100 ? v : 99;
+ if (percent > pw->value()) pw->setValue(percent);
QApplication::processEvents();
if (pw->wasCanceled()) throw ProgressCancelException();
#else
diff --git a/src/value.cc b/src/value.cc
index e08b2d8..ab78c2a 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -343,7 +343,7 @@ std::string Value::toString() const
switch (this->type) {
case STRING:
- stream << '"' << this->text << '"';
+ stream << this->text;
break;
case VECTOR:
stream << '[';
@@ -411,7 +411,8 @@ void Value::append(Value *val)
std::ostream &operator<<(std::ostream &stream, const Value &value)
{
- stream << value.toString();
+ if (value.type == Value::STRING) stream << QuotedString(value.toString());
+ else stream << value.toString();
return stream;
}
diff --git a/testdata/scad/features/echo-tests.scad b/testdata/scad/misc/echo-tests.scad
index b07d444..c42a67e 100644
--- a/testdata/scad/features/echo-tests.scad
+++ b/testdata/scad/misc/echo-tests.scad
@@ -10,3 +10,5 @@ echo(r);
echo(vec = [1,2,3]);
echo(range = [0:2]);
+
+echo(str("string generated by str()"));
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 4693a0b..81c2faf 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -385,7 +385,7 @@ list(REMOVE_ITEM DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../examples/example021.scad)
list(APPEND ECHO_FILES
${CMAKE_SOURCE_DIR}/../testdata/scad/minimal/echo.scad
- ${CMAKE_SOURCE_DIR}/../testdata/scad/features/echo-tests.scad
+ ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/echo-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/escape-test.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/parser-tests.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/misc/builtin-tests.scad)
diff --git a/tests/regression/dumptest/echo-tests-expected.txt b/tests/regression/dumptest/echo-tests-expected.txt
deleted file mode 100644
index 98a9bd9..0000000
--- a/tests/regression/dumptest/echo-tests-expected.txt
+++ /dev/null
@@ -1,9 +0,0 @@
- group();
- group();
- group();
- group();
- group();
- group();
- group();
- group();
-
diff --git a/tests/regression/echotest/echo-tests-expected.txt b/tests/regression/echotest/echo-tests-expected.txt
index cc548f6..ee9705f 100644
--- a/tests/regression/echotest/echo-tests-expected.txt
+++ b/tests/regression/echotest/echo-tests-expected.txt
@@ -6,3 +6,4 @@ ECHO: [1, "vecstr", 2.34, false]
ECHO: [1 : 2 : 10]
ECHO: vec = [1, 2, 3]
ECHO: range = [0 : 1 : 2]
+ECHO: "string generated by str()"
contact: Jan Huwald // Impressum