The intention here is to make it possible to wrap up many of the
KiCad utility tools into a single executable. This reduces link times
as well as the duplication of CMake files needed to build very
similar tools.
This particular tool should be suitable for any code in common,
code in pcbnew and other end-executables probalby will need an
analagous version linked to the relevant kiface.
The first tool is the coroutine_example.cpp test case, which
can be useful when learning, debugging or porting the coroutine
infrastructure.
This reverts commit decc7ed888.
This compilation options (-fpermissive) is no longer needed,
as the code that caused the warnings on GCC <7 is no longer
present.
The reason this error was GCC bug #56480 [1], which disallowed
the following (valid, in C++11) syntax:
template<> struct namespace_a::namespace_b::a_struct<TYPE>
{...}
And instead insisted on:
namespace namespace_a {
namespace namespace_b {
template<> struct a_struct<TYPE>
{...}
}
}
[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480
An unhappy conjunction of GCC bug #56480 [1] and Boost having
different namespaces for the print_log_value make it quite
ugly to support this method.
For the limited purposes of the unit tests, a free function in
the unit_test_utils header (in the absence of any implementation
in the main libraries) will do, even if it is a little intrusive.
From Boost 1.64 onwards, the customisation point boost_test_print_type
is avaiable, and anyt print functions should be transitioned over to
that method when the minimum Boost version is 1.64 or higher.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480
Test a few "centre-point-angle" cases and add some
generic geom code for testing vectors and boxes are within
tolerance (since rounding often creeps in).
Much of the arc-checking code will be useful to other
construction methods (e.g. point-point-point).
There are expected failures for the bbox code when
the arc passes though, but does not end on, a quadrant point
(0, 90, 180, 270). This is due to a defective
implementation of SHAPE_ARC::BBox() that does not take
into account the quadrant points. This will be fixed
as a follow-up.
Use the AddFileExtListToFilter() to also generate the
wildcard for "all files". This is because:
* Users can use AddFileExtListToFilter for the all files WC
with the same interface as for any other extensions.
* Users do not need to worry about wxGetTranslation, as the
_() is applied in the same way as the other *Wildcard() helpers,
and it is a function just like the others, so it is consistent
* There is a testable interface to document the expected result.
The test is added.
Varargs make it very hard to pass strings in flexibly
when they (and the number of them) are not known
at compile time.
For example, this allows up to now amalgamate the "single
ext" and "multiple ext" unit tests.
This adds a unit test for the recent AddFileExtListToFilter
to demonstrate how to use it and the expected output.
The unit tests are a bit clunky, as the vararg approach cannot
work winth strings passed at runtime.
It was added when refactoring the SHAPE_POLY_SET class, ande replace any use of CPolyLine class inside Kicad code.
the CPolyLine related code is now not used.
So this test nowadays makes no longer sense.
Also modify the linkage of kiface objects, as this is not
supported by older CMake versions.
This was accidentally removed with the reversion of the application
of the wrong patch (8f11a2133).
QA: fix object files
Some functions aren't defined on Boost < 1.59, which is
sadly inclusive of the Ubuntu LTSs.
Make some guards so you can still use these on the newer
Boosts with some useful fallback where possible.
Devolve the logic as to whether a pad should be numbered or not
to a pad utility function. Add a very simplistic test for this
function (demonstrating how to test BOARD_ITEMs in general).
Fixes: lp:1804787
* https://bugs.launchpad.net/kicad/+bug/1804787
The intention here is to make it possible to wrap up many of the
KiCad utility tools into a single executable. This reduces link times
as well as the duplication of CMake files needed to build very
similar tools.
This particular tool should be suitable for any code in common,
code in pcbnew and other end-executables probalby will need an
analagous version linked to the relevant kiface.
The first tool is the coroutine_example.cpp test case, which
can be useful when learning, debugging or porting the coroutine
infrastructure.
The reduces a little bit of WX dependency, and makes
the timing code a bit more type-safe.
Also adds a more testable interface for the accelerated
zoom controller.
This is done to avoid a big chunk of conditionally-compiled code
in the middle of the event function.
Also separates the zoom logic from the WX_VIEW_CONTROLS object
and isolates it in a separate class behind a clearer interface.
Add some simple tests for sane steps on GTK+3-sized scroll
steps.
Due to the implicit floor of the cast from double to unsigned char,
there was a small rounding error in COLOUR4D's WX conversion function.
This fixes the failing tests.
Also make the cast to unsigned char explicit.
This includes:
* Linkage against the Boost unit test libs
* Configuration of the Boost libs
* A place for common generics "extras" for unit test harnesses
including
* A simple way to allow "expected-failure" tests (without
breaking Boost < 1.58, e.g. Ubuntu LTS)
* Moving some simple numeric predicates from the geom tests
to the utils library.
Expand unit test docs to describe the expected failures macro.
Add a few COLOR4D tests, including one with expected failures due
to a pre-existing bug. This will be fixed in a follow-up commit.
Add some unit tests on TITLE_BLOCK
This commit also requires some mocks so the libcommon stuff
can work:
* Needs a Kiface() function to be linkable
* Needs some stuff from common to be build specially
* Needs to define itself as one of the unit-having programs
to appease the units defines.
If qa_utils is not explicitly declared with STATIC, the build
fails in environments where the BUILD_SHARED_LIBS CMake option is
present and set to "ON". An example of this is Fedora COPR.
This adds an io-benchmark case of the STRING_LINE_READER
class, which reads a file into a std::string, *then*
reads it line by line.
As expected, due to it all being in memory, this is very fast.
Also fixes an issue in io_benchmark where the input file
must be in the current dir.
This adds a test program which can be used to test the
parsing of a given KiCad PCB file. This interface is
useful for both manual or automated debugging of given
files, as well as providing an interface suitable for
fuzz-testing tools.
Also adds to the testing docs to detail how fuzzing can
be used.
Also moves some useful re-usable code from io-benchmark
to a new library qa_utils, which can contain code that
isn't need in the actual KiCad libs.
Previous test strings did not utilize extended table unicode, so some
cases slipped through testing. When initializing wxString, we need to
be careful to specify that we are initializing from a UTF-8 string
otherwise the system will utilize a locale-specific initialization.
CPolyLine::Chamfer returns a newly allocated object. The current
test of this doesn't take ownership, leading to memory leaks.
Use a std::unique_ptr to:
* Fix the leak, and
* Document the expected semantics of the interface in the test
Fixes coverity:183869
* Renames /qa/common to /qa/qa_utils, as it is not to do with /common
* Renames /qa/geometry to /qa/common
* Put existing geometry tests into a subdirectory of /qa/common, to
echo the layout of the main tree.
The intention is to provide a place to put tests of other libcommon
code in the /qa/common suite.
When editing the pcb, Ctrl-Click will highlight a net. This allows
de-highlight with the ESC/cancel action from the selection tool. Inside
the highlight tool, ESC reverts to the selection tool while keeping the
net highlighted.
Fixes: lp:1793842
* https://bugs.launchpad.net/kicad/+bug/1793842
This commit finishes the removal of OpenMP from the KiCad codebase.
Removed in this commit are the OpenMP calls in 3d-viewer and
qa/polygon_triangulation as well as all references in CMakeLists.txt
std::thread is used instead for multithreaded computation
OpenMP is not available for macos, so moving to a std::threads
implementation brings platforms into shared code.
This also reduces the OpenMP overhead when computing connectivity and
ratsnests.
Fixes: lp:1780130
* https://bugs.launchpad.net/kicad/+bug/1780130
These tests are fundamentally broken as they test two fillet
implementations against each other, but the two implementations
no longer have the same interface or meaning (one has a fixed
segment count, one has a fixed error).
This also allows the tests to run on Boost <1.59, which do not
provide the !-syntax for excluding tests. Ubuntu 16 uses
Boost 1.58, so this causes build failures.
Fixes: 1785377
https://bugs.launchpad.net/kicad/+bug/1785377
This is the first test for a generic test suite for geometric functions.
The tests run are for fillet corners of SHAPE_POLY_SETS.
Previously, SHAPE_POLY_SET::Fillet was tested against CPolyLine::Fillet
to ensure compatibility. However, thse two functions now have different
interfaces and are not directly comparable. Also, this depended on
CPolyLine::Fillet being correct, which was not tested.
Instead, test SHAPE_POLY_SET::Fillet using tests against geometric
constraints, independent of any other fillet implementation.
This test is not really concerned with generic geometric code testing,
but rather the correctness of a refactoring effort.
Rename it make this clearer, and also to make way for generic geometry tests.