KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_api_run_action.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#include <boost/test/unit_test.hpp>
21
23
24#include <tool/action_manager.h>
25#include <tool/tool_manager.h>
26
27
28BOOST_AUTO_TEST_SUITE( ApiRunAction )
29
30
31// The IPC API RunAction command hands a client-supplied name straight to TOOL_MANAGER, so an
32// unknown one has to come back as a plain false. Asserting instead put a crash dialog in front
33// of users on the assert-enabled builds we ship (Zoho 2466, Sentry KICAD-106E)
34BOOST_AUTO_TEST_CASE( UnknownActionNameIsRejectedNotAsserted )
35{
36 TOOL_MANAGER toolMgr;
37
38 // The name a client actually sent; the registered spelling below shows it never existed
39 BOOST_CHECK( !toolMgr.RunAction( "pcbnew.Control.syncSelection" ) );
40 BOOST_CHECK( !toolMgr.RunAction( "" ) );
41
42 // Guards the checks above against passing because nothing is registered at all
44 "pcbnew.InteractiveSelection.SyncSelection" ) );
45}
46
47
TOOL_ACTION * FindAction(const std::string &aActionName) const
Find an action with a given name (if there is one available).
Master controller class:
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
ACTION_MANAGER * GetActionManager() const
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()