File indexing completed on 2024-04-28 04:39:57

0001 /* AtCore Unit Tests
0002  * SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0003  * SPDX-FileCopyrightText: 2019 Chris Rizzitello <rizzitello@kde.org>
0004  */
0005 
0006 #include "beddeformtests.h"
0007 #include <QtTest>
0008 
0009 void BedDeformTests::initTestCase()
0010 {
0011     bedDeform = new BedDeform(this);
0012 }
0013 
0014 void BedDeformTests::testDecode()
0015 {
0016     QStringList temp = {QStringLiteral("echo:busy: processing"),
0017                         QStringLiteral("echo:busy: processing"),
0018                         QStringLiteral("echo:busy: processing"),
0019                         QStringLiteral("echo:busy: processing"),
0020                         QStringLiteral("echo:busy: processing"),
0021                         QStringLiteral("echo:busy: processing"),
0022                         QStringLiteral("echo:busy: processing"),
0023                         QStringLiteral("echo:busy: processing"),
0024                         QStringLiteral("echo:busy: processing"),
0025                         QStringLiteral("echo:busy: processing"),
0026                         QStringLiteral("echo:busy: processing"),
0027                         QStringLiteral("Bilinear Leveling Grid:"),
0028                         QStringLiteral("0      1      2"),
0029                         QStringLiteral("0 +0.255 +0.225 -0.038"),
0030                         QStringLiteral("1 +0.060 +0.008 -0.255"),
0031                         QStringLiteral("2 -0.153 -0.245 -0.528"),
0032                         QString(),
0033                         QStringLiteral("X:155.00 Y:185.00 Z:12.23 E:0.00 Count X:12400 Y:14800 Z:4720"),
0034                         QStringLiteral("ok")};
0035     bedDeform->decodeDeform(temp);
0036     QVERIFY(bedDeform->bedDeformationGrid().at(0).toList().at(0).toDouble() == 0.255);
0037     QVERIFY(bedDeform->bedDeformationGrid().at(0).toList().at(1).toDouble() == 0.225);
0038     QVERIFY(bedDeform->bedDeformationGrid().at(0).toList().at(2).toDouble() == -0.038);
0039     QVERIFY(bedDeform->bedDeformationGrid().at(1).toList().at(0).toDouble() == 0.060);
0040     QVERIFY(bedDeform->bedDeformationGrid().at(1).toList().at(1).toDouble() == 0.008);
0041     QVERIFY(bedDeform->bedDeformationGrid().at(1).toList().at(2).toDouble() == -0.255);
0042     QVERIFY(bedDeform->bedDeformationGrid().at(2).toList().at(0).toDouble() == -0.153);
0043     QVERIFY(bedDeform->bedDeformationGrid().at(2).toList().at(1).toDouble() == -0.245);
0044     QVERIFY(bedDeform->bedDeformationGrid().at(2).toList().at(2).toDouble() == -0.528);
0045 }
0046 
0047 QTEST_MAIN(BedDeformTests)