The return of threaded waveform rendering and related crashes.
[ardour.git] / libs / canvas / test / item.cc
1 #include "canvas/group.h"
2 #include "canvas/item.h"
3 #include "canvas/canvas.h"
4 #include "canvas/rectangle.h"
5 #include "item.h"
6
7 using namespace std;
8 using namespace ArdourCanvas;
9
10 CPPUNIT_TEST_SUITE_REGISTRATION (ItemTest);
11
12 void
13 ItemTest::item_to_canvas ()
14 {
15         ImageCanvas canvas;
16         Group gA (canvas.root ());
17         gA.set_position (Duple (128, 128));
18         Group gB (&gA);
19         gB.set_position (Duple (45, 55));
20         Rectangle rA (&gB);
21         rA.set_position (Duple (99, 23));
22
23         Rect const r = rA.item_to_canvas (Rect (3, 6, 7, 9));
24         CPPUNIT_ASSERT (r.x0 == (128 + 45 + 99 + 3));
25         CPPUNIT_ASSERT (r.y0 == (128 + 55 + 23 + 6));
26         CPPUNIT_ASSERT (r.x1 == (128 + 45 + 99 + 7));
27         CPPUNIT_ASSERT (r.y1 == (128 + 55 + 23 + 9));
28 }