mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
QA: Provide a common implementation of wxAssertThrower
Saves all the unit test modules having to copy-paste the (simple) function.
This commit is contained in:
parent
98da64dce7
commit
6ef078e9d8
@ -62,6 +62,18 @@ public:
|
||||
std::string m_format_msg;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Simple function to handle a WX assertion and throw a real exception.
|
||||
*
|
||||
* This is useful when you want to check assertions fire in unit tests.
|
||||
*/
|
||||
inline void wxAssertThrower( const wxString& aFile, int aLine, const wxString& aFunc,
|
||||
const wxString& aCond, const wxString& aMsg )
|
||||
{
|
||||
throw KI_TEST::WX_ASSERT_ERROR( aFile, aLine, aFunc, aCond, aMsg );
|
||||
}
|
||||
|
||||
} // namespace KI_TEST
|
||||
|
||||
#endif // UNIT_TEST_UTILS_WX_ASSERT__H
|
@ -22,13 +22,6 @@
|
||||
#include <qa_utils/wx_utils/wx_assert.h>
|
||||
|
||||
|
||||
void wxAssertThrower( const wxString& aFile, int aLine, const wxString& aFunc,
|
||||
const wxString& aCond, const wxString& aMsg )
|
||||
{
|
||||
throw KI_TEST::WX_ASSERT_ERROR( aFile, aLine, aFunc, aCond, aMsg );
|
||||
}
|
||||
|
||||
|
||||
bool init_unit_test()
|
||||
{
|
||||
boost::unit_test::framework::master_test_suite().p_name.value = "IPC API tests";
|
||||
@ -38,7 +31,7 @@ bool init_unit_test()
|
||||
bool ok = wxInitialize( boost::unit_test::framework::master_test_suite().argc,
|
||||
boost::unit_test::framework::master_test_suite().argv );
|
||||
|
||||
wxSetAssertHandler( &wxAssertThrower );
|
||||
wxSetAssertHandler( &KI_TEST::wxAssertThrower );
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
@ -39,17 +39,6 @@
|
||||
|
||||
#include <qa_utils/wx_utils/wx_assert.h>
|
||||
|
||||
/*
|
||||
* Simple function to handle a WX assertion and throw a real exception.
|
||||
*
|
||||
* This is useful when you want to check assertions fire in unit tests.
|
||||
*/
|
||||
void wxAssertThrower( const wxString& aFile, int aLine, const wxString& aFunc,
|
||||
const wxString& aCond, const wxString& aMsg )
|
||||
{
|
||||
throw KI_TEST::WX_ASSERT_ERROR( aFile, aLine, aFunc, aCond, aMsg );
|
||||
}
|
||||
|
||||
|
||||
bool init_unit_test()
|
||||
{
|
||||
@ -62,7 +51,7 @@ bool init_unit_test()
|
||||
bool ok = wxInitialize( boost::unit_test::framework::master_test_suite().argc,
|
||||
boost::unit_test::framework::master_test_suite().argv );
|
||||
|
||||
wxSetAssertHandler( &wxAssertThrower );
|
||||
wxSetAssertHandler( &KI_TEST::wxAssertThrower );
|
||||
|
||||
Pgm().InitPgm( true, true, true );
|
||||
Pgm().GetSettingsManager().RegisterSettings( new EESCHEMA_SETTINGS, false );
|
||||
|
@ -39,17 +39,6 @@
|
||||
|
||||
#include <qa_utils/wx_utils/wx_assert.h>
|
||||
|
||||
/*
|
||||
* Simple function to handle a WX assertion and throw a real exception.
|
||||
*
|
||||
* This is useful when you want to check assertions fire in unit tests.
|
||||
*/
|
||||
void wxAssertThrower( const wxString& aFile, int aLine, const wxString& aFunc,
|
||||
const wxString& aCond, const wxString& aMsg )
|
||||
{
|
||||
throw KI_TEST::WX_ASSERT_ERROR( aFile, aLine, aFunc, aCond, aMsg );
|
||||
}
|
||||
|
||||
|
||||
bool init_unit_test()
|
||||
{
|
||||
@ -62,7 +51,7 @@ bool init_unit_test()
|
||||
bool ok = wxInitialize( boost::unit_test::framework::master_test_suite().argc,
|
||||
boost::unit_test::framework::master_test_suite().argv );
|
||||
|
||||
wxSetAssertHandler( &wxAssertThrower );
|
||||
wxSetAssertHandler( &KI_TEST::wxAssertThrower );
|
||||
|
||||
Pgm().InitPgm( true, true, true );
|
||||
Pgm().GetSettingsManager().RegisterSettings( new EESCHEMA_SETTINGS, false );
|
||||
|
Loading…
x
Reference in New Issue
Block a user