Try to fix a QA issue probably due to the order some Ctors are called.

This is not the first time an issue is created by the order of ctors.
This commit is contained in:
jean-pierre charras 2022-12-27 19:56:04 +01:00
parent 0b50e7fa37
commit 438c4b58a3
1 changed files with 48 additions and 49 deletions

View File

@ -38,8 +38,12 @@ struct ELLIPSE_TO_BEZIER_CASE
};
// clang-format off
static const std::vector<ELLIPSE_TO_BEZIER_CASE> cases = {
BOOST_AUTO_TEST_CASE( EllipseToBezier )
{
// This data mut be created "on the fly" to avoid a CTOR odres issue, because it uses
// static data like ANGLE_0 and it must be created **after** ANGLE_0 CTOR is called
// clang-format off
static const std::vector<ELLIPSE_TO_BEZIER_CASE> cases = {
{
"full circle",
{ { 0, 0 }, { 100, 0 }, 1.0, ANGLE_0, FULL_CIRCLE },
@ -61,9 +65,7 @@ static const std::vector<ELLIPSE_TO_BEZIER_CASE> cases = {
{
"arc1",
{ { 0, 0 }, { 100, 0 }, 0.5, ANGLE_180, FULL_CIRCLE },
{ { { 100, 0 }, { 100, -27.61423749153967 }, { 55.228474983079344, -50 }, { 0, -50 } },
{ { 0, -50 }, { -55.22847498307934, -50 }, { -100, -27.614237491539672 }, { -100, 0 } },
{ { -100, 0 }, { -100, 27.61423749153967 }, { -55.228474983079344, 50 }, { 0, 50 } },
{ { { -100, 0 }, { -100, 27.61423749153967 }, { -55.228474983079344, 50 }, { 0, 50 } },
{ { 0, 50 }, { 55.22847498307934, 50 }, { 100, 27.614237491539672 }, { 100, 0 } }
}
},
@ -83,12 +85,9 @@ static const std::vector<ELLIPSE_TO_BEZIER_CASE> cases = {
{ { 152.23, 1211.78 }, { 612.93, 236.01 }, { 996.95, -846.11 }, { 1071.24, -1377.92 } }
}
},
};
// clang-format on
};
// clang-format on
BOOST_AUTO_TEST_CASE( EllipseToBezier )
{
for( const ELLIPSE_TO_BEZIER_CASE& c : cases )
{
BOOST_TEST_CONTEXT( c.name )