Unit test ref #548.

(grafted from c6c35111ed9239f484046384cf4ac173222bdaf0)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-08-20 20:47:51 +03:00
parent d2791a1a6b
commit d799bdce03
2 changed files with 42 additions and 0 deletions

View File

@ -463,6 +463,46 @@ void TST_VAbstractDetail::BrokenDetailEquidistant() const
Comparison(ekv, ekvOrig); Comparison(ekv, ekvOrig);
} }
//---------------------------------------------------------------------------------------------------------------------
void TST_VAbstractDetail::TestCorrectEquidistantPoints_data()
{
QTest::addColumn<QVector<QPointF>>("before");
QTest::addColumn<QVector<QPointF>>("expect");
QVector<QPointF> before;
before << QPointF(30.0, 39.999874015748034);
before << QPointF(785.9055118110236, 39.999874015748034);
before << QPointF(785.9055118110236, 3819.527433070866);
before << QPointF(483.54330708661416, 3819.527433070866);
before << QPointF(483.54330708661416, 1929.763653543307);
before << QPointF(407.9527559055629, 984.8817637795973);
before << QPointF(407.9527559055118, 1929.763653543307);
before << QPointF(407.9527559055118, 3819.527433070866);
before << QPointF(30.0, 3819.527433070866);
QVector<QPointF> expect;
expect << QPointF(30.0, 39.999874015748034);
expect << QPointF(785.9055118110236, 39.999874015748034);
expect << QPointF(785.9055118110236, 3819.527433070866);
expect << QPointF(483.54330708661416, 3819.527433070866);
expect << QPointF(483.54330708661416, 1929.763653543307);
expect << QPointF(407.9527559055629, 984.8817637795973);
expect << QPointF(407.9527559055118, 3819.527433070866);
expect << QPointF(30.0, 3819.527433070866);
QTest::newRow("Test case issue #548") << before << expect;
}
//---------------------------------------------------------------------------------------------------------------------
void TST_VAbstractDetail::TestCorrectEquidistantPoints() const
{
QFETCH(QVector<QPointF>, before);
QFETCH(QVector<QPointF>, expect);
QVector<QPointF> after = VAbstractDetail::CorrectEquidistantPoints(before);
Comparison(after, expect);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TST_VAbstractDetail::Case3() const void TST_VAbstractDetail::Case3() const
{ {

View File

@ -46,6 +46,8 @@ private slots:
void PathRemoveLoop_data() const; void PathRemoveLoop_data() const;
void PathRemoveLoop() const; void PathRemoveLoop() const;
void BrokenDetailEquidistant() const; void BrokenDetailEquidistant() const;
void TestCorrectEquidistantPoints_data();
void TestCorrectEquidistantPoints() const;
private: private:
void Case3() const; void Case3() const;