Esempio n. 1
0
def test_load_from_xpm():
    '''
    Ensure that gdk-pixbuf does not crasch when you try to construct a
    pixbuf from an empty XPM.

    :bug: #467051
    '''
    try:
        xpm = gdk.pixbuf_new_from_xpm_data([])
        assert False
    except IOError:
        assert True
Esempio n. 2
0
    def _create_model(self):
        model = gtk.ListStore(gdk.Pixbuf)

        # EMPTY
        border = list(xpm_border)
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        #TOP
        border[4] = full
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        #BOTTOM
        border[4] = dotted
        border[16] = full
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        #RIGHT
        border[16]=dotted;
        for i in xrange(5, 16, 2):
            border[i] = side001
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        # LEFT
        for i in xrange(5, 16, 2):
            border[i] = side100
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        # V101
        for i in xrange(5, 16, 2):
            border[i] = side101
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        # H101
        for i in xrange(5, 16, 2):
            border[i] = side000
        border[4] = full
        border[16] = full
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        # V111
        border[4] = dotted
        border[16] = dotted
        for i in xrange(5, 16, 2):
            border[i] = side111
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        # H111
        for i in xrange(5, 16, 2):
            border[i] = side000;
        border[4] = full
        border[16] = full
        border[10] = full
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        # CROSS
        border[4] = dotted
        border[16] = dotted
        for i in xrange(5, 16, 2):
            border[i] = side010
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        # SIDES
        for i in xrange(5, 16, 2):
            border[i] = side101
        border[4] = full
        border[16] = full
        border[10] = dotted
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        # FULL
        for i in xrange(5, 16, 2):
            border[i] = side111
        border[4]=full
        border[10]=full
        border[16]=full
        model.append((gdk.pixbuf_new_from_xpm_data(border),))

        self._model = model