13
0
livetrax/libs/canvas/test/arrow.cc

38 lines
830 B
C++
Raw Normal View History

#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 ();
2015-10-05 10:17:49 -04:00
CPPUNIT_ASSERT (bbox.is_initialized ());
2024-10-18 20:17:24 -04:00
CPPUNIT_ASSERT (bbox.value().x0 == -6);
CPPUNIT_ASSERT (bbox.value().y0 == 0);
CPPUNIT_ASSERT (bbox.value().x1 == 6);
CPPUNIT_ASSERT (bbox.value().y1 == 128);
}