dabo Commit
Revision 4076
Date: 2008-05-05 15:20:03 -0700 (Mon, 05 May 2008)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/4076

Changed:
U   trunk/dabo/ui/uiwx/test/test_dTextBox.py

Log:
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.


Diff:
Modified: trunk/dabo/ui/uiwx/test/test_dTextBox.py
===================================================================
--- trunk/dabo/ui/uiwx/test/test_dTextBox.py    2008-05-05 21:35:14 UTC (rev 
4075)
+++ trunk/dabo/ui/uiwx/test/test_dTextBox.py    2008-05-05 22:20:03 UTC (rev 
4076)
@@ -17,11 +17,12 @@
                self.txt = None
                self.app = None
 
-       def mockUserInput(self, str_val):
+       def mockUserInput(self, str_val, lose_focus=True):
                txt = self.txt
                txt._gotFocus()
                txt.SetValue(str_val)
-               txt._lostFocus()
+               if lose_focus:
+                       txt._lostFocus()
 
        def testStringValue(self):
                txt = self.txt
@@ -111,7 +112,27 @@
                self.assertEqual(txt.Value, decimal.Decimal("42.23"))
                self.assertTrue(isinstance(txt.Value, decimal.Decimal))
 
+       def testFlushValue(self):
+               txt = self.txt
+               txt.Form.df = None
+
+               txt.DataSource = "form"
+               txt.DataField = "df"
+               txt.Value = "Paul"
+               self.assertEqual(txt.Value, "Paul")
+               self.assertEqual(txt.Value, txt.Form.df)
+
+               self.mockUserInput("kk")
+               self.assertEqual(txt.Value, "kk")
                
+               self.mockUserInput("pp", lose_focus=False)
+               self.assertEqual(txt.Value, "pp")
+               self.assertEqual(txt.Form.df, "kk")
+               txt.flushValue()
+               self.assertEqual(txt.Form.df, "pp")
+               self.assertEqual(txt.Value, "pp")
+
+
 if __name__ == "__main__":
        suite = unittest.TestLoader().loadTestsFromTestCase(Test_dTextBox)
        unittest.TextTestRunner(verbosity=2).run(suite)




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to