~glitter-team/glitter/trunk

« back to all changes in this revision

Viewing changes to glitter/tests/test_container.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 container widget"
 
9
 
 
10
import os
 
11
import sys
 
12
 
 
13
import clutter
 
14
 
 
15
# Change sys path to glitter path
 
16
glitter_path = os.path.split(sys.path[0])[0]
 
17
sys.path[0] = glitter_path
 
18
 
 
19
from container import Container 
 
20
 
 
21
class TestContainer(object):
 
22
    """ Tests for the container widget """
 
23
    
 
24
    def __init__(self):
 
25
        """ Initialize test """
 
26
        
 
27
        self.stage = clutter.Stage()
 
28
        self.stage.set_size(100, 100)
 
29
        
 
30
        self.container = Container()
 
31
        self.stage.add(self.container)
 
32
        self.container.natural_x = 0.5
 
33
        self.container.natural_width = 0.5
 
34
        self.container.natural_height = 0.5
 
35
        self.container._update_layout()
 
36
        
 
37
        assert self.container.get_x() == 50
 
38
        assert self.container.get_width() == 50
 
39
        assert self.container.get_height() == 50
 
40
        
 
41
    def destroy(self, widget, data=None):
 
42
        gtk.main_quit()
 
43
 
 
44
        
 
45
if __name__ == '__main__':
 
46
    TestContainer()