From d54598b29c5a784bd64ae3fc9b96c97e5e150d5e Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 12 Jul 2017 08:38:18 +0900 Subject: [PATCH] Imported Upstream version 3.0.4 Change-Id: I33eb008a3ad56b5ea3771f29f1b2f322923ff60d Signed-off-by: DongHun Kwak --- ChangeLog | 113 ++++++++++++++++++++++++++++++++++++++++++ Makefile.in | 1 + NEWS | 7 ++- PKG-INFO | 4 +- aclocal.m4 | 3 ++ configure | 30 ++++++----- configure.ac | 2 +- examples/Makefile.in | 1 + gi/Makefile.in | 1 + gi/_glib/Makefile.in | 1 + gi/_gobject/Makefile.in | 1 + gi/_gobject/propertyhelper.py | 2 +- gi/overrides/Gtk.py | 15 ------ gi/overrides/Makefile.in | 1 + gi/repository/Makefile.in | 1 + tests/Makefile.in | 1 + tests/compathelper.py | 2 - tests/test_overrides.py | 31 +----------- tests/test_properties.py | 31 ++++++++++++ 19 files changed, 183 insertions(+), 65 deletions(-) diff --git a/ChangeLog b/ChangeLog index e76e07a..9a645e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,94 @@ +commit e65d2fe75310a478e09eef1ab942ece09516d7d9 +Author: Sebastian Pölsterl +Date: Thu Feb 9 10:02:14 2012 +0100 + + Prepare 3.0.4 release + + NEWS | 5 +++++ + 1 files changed, 5 insertions(+), 0 deletions(-) + +commit f24b5a4306fb83f6ff46920ecd7adc201d105b16 +Author: Martin Pitt +Date: Sat Jan 7 09:47:24 2012 +0100 + + Revert "Convert all strings to utf-8 encoding when retrieving from + TreeModel" + + This changes existing behaviour (model values being str instead of + unicode) and + also makes tree model behaviour incompatible to the rest of Gtk + behaviour + (which always returns UTF-8 encoded str objects, not unicode). The + original bug + description was a bug in the test case code, you cannot mix str + and unicode + objects in interpolation. + + This reverts commit 33060639bc4857238f21c2329b8e8888fbd8fdc2. + + https://bugzilla.gnome.org/show_bug.cgi?id=663610 + + gi/overrides/Gtk.py | 15 --------------- + tests/compathelper.py | 2 -- + tests/test_overrides.py | 31 +------------------------------ + 3 files changed, 1 insertions(+), 47 deletions(-) + +commit cba8124389de92f98c45cbaf2bd9c320036d6407 +Author: Tomeu Vizoso +Date: Fri Dec 23 12:20:15 2011 +0100 + + Post-release bump to 3.0.4 + + configure.ac | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +commit 9ba741343e79f0d108074c0110f1aada5f7da4a3 +Merge: 3306063 8d1a36c +Author: Tomeu Vizoso +Date: Fri Dec 23 12:18:00 2011 +0100 + + Merge branch 'master' into pygobject-3-0 + +commit 8d1a36cc73f5f4df091ecb289c8a7b38ec2ab605 +Author: Tomeu Vizoso +Date: Mon Dec 12 18:35:30 2011 +0100 + + Add notes about branching to HACKING + + HACKING | 10 ++++++++++ + 1 files changed, 10 insertions(+), 0 deletions(-) + +commit 00030bc6f0fb961c716ed692144cd8e4bb9be7d0 +Author: Sebastian Pölsterl +Date: Sat Dec 10 12:51:45 2011 +0100 + + Fixed bug where GObject.property did not respect minimum and maximum + values + + https://bugzilla.gnome.org/show_bug.cgi?id=664864 + + gi/_gobject/propertyhelper.py | 2 +- + tests/test_properties.py | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 32 insertions(+), 1 deletions(-) + +commit 7b78abc6c399abd0daa4c11c644d107e1bb7b452 +Author: Tomeu Vizoso +Date: Mon Dec 12 17:00:24 2011 +0100 + + Remove mention of removed option --enable-docs + + HACKING | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +commit 4cba52f5b5e79b7b6212cb0795e8976a9da9f21d +Author: Tomeu Vizoso +Date: Mon Dec 12 17:00:03 2011 +0100 + + Fix sebp's name in NEWS + + NEWS | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + commit 8c95981d0ba224a577f87998030c384b3dae3d80 Author: Tomeu Vizoso Date: Mon Dec 12 16:20:09 2011 +0100 @@ -27,6 +118,28 @@ Date: Thu Dec 1 11:50:38 2011 -0300 pygi-convert.sh | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) +commit 33060639bc4857238f21c2329b8e8888fbd8fdc2 +Author: Sebastian Pölsterl +Date: Tue Nov 8 12:38:12 2011 +0100 + + Convert all strings to utf-8 encoding when retrieving from TreeModel + + https://bugzilla.gnome.org/show_bug.cgi?id=663610 + + gi/overrides/Gtk.py | 15 +++++++++++++++ + tests/compathelper.py | 2 ++ + tests/test_overrides.py | 31 ++++++++++++++++++++++++++++++- + 3 files changed, 47 insertions(+), 1 deletions(-) + +commit c9884283153c38f5b200a19b9abfaf6d9e698818 +Author: Sebastian Pölsterl +Date: Fri Nov 25 18:51:53 2011 +0100 + + Post release version bump + + configure.ac | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + commit 654711d0f940d7480d0f1cdb25a3dc9996f7a706 Author: Sebastian Pölsterl Date: Tue Nov 8 12:38:12 2011 +0100 diff --git a/Makefile.in b/Makefile.in index 9606f5d..308c476 100644 --- a/Makefile.in +++ b/Makefile.in @@ -177,6 +177,7 @@ GI_CFLAGS = @GI_CFLAGS@ GI_DATADIR = @GI_DATADIR@ GI_LIBS = @GI_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ diff --git a/NEWS b/NEWS index 250a97d..b52e88f 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,11 @@ +3.0.4 09-Feb-2012 + - Revert "Convert all strings to utf-8 encoding when retrieving from TreeModel" (Martin Pitt) + - Fixed bug where GObject.property did not respect minimum and maximum values (Sebastian Pölsterl) + - Remove mention of removed option --enable-docs (Tomeu Vizoso) + 3.0.3 12-Dec-2011 - Convert all modifier constants to Gdk.ModifierType (Manuel Quiñones) - - Convert all strings to utf-8 encoding when retrieving from TreeModel (Sebastian Pöl + - Convert all strings to utf-8 encoding when retrieving from TreeModel (Sebastian Pölsterl) - add test for bytearray variants (John (J5) Palmieri) - handle NULL arrays correctly for each array type (John (J5) Palmieri) - Revert "Revert "Fix array termination and size calculation"" (John (J5) Palmieri) diff --git a/PKG-INFO b/PKG-INFO index ef709c9..96fc700 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: PyGObject -Version: 3.0.3 +Version: 3.0.4 Summary: Python bindings for GObject Home-page: http://www.pygtk.org/ Author: James Henstridge @@ -8,7 +8,7 @@ Author-email: james@daa.com.au Maintainer: Johan Dahlin Maintainer-email: johan@gnome.org License: GNU LGPL -Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.0/pygobject-3.0.3.tar.gz +Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.0/pygobject-3.0.4.tar.gz Description: Python bindings for GLib and GObject Platform: POSIX, Windows Classifier: Development Status :: 5 - Production/Stable diff --git a/aclocal.m4 b/aclocal.m4 index 93ea784..00248e0 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1532,6 +1532,7 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` @@ -1668,6 +1669,7 @@ main () GLIB_GENMARSHAL="" GOBJECT_QUERY="" GLIB_MKENUMS="" + GLIB_COMPILE_RESOURCES="" ifelse([$3], , :, [$3]) fi AC_SUBST(GLIB_CFLAGS) @@ -1675,6 +1677,7 @@ main () AC_SUBST(GLIB_GENMARSHAL) AC_SUBST(GOBJECT_QUERY) AC_SUBST(GLIB_MKENUMS) + AC_SUBST(GLIB_COMPILE_RESOURCES) rm -f conf.glibtest ]) diff --git a/configure b/configure index bb92045..aa023a5 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for pygobject 3.0.3. +# Generated by GNU Autoconf 2.68 for pygobject 3.0.4. # # Report bugs to . # @@ -571,8 +571,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='pygobject' PACKAGE_TARNAME='pygobject' -PACKAGE_VERSION='3.0.3' -PACKAGE_STRING='pygobject 3.0.3' +PACKAGE_VERSION='3.0.4' +PACKAGE_STRING='pygobject 3.0.4' PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject' PACKAGE_URL='' @@ -635,6 +635,7 @@ FFI_LIBS FFI_CFLAGS DATADIR PYTHON_BASENAME +GLIB_COMPILE_RESOURCES GLIB_MKENUMS GOBJECT_QUERY GLIB_GENMARSHAL @@ -1358,7 +1359,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures pygobject 3.0.3 to adapt to many kinds of systems. +\`configure' configures pygobject 3.0.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1428,7 +1429,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pygobject 3.0.3:";; + short | recursive ) echo "Configuration of pygobject 3.0.4:";; esac cat <<\_ACEOF @@ -1553,7 +1554,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pygobject configure 3.0.3 +pygobject configure 3.0.4 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1831,7 +1832,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by pygobject $as_me 3.0.3, which was +It was created by pygobject $as_me 3.0.4, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2195,9 +2196,9 @@ $as_echo "#define PYGOBJECT_MINOR_VERSION 0" >>confdefs.h PYGOBJECT_MINOR_VERSION=0 -$as_echo "#define PYGOBJECT_MICRO_VERSION 3" >>confdefs.h +$as_echo "#define PYGOBJECT_MICRO_VERSION 4" >>confdefs.h -PYGOBJECT_MICRO_VERSION=3 +PYGOBJECT_MICRO_VERSION=4 ac_config_headers="$ac_config_headers config.h" @@ -2681,7 +2682,7 @@ fi # Define the identity of the package. PACKAGE='pygobject' - VERSION='3.0.3' + VERSION='3.0.4' cat >>confdefs.h <<_ACEOF @@ -12017,7 +12018,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -pygobject config.lt 3.0.3 +pygobject config.lt 3.0.4 configured by $0, generated by GNU Autoconf 2.68. Copyright (C) 2010 Free Software Foundation, Inc. @@ -15304,6 +15305,7 @@ $as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; } GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` @@ -15468,6 +15470,7 @@ rm -f core conftest.err conftest.$ac_objext \ GLIB_GENMARSHAL="" GOBJECT_QUERY="" GLIB_MKENUMS="" + GLIB_COMPILE_RESOURCES="" as_fn_error $? "maybe you want the pygobject-2-4 branch?" "$LINENO" 5 fi @@ -15475,6 +15478,7 @@ rm -f core conftest.err conftest.$ac_objext \ + rm -f conf.glibtest if test -n "$export_dynamic"; then @@ -16723,7 +16727,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by pygobject $as_me 3.0.3, which was +This file was extended by pygobject $as_me 3.0.4, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16789,7 +16793,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -pygobject config.status 3.0.3 +pygobject config.status 3.0.4 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index a663ca8..20256ec 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ m4_define(python3_min_ver, 3.1) dnl the pygobject version number m4_define(pygobject_major_version, 3) m4_define(pygobject_minor_version, 0) -m4_define(pygobject_micro_version, 3) +m4_define(pygobject_micro_version, 4) m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version) dnl versions of packages we require ... diff --git a/examples/Makefile.in b/examples/Makefile.in index 0a60dfa..2316366 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -92,6 +92,7 @@ GI_CFLAGS = @GI_CFLAGS@ GI_DATADIR = @GI_DATADIR@ GI_LIBS = @GI_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ diff --git a/gi/Makefile.in b/gi/Makefile.in index a2a6fce..3760b52 100644 --- a/gi/Makefile.in +++ b/gi/Makefile.in @@ -211,6 +211,7 @@ GI_CFLAGS = @GI_CFLAGS@ GI_DATADIR = @GI_DATADIR@ GI_LIBS = @GI_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ diff --git a/gi/_glib/Makefile.in b/gi/_glib/Makefile.in index 43062d7..04dd094 100644 --- a/gi/_glib/Makefile.in +++ b/gi/_glib/Makefile.in @@ -175,6 +175,7 @@ GI_CFLAGS = @GI_CFLAGS@ GI_DATADIR = @GI_DATADIR@ GI_LIBS = @GI_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ diff --git a/gi/_gobject/Makefile.in b/gi/_gobject/Makefile.in index 9283893..136cb35 100644 --- a/gi/_gobject/Makefile.in +++ b/gi/_gobject/Makefile.in @@ -172,6 +172,7 @@ GI_CFLAGS = @GI_CFLAGS@ GI_DATADIR = @GI_DATADIR@ GI_LIBS = @GI_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ diff --git a/gi/_gobject/propertyhelper.py b/gi/_gobject/propertyhelper.py index 4635350..9208a0b 100644 --- a/gi/_gobject/propertyhelper.py +++ b/gi/_gobject/propertyhelper.py @@ -298,7 +298,7 @@ class property(object): ptype = self.type if ptype in [TYPE_INT, TYPE_UINT, TYPE_LONG, TYPE_ULONG, TYPE_INT64, TYPE_UINT64, TYPE_FLOAT, TYPE_DOUBLE]: - args = self._get_minimum(), self._get_maximum(), self.default + args = self.minimum, self.maximum, self.default elif (ptype == TYPE_STRING or ptype == TYPE_BOOLEAN or ptype.is_a(TYPE_ENUM)): args = (self.default,) diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py index e0d038a..7945cc8 100644 --- a/gi/overrides/Gtk.py +++ b/gi/overrides/Gtk.py @@ -797,13 +797,6 @@ class TreeModel(Gtk.TreeModel): self.set_value(treeiter, i, value) - def _decode_value(self, treeiter, column, value): - type_ = self.get_column_type(column) - if type_ == GObject.TYPE_STRING and sys.version_info < (3, 0): - value = value.decode('UTF-8') - - return value - def _convert_value(self, treeiter, column, value): if value is None: return @@ -972,10 +965,6 @@ class ListStore(Gtk.ListStore, TreeModel, TreeSortable): value = self._convert_value(treeiter, column, value) Gtk.ListStore.set_value(self, treeiter, column, value) - def get_value(self, treeiter, column): - value = Gtk.ListStore.get_value(self, treeiter, column) - return self._decode_value(treeiter, column, value) - def set(self, treeiter, *args): def _set_lists(columns, values): @@ -1191,10 +1180,6 @@ class TreeStore(Gtk.TreeStore, TreeModel, TreeSortable): value = self._convert_value(treeiter, column, value) Gtk.TreeStore.set_value(self, treeiter, column, value) - def get_value(self, treeiter, column): - value = Gtk.TreeStore.get_value(self, treeiter, column) - return self._decode_value(treeiter, column, value) - def set(self, treeiter, *args): def _set_lists(columns, values): diff --git a/gi/overrides/Makefile.in b/gi/overrides/Makefile.in index 1294cb3..7e07d3b 100644 --- a/gi/overrides/Makefile.in +++ b/gi/overrides/Makefile.in @@ -116,6 +116,7 @@ GI_CFLAGS = @GI_CFLAGS@ GI_DATADIR = @GI_DATADIR@ GI_LIBS = @GI_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ diff --git a/gi/repository/Makefile.in b/gi/repository/Makefile.in index c8fd08d..4f2e672 100644 --- a/gi/repository/Makefile.in +++ b/gi/repository/Makefile.in @@ -116,6 +116,7 @@ GI_CFLAGS = @GI_CFLAGS@ GI_DATADIR = @GI_DATADIR@ GI_LIBS = @GI_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ diff --git a/tests/Makefile.in b/tests/Makefile.in index 491490b..f0b3f95 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -144,6 +144,7 @@ GI_CFLAGS = @GI_CFLAGS@ GI_DATADIR = @GI_DATADIR@ GI_LIBS = @GI_LIBS@ GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ GLIB_MKENUMS = @GLIB_MKENUMS@ diff --git a/tests/compathelper.py b/tests/compathelper.py index b061335..2465747 100644 --- a/tests/compathelper.py +++ b/tests/compathelper.py @@ -62,10 +62,8 @@ if sys.version_info >= (3, 0): ''' _unicode = lambda s: str(s) - _unichr = chr else: _long = long _basestring = basestring _bytes = str _unicode = lambda s: unicode(s, 'UTF-8') - _unichr = unichr diff --git a/tests/test_overrides.py b/tests/test_overrides.py index e875d30..8974273 100644 --- a/tests/test_overrides.py +++ b/tests/test_overrides.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab @@ -8,7 +7,7 @@ import sys import os sys.path.insert(0, "../") -from compathelper import _long, _unicode, _bytes, _unichr +from compathelper import _long, _unicode, _bytes from gi.repository import GLib from gi.repository import GObject @@ -1262,34 +1261,6 @@ class TestGtk(unittest.TestCase): model[0] = (3, "three", -0.3) - def test_tree_model_unicode(self): - model = Gtk.ListStore(str) - - text = (_unicode("just\na\tstring"), - _unicode("Tr") + _unichr(0xf6) + _unicode("del"), - _unicode("N") + _unichr(0xe1) + _unicode("m") + _unichr(0xe8), - _unichr(0xff) + _unichr(0xdf) + _unicode("er"), - _unichr(0x152) + _unichr(0x180) + _unichr(0x1d25)) - - for item in text: - model.append([item]) - - def byte_compare(have, expected): - if sys.version_info < (3, 0): - self.assertTrue(isinstance(have, unicode)) - else: - self.assertTrue(isinstance(have, str)) - - self.assertEqual(len(have), len(expected)) - for i in range(len(expected)): - a = have[i] - b = expected[i] - self.assertEqual(a, b) - self.assertEqual(ord(a), ord(b)) - - for i in range(len(model)): - byte_compare(model[i][0], text[i]) - def test_tree_row_slice(self): model = Gtk.ListStore(int, str, float) model.append([1, "one", -0.1]) diff --git a/tests/test_properties.py b/tests/test_properties.py index 3521647..75aacff 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -367,6 +367,37 @@ class TestProperty(unittest.TestCase): GObject.property, type=gtype, minimum=min, maximum=max+1) + def testMinMax(self): + class C(GObject.GObject): + prop_int = GObject.property(type=int, minimum=1, maximum=100, default=1) + prop_float = GObject.property(type=float, minimum=0.1, maximum=10.5, default=1.1) + + def __init__(self): + GObject.GObject.__init__(self) + + o = C() + self.assertEqual(o.prop_int, 1) + + o.prop_int = 5 + self.assertEqual(o.prop_int, 5) + + o.prop_int = 0 + self.assertEqual(o.prop_int, 5) + + o.prop_int = 101 + self.assertEqual(o.prop_int, 5) + + self.assertEqual(o.prop_float, 1.1) + + o.prop_float = 7.75 + self.assertEqual(o.prop_float, 7.75) + + o.prop_float = 0.09 + self.assertEqual(o.prop_float, 7.75) + + o.prop_float = 10.51 + self.assertEqual(o.prop_float, 7.75) + def testMultipleInstances(self): class C(GObject.GObject): prop = GObject.property(type=str, default='default') -- 2.7.4