2013-04-04 00:32:52 -04:00
|
|
|
#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);
|
|
|
|
|
2024-10-18 20:23:13 -04:00
|
|
|
std::optional<Rect> bbox = arrow.bounding_box ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2013-04-04 00:32:52 -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);
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|