Changeset 4076

Show
Ignore:
Timestamp:
05/05/2008 03:20:03 PM (2 months ago)
Author:
paul
Message:

Added another test case for dTextBox, trying to search for the root
of a problem I'm seeing in my applications. I couldn't reproduce,
but having this test around can't hurt.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/ui/uiwx/test/test_dTextBox.py

    r3054 r4076  
    1818        self.app = None 
    1919 
    20     def mockUserInput(self, str_val): 
     20    def mockUserInput(self, str_val, lose_focus=True): 
    2121        txt = self.txt 
    2222        txt._gotFocus() 
    2323        txt.SetValue(str_val) 
    24         txt._lostFocus() 
     24        if lose_focus: 
     25            txt._lostFocus() 
    2526 
    2627    def testStringValue(self): 
     
    112113        self.assertTrue(isinstance(txt.Value, decimal.Decimal)) 
    113114 
     115    def testFlushValue(self): 
     116        txt = self.txt 
     117        txt.Form.df = None 
     118 
     119        txt.DataSource = "form" 
     120        txt.DataField = "df" 
     121        txt.Value = "Paul" 
     122        self.assertEqual(txt.Value, "Paul") 
     123        self.assertEqual(txt.Value, txt.Form.df) 
     124 
     125        self.mockUserInput("kk") 
     126        self.assertEqual(txt.Value, "kk") 
    114127         
     128        self.mockUserInput("pp", lose_focus=False) 
     129        self.assertEqual(txt.Value, "pp") 
     130        self.assertEqual(txt.Form.df, "kk") 
     131        txt.flushValue() 
     132        self.assertEqual(txt.Form.df, "pp") 
     133        self.assertEqual(txt.Value, "pp") 
     134 
     135 
    115136if __name__ == "__main__": 
    116137    suite = unittest.TestLoader().loadTestsFromTestCase(Test_dTextBox)