KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_issue1441_bom_default_filename.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
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU 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
// Regression tests for https://gitlab.com/kicad/code/kicad/-/issues/1441
21
//
22
// A blank BOM output-file path used to be a hard error. The exporter now defaults to
23
// <schematic>.csv beside the schematic, matching the other KiCad exporters. An unsaved
24
// schematic (no file name) still yields no destination so callers keep the error.
25
26
#include <
qa_utils/wx_utils/unit_test_utils.h
>
27
28
#include <
dialog_symbol_fields_table.h
>
29
30
31
BOOST_AUTO_TEST_SUITE
( Issue1441BomDefaultFileName )
32
33
34
BOOST_AUTO_TEST_CASE
( SwapsExtensionToCsv )
35
{
36
wxFileName
expected
( wxS(
"/tmp/project/design.csv"
) );
37
38
BOOST_CHECK_EQUAL
(
DIALOG_SYMBOL_FIELDS_TABLE::GetDefaultBomFileName
( wxS(
"/tmp/project/design.kicad_sch"
) ),
39
expected
.GetFullPath() );
40
}
41
42
43
BOOST_AUTO_TEST_CASE
( PreservesDirectory )
44
{
45
// The default lands next to the schematic, not in the current working directory.
46
wxFileName
result
(
DIALOG_SYMBOL_FIELDS_TABLE::GetDefaultBomFileName
( wxS(
"/tmp/project/design.kicad_sch"
) ) );
47
48
BOOST_CHECK_EQUAL
(
result
.GetPath(), wxS(
"/tmp/project"
) );
49
BOOST_CHECK_EQUAL
(
result
.GetExt(), wxS(
"csv"
) );
50
}
51
52
53
BOOST_AUTO_TEST_CASE
( EmptyForUnsavedSchematic )
54
{
55
BOOST_CHECK(
DIALOG_SYMBOL_FIELDS_TABLE::GetDefaultBomFileName
( wxEmptyString ).IsEmpty() );
56
}
57
58
59
BOOST_AUTO_TEST_SUITE_END
()
DIALOG_FIELDS_TABLE::GetDefaultBomFileName
static wxString GetDefaultBomFileName(const wxString &aInputFileName)
Derive the default BOM output file name from the input file name by swapping the extension to CSV.
Definition
dialog_fields_table.cpp:50
dialog_symbol_fields_table.h
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
Definition
test_api_enums.cpp:72
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(SwapsExtensionToCsv)
Definition
test_issue1441_bom_default_filename.cpp:34
expected
VECTOR3I expected(15, 30, 45)
result
wxString result
Test unit parsing edge cases and error handling.
Definition
test_text_eval_numeric_compat.cpp:598
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(result, "25.4")
unit_test_utils.h
src
qa
tests
eeschema
test_issue1441_bom_default_filename.cpp
Generated on Fri Jul 31 2026 00:08:03 for KiCad PCB EDA Suite by
1.13.2