testinggtk r386 - trunk/tests



Author: bjornl
Date: Sat Aug 23 17:29:55 2008
New Revision: 386
URL: http://svn.gnome.org/viewvc/testinggtk?rev=386&view=rev

Log:
Two new tests for negative number of digits

Modified:
   trunk/tests/test_spinbutton.py

Modified: trunk/tests/test_spinbutton.py
==============================================================================
--- trunk/tests/test_spinbutton.py	(original)
+++ trunk/tests/test_spinbutton.py	Sat Aug 23 17:29:55 2008
@@ -3,7 +3,7 @@
 '''
 import gtk
 from gtk import gdk
-import time
+import utils
 
 def test_n_children_of_parent():
     '''
@@ -31,6 +31,34 @@
     spin.set_digits(0)
     assert spin.get_digits() == 0
 
+ utils pass_on_warnings
+def test_set_negative_digits():
+    '''
+    Ensure that setting a negative number of digits results in a
+    ``GtkWarning`` and leaves the digits attribute unchanged.
+
+    :bug:
+    '''
+    adj = gtk.Adjustment(0, 0, 0, 0, 0, 0)
+    spin = gtk.SpinButton(adj, 1, 2)
+    spin.set_digits(-10)
+    assert spin.get_digits() == 2
+
+ utils pass_on_warnings
+def test_configure_negative_widgets():
+    '''
+    Ensure that using the ``configure`` method to set a negative
+    number of digits does not work and leaves the digits attribute
+    unchanged.
+
+    :bug:
+    '''
+    adj = gtk.Adjustment(0, 0, 0, 0, 0, 0)
+    spin = gtk.SpinButton(adj, 1, 2)
+    spin.configure(adj, 1, -10)
+    assert spin.get_digits() == 2
+
+
 def test_value_changed_signal():
     '''
     Ensure that the ``value-changed`` signal is properly emitted on a



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]