diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index c56ac2d9cb..244d25bfd5 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -356,6 +356,9 @@ target_link_libraries( eeschema_kiface ${wxWidgets_LIBRARIES} ${GDI_PLUS_LIBRARIES} ) +target_include_directories( eeschema_kiface PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ) if( KICAD_SPICE ) target_link_libraries( eeschema_kiface diff --git a/qa/eeschema/CMakeLists.txt b/qa/eeschema/CMakeLists.txt index ef837fe7db..b5143bccf8 100644 --- a/qa/eeschema/CMakeLists.txt +++ b/qa/eeschema/CMakeLists.txt @@ -21,31 +21,44 @@ # or you may write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -find_package( Boost COMPONENTS unit_test_framework REQUIRED ) - include_directories( BEFORE ${INC_BEFORE} ) -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/eeschema - ${CMAKE_SOURCE_DIR}/common - ${INC_AFTER} +include_directories( AFTER ${INC_AFTER} ) + + +add_executable( qa_eeschema + # A single top to load the pcnew kiface + # ../../common/single_top.cpp + + # stuff from common due to...units? + ../../common/base_units.cpp + ../../common/eda_text.cpp + + # stuff from common which is needed...why? + ../../common/colors.cpp + ../../common/observable.cpp + + # The main test entry points + test_module.cpp + + test_eagle_plugin.cpp ) -add_executable( qa_eagle_plugin - test_module.cpp - test_basic.cpp - ) - -target_compile_definitions( qa_eagle_plugin - PRIVATE -DBOOST_TEST_DYN_LINK ) - -add_dependencies( qa_eagle_plugin common eeschema_kiface ) - -target_link_libraries( qa_eagle_plugin - common +target_link_libraries( qa_eeschema eeschema_kiface - ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} - ${wxWidgets_LIBRARIES} - ) + common + gal + qa_utils + unit_test_utils + ${GDI_PLUS_LIBRARIES} + ${Boost_LIBRARIES} +) + +add_test( NAME eeschema + COMMAND qa_eeschema +) + +# Eeschema tests, so pretend to be eeschema (for units, etc) +target_compile_definitions( qa_eeschema + PUBLIC EESCHEMA +) \ No newline at end of file diff --git a/qa/eeschema/test_basic.cpp b/qa/eeschema/test_eagle_plugin.cpp similarity index 79% rename from qa/eeschema/test_basic.cpp rename to qa/eeschema/test_eagle_plugin.cpp index 5df77c9cbc..13537fec4f 100644 --- a/qa/eeschema/test_basic.cpp +++ b/qa/eeschema/test_eagle_plugin.cpp @@ -22,10 +22,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include #include -#include +#include #include +#include #include @@ -34,16 +34,17 @@ */ BOOST_AUTO_TEST_CASE( FindPlugin ) { - BOOST_CHECK( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE ) != NULL ); + BOOST_CHECK_NE( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE ), nullptr ); } /** * */ -BOOST_AUTO_TEST_CASE( Load ) -{ - SCH_PLUGIN* pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE ); +// BOOST_AUTO_TEST_CASE( Load ) +// { +// SCH_PLUGIN* pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE ); - pi->Load("/home/alejandro/Proyectos/kicad/kicad-alejandro/eeschema/qa/data/eagle_schematics/empty.sch", - NULL); -} +// pi->Load( +// "/home/alejandro/Proyectos/kicad/kicad-alejandro/eeschema/qa/data/eagle_schematics/empty.sch", +// NULL ); +// } diff --git a/qa/eeschema/test_module.cpp b/qa/eeschema/test_module.cpp index 50b04dd599..5dbce91ca6 100644 --- a/qa/eeschema/test_module.cpp +++ b/qa/eeschema/test_module.cpp @@ -3,6 +3,7 @@ * * Copyright (C) 2017 CERN * @author Alejandro GarcĂ­a Montoro + * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -23,9 +24,27 @@ */ /** - * Main file for the schematic eagle plugin tests to be compiled + * Main file for the Eeschema tests to be compiled */ - -#define BOOST_TEST_MODULE "Schematic Eagle plugin" - #include + +#include + + +bool init_unit_test() +{ + boost::unit_test::framework::master_test_suite().p_name.value = "Common Eeschema module tests"; + return wxInitialize(); +} + + +int main( int argc, char* argv[] ) +{ + int ret = boost::unit_test::unit_test_main( &init_unit_test, argc, argv ); + + // This causes some glib warnings on GTK3 (http://trac.wxwidgets.org/ticket/18274) + // but without it, Valgrind notices a lot of leaks from WX + wxUninitialize(); + + return ret; +} \ No newline at end of file