diff options
| author | Paul Pogonyshev <pogonyshev@gmx.net> | 2009-11-22 18:22:23 +0200 |
|---|---|---|
| committer | Paul Pogonyshev <pogonyshev@gmx.net> | 2009-11-22 18:22:23 +0200 |
| commit | 408b2186aea58a41ec26b9d0ca29ecd42df5ef7e (patch) | |
| tree | d9f31d382b7b9ef96af0e14cdee8dc398620178d | |
| parent | 602afea88c338a38327cd84e08703c5daa384ec6 (diff) | |
| download | pygobject-408b2186aea58a41ec26b9d0ca29ecd42df5ef7e.tar.gz pygobject-408b2186aea58a41ec26b9d0ca29ecd42df5ef7e.tar.xz pygobject-408b2186aea58a41ec26b9d0ca29ecd42df5ef7e.zip | |
Fix wrong minimum checking in float properties
Bug #587637. Test the fix.
| -rw-r--r-- | gobject/propertyhelper.py | 5 | ||||
| -rw-r--r-- | tests/test_properties.py | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/gobject/propertyhelper.py b/gobject/propertyhelper.py index 216ceb2..e299273 100644 --- a/gobject/propertyhelper.py +++ b/gobject/propertyhelper.py @@ -224,10 +224,11 @@ class property(object): ptype = self.type if ptype in [TYPE_UINT, TYPE_ULONG, TYPE_UINT64]: return 0 + # Remember that G_MINFLOAT and G_MINDOUBLE are something different. elif ptype == TYPE_FLOAT: - return G_MINFLOAT + return -G_MAXFLOAT elif ptype == TYPE_DOUBLE: - return G_MINDOUBLE + return -G_MAXDOUBLE elif ptype == TYPE_INT: return G_MININT elif ptype == TYPE_LONG: diff --git a/tests/test_properties.py b/tests/test_properties.py index e3be865..ccfcb34 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -366,5 +366,11 @@ class TestProperty(unittest.TestCase): else: raise AssertionError + # Bug 587637. + def test_float_min(self): + gobject.property(type=float, minimum=-1) + gobject.property(type=gobject.TYPE_FLOAT, minimum=-1) + gobject.property(type=gobject.TYPE_DOUBLE, minimum=-1) + if __name__ == '__main__': unittest.main() |
