You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.2 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2017 CERN
  5. * @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #include <qa_utils/wx_utils/unit_test_utils.h>
  25. #include <core/ignore.h>
  26. #include <kiway.h>
  27. #include <sch_io_mgr.h>
  28. #include "eeschema_test_utils.h"
  29. /**
  30. * Checks that the SCH_IO manager finds the Eagle plugin
  31. */
  32. BOOST_AUTO_TEST_CASE( FindPlugin )
  33. {
  34. SCH_PLUGIN* pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE );
  35. BOOST_CHECK_NE( pi, nullptr );
  36. SCH_IO_MGR::ReleasePlugin( pi );
  37. }
  38. /**
  39. * Get a schematic file from the test data eagle subdir
  40. */
  41. static wxFileName getEagleTestSchematic( const wxString& sch_file )
  42. {
  43. wxFileName fn( KI_TEST::GetEeschemaTestDataDir() );
  44. fn.AppendDir( "plugins" );
  45. fn.AppendDir( "eagle" );
  46. fn.SetFullName( sch_file );
  47. return fn;
  48. }
  49. /**
  50. * Check that a file can be loaded.
  51. */
  52. BOOST_AUTO_TEST_CASE( Load )
  53. {
  54. SCH_PLUGIN* pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_EAGLE );
  55. const auto fn = getEagleTestSchematic( "eagle-import-testfile.sch" );
  56. BOOST_TEST_MESSAGE( fn.GetFullPath() );
  57. ignore_unused( pi );
  58. // This doesn't work with a null KiWay.
  59. // const SCH_SHEET* sheet = pi->Load( fn.GetFullPath(), nullptr );
  60. // BOOST_CHECK_NE( nullptr, sheet );
  61. SCH_IO_MGR::ReleasePlugin( pi );
  62. }