~glitter-team/glitter/trunk

« back to all changes in this revision

Viewing changes to glitter/tests/test_hbox.py

  • Committer: Jan Jokela
  • Date: 2008-12-10 22:18:59 UTC
  • Revision ID: janjokela@gmail.com-20081210221859-zxr2ut255a7xu15x
Hi, Glitter here

Show diffs side-by-side

added added

removed removed

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