diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-04-04 00:32:52 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-04-04 00:32:52 -0400 |
commit | aaea166135ace01709f7e0be64f40be80f4107ec (patch) | |
tree | 0e794ef7a723e4aaf909b841a6816e405b4ceca1 /libs/canvas/test/arrow.cc | |
parent | 1d8bac08c0c00d44e22c581768a275e1b21a99a7 (diff) |
initial commit of hand merging, plus getting "ancient" waf script to work correctly
Diffstat (limited to 'libs/canvas/test/arrow.cc')
-rw-r--r-- | libs/canvas/test/arrow.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libs/canvas/test/arrow.cc b/libs/canvas/test/arrow.cc new file mode 100644 index 0000000000..9112b6f52a --- /dev/null +++ b/libs/canvas/test/arrow.cc @@ -0,0 +1,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); +} |