KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_sch_commit.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 along
17
* with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#include <boost/test/unit_test.hpp>
21
#include <
tool/tool_manager.h
>
22
#include <
sch_commit.h
>
23
#include <
sch_group.h
>
24
#include <
sch_text.h
>
25
26
BOOST_AUTO_TEST_SUITE
( SchCommit )
27
28
BOOST_AUTO_TEST_CASE
( RecursesThroughGroups )
29
{
30
TOOL_MANAGER
mgr;
31
SCH_COMMIT
commit( &mgr );
32
33
SCH_TEXT
t1;
34
SCH_TEXT
t2;
35
SCH_GROUP
group
;
36
group
.AddItem( &t1 );
37
group
.AddItem( &t2 );
38
39
commit.
Stage
( &
group
,
CHT_MODIFY
,
nullptr
,
RECURSE_MODE::RECURSE
);
40
41
BOOST_CHECK_EQUAL
( commit.
GetStatus
( &t1 ),
CHT_MODIFY
);
42
BOOST_CHECK_EQUAL
( commit.
GetStatus
( &t2 ),
CHT_MODIFY
);
43
}
44
45
BOOST_AUTO_TEST_CASE
( ClearsSelectedByDragFlag )
46
{
47
TOOL_MANAGER
mgr;
48
SCH_COMMIT
commit( &mgr );
49
50
SCH_TEXT
text
;
51
text
.SetFlags(
SELECTED_BY_DRAG
);
52
text
.SetSelected();
53
54
commit.
Stage
( &
text
,
CHT_MODIFY
);
55
56
BOOST_CHECK(
text
.IsSelected() );
57
BOOST_CHECK_EQUAL
( commit.
GetStatus
( &
text
),
CHT_MODIFY
);
58
}
59
60
BOOST_AUTO_TEST_SUITE_END
()
61
BITMAPS::text
@ text
Definition
bitmaps_list.h:614
BITMAPS::group
@ group
Definition
bitmaps_list.h:249
COMMIT::GetStatus
int GetStatus(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Returns status of an item.
Definition
commit.cpp:167
SCH_COMMIT
Definition
sch_commit.h:45
SCH_COMMIT::Stage
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE) override
Add a change of the item aItem of type aChangeType to the change list.
Definition
sch_commit.cpp:71
SCH_GROUP
A set of SCH_ITEMs (i.e., without duplicates).
Definition
sch_group.h:52
SCH_TEXT
Definition
sch_text.h:38
TOOL_MANAGER
Master controller class:
Definition
tool_manager.h:62
CHT_MODIFY
@ CHT_MODIFY
Definition
commit.h:44
RECURSE
@ RECURSE
Definition
eda_item.h:51
SELECTED_BY_DRAG
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
Definition
eda_item_flags.h:48
sch_commit.h
sch_group.h
Class to handle a set of SCH_ITEMs.
sch_text.h
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
Definition
test_api_enums.cpp:134
BOOST_AUTO_TEST_SUITE
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(RecursesThroughGroups)
Definition
test_sch_commit.cpp:28
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(result, "25.4")
tool_manager.h
src
qa
tests
eeschema
test_sch_commit.cpp
Generated on Mon Oct 13 2025 00:06:27 for KiCad PCB EDA Suite by
1.13.2