[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [atcore] /: Remove spaces from translated commands and update Grbl Tests
From:       Chris Rizzitello <null () kde ! org>
Date:       2018-06-01 1:09:13
Message-ID: E1fOYZ7-0003iD-4t () code ! kde ! org
[Download RAW message or body]

Git commit 5a74542056182267961c97e14c207ea2c69592ce by Chris Rizzitello.
Committed on 01/06/2018 at 00:58.
Pushed by rizzitello into branch 'master'.

Remove spaces from translated commands and update Grbl Tests

Signed-off-by: Chris Rizzitello <rizzitello@kde.org>

M  +1    -0    src/plugins/grblplugin.cpp
M  +10   -1    unittests/atcoretests.cpp
M  +1    -0    unittests/atcoretests.h

https://commits.kde.org/atcore/5a74542056182267961c97e14c207ea2c69592ce

diff --git a/src/plugins/grblplugin.cpp b/src/plugins/grblplugin.cpp
index 1e09bda..2aa0bbf 100644
--- a/src/plugins/grblplugin.cpp
+++ b/src/plugins/grblplugin.cpp
@@ -61,6 +61,7 @@ QByteArray GrblPlugin::translate(const QString &command)
             QRegularExpressionMatch t = commandMatch.next();
             temp.append(t.captured());
             if (commandMatch.hasNext()) {
+                temp = temp.simplified();
                 temp.append(QStringLiteral("\r\n"));
             }
         }
diff --git a/unittests/atcoretests.cpp b/unittests/atcoretests.cpp
index fec3ef9..64f64f5 100644
--- a/unittests/atcoretests.cpp
+++ b/unittests/atcoretests.cpp
@@ -86,7 +86,16 @@ void AtCoreTests::testPluginGrbl_validate()
     QVERIFY(sSpy.isValid() == true);
     core->firmwarePlugin()->validateCommand(QStringLiteral("ok"));
     core->firmwarePlugin()->validateCommand(QStringLiteral("other text"));
-    QVERIFY(sSpy.count() == 2);
+    QVERIFY(sSpy.count() == 1);
+}
+
+void AtCoreTests::testPluginGrbl_translate()
+{
+    QVERIFY(core->firmwarePlugin()->translate(QStringLiteral("G28")) == "G28");
+    QVERIFY(core->firmwarePlugin()->translate(QStringLiteral("M104 S50 G28 X")) == \
"M104 S50\r\nG28 X"); +    \
QVERIFY(core->firmwarePlugin()->translate(QStringLiteral("G00 G43 H0  Z0.1")) == \
"G00\r\nG43 H0  Z0.1"); +    \
QVERIFY(core->firmwarePlugin()->translate(QStringLiteral("M6 T0")) == "M6 T0"); +
 }
 
 void AtCoreTests::testPluginMarlin_load()
diff --git a/unittests/atcoretests.h b/unittests/atcoretests.h
index a993cd6..8576694 100644
--- a/unittests/atcoretests.h
+++ b/unittests/atcoretests.h
@@ -34,6 +34,7 @@ private slots:
     void testPluginAprinter_validate();
     void testPluginGrbl_load();
     void testPluginGrbl_validate();
+    void testPluginGrbl_translate();
     void testPluginMarlin_load();
     void testPluginMarlin_validate();
     void testPluginRepetier_load();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic