From d43e28f192d1044daaf9e2cbfefd94dd43e94953 Mon Sep 17 00:00:00 2001 From: Ulrich Huber Date: Tue, 20 Aug 2019 13:00:30 +0200 Subject: [PATCH] Fix ambiguous use of abs --- test/control/LoadHandlerTest.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/control/LoadHandlerTest.cpp b/test/control/LoadHandlerTest.cpp index eed1ff39..90329846 100644 --- a/test/control/LoadHandlerTest.cpp +++ b/test/control/LoadHandlerTest.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include class LoadHandlerTest : public CppUnit::TestFixture { @@ -366,7 +366,7 @@ public: // Check that the coordinates from both files don't differ more than the precision they were saved with auto coordEq = [](double a, double b) { return std::abs(a - b) <= 1e-8; }; - for (int i = 0; i < elements1->size(); i++) + for (unsigned long i = 0; i < elements1->size(); i++) { Element* a = elements1->at(i); Element* b = elements2->at(i); @@ -380,16 +380,16 @@ public: { case ELEMENT_STROKE: { - Stroke* sA = dynamic_cast(a); - Stroke* sB = dynamic_cast(b); + auto sA = dynamic_cast(a); + auto sB = dynamic_cast(b); CPPUNIT_ASSERT_EQUAL(sA->getPointCount(), sB->getPointCount()); CPPUNIT_ASSERT_EQUAL(sA->getToolType(), sB->getToolType()); CPPUNIT_ASSERT_EQUAL(sA->getLineStyle().hasDashes(), sB->getLineStyle().hasDashes()); CPPUNIT_ASSERT(coordEq(sA->getAvgPressure(), sB->getAvgPressure())); - for (int i = 0; i < sA->getPointCount(); i++) + for (int j = 0; j < sA->getPointCount(); j++) { - Point pA = sA->getPoint(i); - Point pB = sB->getPoint(i); + Point pA = sA->getPoint(j); + Point pB = sB->getPoint(j); CPPUNIT_ASSERT(coordEq(pA.x, pB.x)); CPPUNIT_ASSERT(coordEq(pA.y, pB.y)); CPPUNIT_ASSERT(coordEq(pA.z, pB.z)); @@ -398,8 +398,8 @@ public: } case ELEMENT_TEXT: { - Text* tA = dynamic_cast(a); - Text* tB = dynamic_cast(b); + auto tA = dynamic_cast(a); + auto tB = dynamic_cast(b); CPPUNIT_ASSERT_EQUAL(tA->getText(), tB->getText()); CPPUNIT_ASSERT_EQUAL(tA->getFont().getSize(), tB->getFont().getSize()); break;