13
0
livetrax/libs/canvas/test/arrow.cc
Robin Gareus ff95d81612
Reduce reliance on boost - the easy part
* boost::unordered_map -> std::unordered_map
* BOOST_STATIC_ASSERT/static_assert
* BOOST_FOREACH -> for
* boost::tuple -> std::tuple/g
* boost::math::isnormal -> std::isnormal
* boost::container::set -> std::set
* boost::none -> std::nullopt
* boost::optional -> std::optional
2024-10-19 03:41:16 +02:00

38 lines
830 B
C++

#include "canvas/group.h"
#include "canvas/types.h"
#include "canvas/arrow.h"
#include "canvas/canvas.h"
#include "arrow.h"
using namespace std;
using namespace ArdourCanvas;
CPPUNIT_TEST_SUITE_REGISTRATION (ArrowTest);
void
ArrowTest::bounding_box ()
{
ImageCanvas canvas;
Arrow arrow (canvas.root ());
for (int i = 0; i < 2; ++i) {
arrow.set_show_head (i, true);
arrow.set_head_outward (i, true);
arrow.set_head_height (i, 16);
arrow.set_head_width (i, 12);
arrow.set_x (0);
arrow.set_y0 (0);
arrow.set_y1 (128);
}
arrow.set_outline_width (0);
std::optional<Rect> bbox = arrow.bounding_box ();
CPPUNIT_ASSERT (bbox.is_initialized ());
CPPUNIT_ASSERT (bbox.value().x0 == -6);
CPPUNIT_ASSERT (bbox.value().y0 == 0);
CPPUNIT_ASSERT (bbox.value().x1 == 6);
CPPUNIT_ASSERT (bbox.value().y1 == 128);
}