Unit test ref #548.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2016-08-20 20:43:46 +03:00
parent 02376b0769
commit 691da0ed3e
2 changed files with 42 additions and 0 deletions

View File

@ -309,6 +309,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;