| | 194 | |
|---|
| | 195 | def test_draw_rect_unallocated(): |
|---|
| | 196 | ''' |
|---|
| | 197 | Ensure that get_draw_rect() always return a zero rectangle when |
|---|
| | 198 | the view is not allocated. |
|---|
| | 199 | ''' |
|---|
| | 200 | pixbuf = gdk.Pixbuf(gdk.COLORSPACE_RGB, False, 8, 50, 50) |
|---|
| | 201 | view = gtkimageview.ImageView() |
|---|
| | 202 | view.set_pixbuf(pixbuf) |
|---|
| | 203 | for x_ofs, y_ofs in [(30, 30), (-10, 20), (0, 0), (5, 10)]: |
|---|
| | 204 | view.set_offset(x_ofs, y_ofs) |
|---|
| | 205 | rect = view.get_draw_rect() |
|---|
| | 206 | assert rect.x == 0 |
|---|
| | 207 | assert rect.y == 0 |
|---|
| | 208 | assert rect.width == 0 |
|---|
| | 209 | assert rect.height == 0 |
|---|