blob: 9112b6f52a563aaef047f6227de56df572f3c95c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#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);
boost::optional<Rect> bbox = arrow.bounding_box ();
CPPUNIT_ASSERT (bbox.is_initialized ());
CPPUNIT_ASSERT (bbox.get().x0 == -6);
CPPUNIT_ASSERT (bbox.get().y0 == 0);
CPPUNIT_ASSERT (bbox.get().x1 == 6);
CPPUNIT_ASSERT (bbox.get().y1 == 128);
}
|