GCC warnings. Fixed broken tests.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-02-28 22:00:45 +02:00
parent 33b6256896
commit 018fd88f25
3 changed files with 14 additions and 4 deletions

View File

@ -198,12 +198,12 @@ QPointF VEllipticalArc::GetPoint (qreal angle) const
{
y = -y;
}
else if (angle == 90)
else if (qFuzzyCompare(angle, 90))
{
x = 0;
y = d->radius2;
}
else if (angle == 270)
else if (qFuzzyCompare(angle, 270))
{
x = 0;
y = -d->radius2;

View File

@ -5,6 +5,11 @@
#include "../vmisc/vabstractapplication.h"
#include "vpointf.h"
#ifdef Q_CC_GNU
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#endif
class VEllipticalArcData : public QSharedData
{
public:
@ -86,5 +91,9 @@ private:
VEllipticalArcData::~VEllipticalArcData()
{}
#ifdef Q_CC_GNU
#pragma GCC diagnostic pop
#endif
#endif // VELLIPTICALARC_P

View File

@ -29,6 +29,7 @@
#include "tst_vellipticalarc.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vlayout/vabstractdetail.h"
#include "../vmisc/logging.h"
#include <QtTest>
@ -232,9 +233,9 @@ void TST_VEllipticalArc::TestGetPoints1()
VEllipticalArc arc(center, radius1, radius2, startAngle, endAngle, rotationAngle);
QVector<QPointF> points = arc.GetPoints();
if (rotationAngle == 0.0)
if (qFuzzyIsNull(rotationAngle))
{ // equation of ellipse will be different when rotation angle isn't 0 so we can't use this test in this case
qreal eps = 0.05;
const qreal eps = 0.05;
for (int i=0; i < points.size(); ++i)
{