1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# !/usr/bin/python
# -*- coding: utf-8 -*-
# Glitter Toolkit
__authors__ = ["Jan Jokela <janjokela@gmail.com>"]
__licenses__ = ["LICENSE.LGPL"]
__description__ = "Tests for the image widget"
import os
import sys
# Change sys path to glitter path
glitter_path = os.path.split(sys.path[0])[0]
sys.path[0] = glitter_path
from window import Window
import gtk
from image import Image
class TestImage(object):
""" Tests for the horizontal box widget """
def __init__(self):
""" Initialize test """
self.window = Window("Glitter tests")
self.window.connect("destroy", self.destroy)
self.stage = self.window.get_stage()
self.stage.connect('notify::width', self.do_resize)
self.stage.connect('notify::height', self.do_resize)
self.image = Image("base.py")
self.stage.add(self.image)
self.image._update_layout()
self.window.show_all()
gtk.main()
def do_resize(self, stage, event):
self.image._update_layout()
def destroy(self, widget, data=None):
gtk.main_quit()
if __name__ == '__main__':
TestImage()
|