~ubuntu-branches/ubuntu/utopic/pida/utopic

« back to all changes in this revision

Viewing changes to pida/utils/culebra/testgtkutil.py

  • Committer: Bazaar Package Importer
  • Author(s): Jan Luebbe
  • Date: 2007-04-17 16:08:06 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070417160806-3ttlb6igf94x9i03
Tags: 0.4.4-1
* New upstream release (closes: #419129)
* Add dependency on python-glade2 (closes: #418716)
* Update copyright

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Nothing needs testing here
 
 
b'\\ No newline at end of file'
 
1
# Nothing needs testing here
 
2
import unittest
 
3
from gtkutil import *
 
4
import gtk
 
5
 
 
6
class TestSignalHolder(unittest.TestCase):
 
7
    entry = ""
 
8
    
 
9
    def on_changed(self, entry):
 
10
        self.text = entry.get_text()
 
11
        
 
12
    def test_simple_ref(self):
 
13
        
 
14
        entry = gtk.Entry()
 
15
        holder = SignalHolder(entry, "changed", self.on_changed)
 
16
        assert hasattr(holder, "destroy_source")
 
17
        entry.set_text("foo")
 
18
        self.assertEquals("foo", self.text)
 
19
        
 
20
        
 
21
        holder = None
 
22
        entry.set_text("bar")
 
23
        self.assertEquals("foo", self.text)
 
24
 
 
25
        holder = SignalHolder(entry, "changed", self.on_changed)
 
26
        entry.destroy()
 
27
        # holder.obj is a function that returns the object associated
 
28
        # with the holder
 
29
        assert holder.obj() is None
 
30
        entry.set_text("foo2")
 
31
        self.assertEquals("foo", self.text)
 
32
        
 
33
        
 
34
 
 
35
if __name__ == '__main__':
 
36
    unittest.main()