PrusaSlicer/tests/libslic3r/test_multiple_beds.cpp
Martin Šach 3e33631abf Arrange: Use arrange for multiple beds.
- Support multiple wipe towers
- Arrange to grid directly within the arrange algorithm
- Suporrt arranging just the current bed
- Support fill bed with instances
- Add arrange selected on current bed
- Add arrange current bed keyboard shortcuts
- Fix cut not arranging properly (set instance bed after cut to the active bed, use arrange current bed selection only after cut)
- Fix shift-D on arrange
- Add window with options to the bed arrange button
2024-11-20 16:04:15 +01:00

36 lines
980 B
C++

#include <catch2/catch.hpp>
#include <libslic3r/MultipleBeds.hpp>
#include <numeric>
using namespace Slic3r;
TEST_CASE("Conversion between grid coords and index", "[MultipleBeds]")
{
std::vector<BedsGrid::Index> original_indices(10);
std::iota(original_indices.begin(), original_indices.end(), 0);
// Add indexes covering the whole int positive range.
const int n{100};
std::generate_n(std::back_inserter(original_indices), n, [i = 1]() mutable {
return std::numeric_limits<int>::max() / n * i++;
});
std::vector<BedsGrid::GridCoords> coords;
std::transform(
original_indices.begin(),
original_indices.end(),
std::back_inserter(coords),
BedsGrid::index2grid_coords
);
std::vector<BedsGrid::Index> indices;
std::transform(
coords.begin(),
coords.end(),
std::back_inserter(indices),
BedsGrid::grid_coords2index
);
CHECK(original_indices == indices);
}