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,57 +38,56 @@ struct ELLIPSE_TO_BEZIER_CASE
}; };
// clang-format off
static const std::vector<ELLIPSE_TO_BEZIER_CASE> cases = {
{
"full circle",
{ { 0, 0 }, { 100, 0 }, 1.0, ANGLE_0, FULL_CIRCLE },
{ { { 100, 0 }, { 100, -55.22847498307934 }, { 55.228474983079344, -100 }, { 0, -100 } },
{ { 0, -100 }, { -55.22847498307934, -100 }, { -100, -55.228474983079344 }, { -100, 0 } },
{ { -100, 0 }, { -100, 55.22847498307934 }, { -55.228474983079344, 100 }, { 0, 100 } },
{ { 0, 100 }, { 55.22847498307934, 100 }, { 100, 55.228474983079344 }, { 100, 0 } }
}
},
{
"ellipse",
{ { 0, 0 }, { -100, 0 }, 0.5, ANGLE_0, 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 } },
{ { 0, -50 }, { -55.22847498307934, -50 }, { -100, -27.614237491539672 }, { -100, 0 } }
}
},
{
"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 } },
{ { 0, 50 }, { 55.22847498307934, 50 }, { 100, 27.614237491539672 }, { 100, 0 } }
}
},
{
"arc2",
{ { 223, 165 }, { 372, 634 }, 0.96, EDA_ANGLE( 4.437, RADIANS_T ), EDA_ANGLE( 0.401, RADIANS_T ) },
{ { { -463.86, 336.27 }, { -389.81, 608.33 }, { -170.75, 818.49 }, { 99.52, 876.73 } },
{ { 99.52, 876.73 }, { 369.80, 934.98 }, { 643.36, 831.0 }, { 803.07, 609.31 } }
}
},
{
"arc3",
{ { 112.75, 490.24 }, { 304.54, 129.16 }, 7.14, EDA_ANGLE( 1.90, RADIANS_T ), EDA_ANGLE( 1.09, RADIANS_T ) },
{ { { 886.98, -1609.17 }, { 608.61, -1333.45 }, { 110.16, -394.92 }, { -305.88, 636.89 } },
{ { -305.88, 636.89 }, { -721.93, 1668.69 }, { -940.88, 2509.32 }, { -829.87, 2648.63 } },
{ { -829.87, 2648.63 }, { -718.85, 2787.95 }, { -308.47, 2187.55 }, { 152.23, 1211.78 } },
{ { 152.23, 1211.78 }, { 612.93, 236.01 }, { 996.95, -846.11 }, { 1071.24, -1377.92 } }
}
},
};
// clang-format on
BOOST_AUTO_TEST_CASE( EllipseToBezier ) 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 },
{ { { 100, 0 }, { 100, -55.22847498307934 }, { 55.228474983079344, -100 }, { 0, -100 } },
{ { 0, -100 }, { -55.22847498307934, -100 }, { -100, -55.228474983079344 }, { -100, 0 } },
{ { -100, 0 }, { -100, 55.22847498307934 }, { -55.228474983079344, 100 }, { 0, 100 } },
{ { 0, 100 }, { 55.22847498307934, 100 }, { 100, 55.228474983079344 }, { 100, 0 } }
}
},
{
"ellipse",
{ { 0, 0 }, { -100, 0 }, 0.5, ANGLE_0, 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 } },
{ { 0, -50 }, { -55.22847498307934, -50 }, { -100, -27.614237491539672 }, { -100, 0 } }
}
},
{
"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 } }
}
},
{
"arc2",
{ { 223, 165 }, { 372, 634 }, 0.96, EDA_ANGLE( 4.437, RADIANS_T ), EDA_ANGLE( 0.401, RADIANS_T ) },
{ { { -463.86, 336.27 }, { -389.81, 608.33 }, { -170.75, 818.49 }, { 99.52, 876.73 } },
{ { 99.52, 876.73 }, { 369.80, 934.98 }, { 643.36, 831.0 }, { 803.07, 609.31 } }
}
},
{
"arc3",
{ { 112.75, 490.24 }, { 304.54, 129.16 }, 7.14, EDA_ANGLE( 1.90, RADIANS_T ), EDA_ANGLE( 1.09, RADIANS_T ) },
{ { { 886.98, -1609.17 }, { 608.61, -1333.45 }, { 110.16, -394.92 }, { -305.88, 636.89 } },
{ { -305.88, 636.89 }, { -721.93, 1668.69 }, { -940.88, 2509.32 }, { -829.87, 2648.63 } },
{ { -829.87, 2648.63 }, { -718.85, 2787.95 }, { -308.47, 2187.55 }, { 152.23, 1211.78 } },
{ { 152.23, 1211.78 }, { 612.93, 236.01 }, { 996.95, -846.11 }, { 1071.24, -1377.92 } }
}
},
};
// clang-format on
for( const ELLIPSE_TO_BEZIER_CASE& c : cases ) for( const ELLIPSE_TO_BEZIER_CASE& c : cases )
{ {
BOOST_TEST_CONTEXT( c.name ) BOOST_TEST_CONTEXT( c.name )