summaryrefslogtreecommitdiff
path: root/libs/canvas/test/item.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-04-04 00:32:52 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-04-04 00:32:52 -0400
commitaaea166135ace01709f7e0be64f40be80f4107ec (patch)
tree0e794ef7a723e4aaf909b841a6816e405b4ceca1 /libs/canvas/test/item.cc
parent1d8bac08c0c00d44e22c581768a275e1b21a99a7 (diff)
initial commit of hand merging, plus getting "ancient" waf script to work correctly
Diffstat (limited to 'libs/canvas/test/item.cc')
-rw-r--r--libs/canvas/test/item.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/libs/canvas/test/item.cc b/libs/canvas/test/item.cc
new file mode 100644
index 0000000000..96ea2d2f15
--- /dev/null
+++ b/libs/canvas/test/item.cc
@@ -0,0 +1,28 @@
+#include "canvas/group.h"
+#include "canvas/item.h"
+#include "canvas/canvas.h"
+#include "canvas/rectangle.h"
+#include "item.h"
+
+using namespace std;
+using namespace ArdourCanvas;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (ItemTest);
+
+void
+ItemTest::item_to_canvas ()
+{
+ ImageCanvas canvas;
+ Group gA (canvas.root ());
+ gA.set_position (Duple (128, 128));
+ Group gB (&gA);
+ gB.set_position (Duple (45, 55));
+ Rectangle rA (&gB);
+ rA.set_position (Duple (99, 23));
+
+ Rect const r = rA.item_to_canvas (Rect (3, 6, 7, 9));
+ CPPUNIT_ASSERT (r.x0 == (128 + 45 + 99 + 3));
+ CPPUNIT_ASSERT (r.y0 == (128 + 55 + 23 + 6));
+ CPPUNIT_ASSERT (r.x1 == (128 + 45 + 99 + 7));
+ CPPUNIT_ASSERT (r.y1 == (128 + 55 + 23 + 9));
+}