kicad-source/qa/tests/eeschema/test_ee_grid_helper.cpp
Seth Hillbrand 29eee9f126 Refactor grid_helper to allow testing
Make view and tool manager optional so that we can implement QA on the
actual snapping
2025-08-05 16:10:17 -07:00

48 lines
1.5 KiB
C++

/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define BOOST_TEST_NO_MAIN
#include <boost/test/unit_test.hpp>
#include <tools/ee_grid_helper.h>
#include <sch_text.h>
#include <sch_line.h>
#include <sch_shape.h>
#include <sch_junction.h>
#include <layer_ids.h>
BOOST_AUTO_TEST_SUITE( EEGridHelperTest )
BOOST_AUTO_TEST_CASE( ItemGridClassification )
{
EE_GRID_HELPER helper;
SCH_TEXT text;
BOOST_CHECK_EQUAL( helper.GetItemGrid( &text ), GRID_TEXT );
SCH_LINE wire( VECTOR2I( 0, 0 ), LAYER_WIRE );
BOOST_CHECK_EQUAL( helper.GetItemGrid( &wire ), GRID_WIRES );
SCH_LINE graphic( VECTOR2I( 0, 0 ), LAYER_NOTES );
BOOST_CHECK_EQUAL( helper.GetItemGrid( &graphic ), GRID_GRAPHICS );
SCH_JUNCTION junc;
BOOST_CHECK_EQUAL( helper.GetItemGrid( &junc ), GRID_WIRES );
}
BOOST_AUTO_TEST_SUITE_END()