| 17 | | GdkRectangle top = borders[0]; |
|---|
| 18 | | assert (gdk_rectangle_eq (top, (GdkRectangle){0, 0, width, i.y})); |
|---|
| | 18 | GdkRectangle top = borders[0]; |
|---|
| | 19 | assert (top.x == outer.x); |
|---|
| | 20 | assert (top.y == outer.y); |
|---|
| | 21 | assert (top.width == outer.width); |
|---|
| | 22 | assert (top.height == inner.y - outer.y); |
|---|
| 26 | | GdkRectangle left = borders[2]; |
|---|
| 27 | | assert (left.x == 0); |
|---|
| 28 | | assert (left.y == i.y -1); |
|---|
| 29 | | assert (left.width == i.x); |
|---|
| 30 | | assert (left.height == i.height + 2); |
|---|
| | 30 | GdkRectangle right = borders[2]; |
|---|
| | 31 | assert (right.x == inner.x + inner.width); |
|---|
| | 32 | assert (right.y == inner.y); |
|---|
| | 33 | assert (right.width == |
|---|
| | 34 | (outer.x + outer.width) - (inner.x + inner.width)); |
|---|
| | 35 | assert (right.height == inner.height); |
|---|
| 32 | | GdkRectangle right = borders[3]; |
|---|
| 33 | | assert (right.x == i.x + i.width); |
|---|
| 34 | | assert (right.y == i.y - 1); |
|---|
| 35 | | assert (right.width == width - i.x - i.width); |
|---|
| 36 | | assert (right.height == i.height + 2); |
|---|
| | 37 | GdkRectangle bottom = borders[3]; |
|---|
| | 38 | assert (bottom.x == outer.x); |
|---|
| | 39 | assert (bottom.y == inner.y + inner.height); |
|---|
| | 40 | assert (bottom.width == outer.width); |
|---|
| | 41 | assert (bottom.height == |
|---|
| | 42 | (outer.y + outer.height) - (inner.y + inner.height)); |
|---|
| 57 | | for (int i = 0; i < G_N_ELEMENTS(outsides); i += 2) |
|---|
| 58 | | { |
|---|
| 59 | | for (int j = 0; j < G_N_ELEMENTS(insides); j += 4) |
|---|
| 60 | | { |
|---|
| 61 | | int width = outsides[i + 0]; |
|---|
| 62 | | int height = outsides[i + 1]; |
|---|
| 63 | | GdkRectangle inside = { |
|---|
| 64 | | insides[j + 0], |
|---|
| 65 | | insides[j + 1], |
|---|
| 66 | | insides[j + 2], |
|---|
| 67 | | insides[j + 3] |
|---|
| 68 | | }; |
|---|
| 69 | | rects_around_rect_checker (width, height, inside); |
|---|
| 70 | | } |
|---|
| 71 | | } |
|---|
| | 63 | for (int i = 0; i < G_N_ELEMENTS(outsides); i++) |
|---|
| | 64 | for (int j = 0; j < G_N_ELEMENTS(insides); j++) |
|---|
| | 65 | rects_around_rect_checker (outsides[i], insides[j]); |
|---|
| | 66 | |
|---|
| 75 | | gdk_get_rects_around_rect (100, 100, &in, arounds); |
|---|
| 76 | | assert (gdk_rectangle_eq (arounds[0], |
|---|
| 77 | | (GdkRectangle){0, 0, 100, 25})); |
|---|
| 78 | | assert (gdk_rectangle_eq (arounds[1], |
|---|
| 79 | | (GdkRectangle){0, 75, 100, 25})); |
|---|
| 80 | | assert (gdk_rectangle_eq (arounds[2], |
|---|
| 81 | | (GdkRectangle){0, 25 - 1, 25, 50 + 2})); |
|---|
| 82 | | assert (gdk_rectangle_eq (arounds[3], |
|---|
| 83 | | (GdkRectangle){75, 25 - 1, 25, 50 + 2})); |
|---|
| | 71 | gdk_rectangle_get_rects_around (&out, &in, arounds); |
|---|
| | 72 | assert (gdk_rectangle_eq2 (arounds[0], 0, 0, 100, 25)); |
|---|
| | 73 | assert (gdk_rectangle_eq2 (arounds[1], 0, 25, 25, 50)); |
|---|
| | 74 | assert (gdk_rectangle_eq2 (arounds[2], 75, 25, 25, 50)); |
|---|
| | 75 | assert (gdk_rectangle_eq2 (arounds[3], 0, 75, 100, 25)); |
|---|