pygtk r3041 - in trunk: . gtk tests
- From: paulp svn gnome org
- To: svn-commits-list gnome org
- Subject: pygtk r3041 - in trunk: . gtk tests
- Date: Thu, 11 Sep 2008 19:14:17 +0000 (UTC)
Author: paulp
Date: Thu Sep 11 19:14:17 2008
New Revision: 3041
URL: http://svn.gnome.org/viewvc/pygtk?rev=3041&view=rev
Log:
2008-09-11 Paul Pogonyshev <pogonyshev gmx net>
Bug 481715 â Need way to assign to a GtkTextIter
* gtk/gtktextview.override (_wrap_gtk_text_iter_assign): New
function (based on patch by Owen Taylor).
* tests/test_textview.py (TextIterTest): New test.
Modified:
trunk/ChangeLog
trunk/gtk/gtktextview.override
trunk/tests/test_textview.py
Modified: trunk/gtk/gtktextview.override
==============================================================================
--- trunk/gtk/gtktextview.override (original)
+++ trunk/gtk/gtktextview.override Thu Sep 11 19:14:17 2008
@@ -218,6 +218,27 @@
TRUE, TRUE);
}
%%
+define GtkTextIter.assign kwargs
+static PyObject *
+_wrap_gtk_text_iter_assign(PyGBoxed *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "other", NULL };
+ PyGBoxed *other;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:gtk.TextIter.assign",
+ kwlist, &other))
+ return NULL;
+ if (!pyg_boxed_check(other, GTK_TYPE_TEXT_ITER)) {
+ PyErr_SetString(PyExc_TypeError, "other must be a GtkTextIter");
+ return NULL;
+ }
+
+ *pyg_boxed_get(self, GtkTextIter) = *pyg_boxed_get(other, GtkTextIter);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+%%
override gtk_text_iter_get_slice kwargs
static PyObject *
_wrap_gtk_text_iter_get_slice(PyGBoxed *self, PyObject *args, PyObject *kwargs)
Modified: trunk/tests/test_textview.py
==============================================================================
--- trunk/tests/test_textview.py (original)
+++ trunk/tests/test_textview.py Thu Sep 11 19:14:17 2008
@@ -2,6 +2,20 @@
from common import gtk
+
+class TextIterTest(unittest.TestCase):
+ def test_assign(self):
+ buffer = gtk.TextBuffer()
+ buffer.insert(buffer.get_start_iter(), 'blablabla')
+
+ iter1, iter2 = buffer.get_bounds()
+ self.assert_(iter1 is not iter2)
+ self.assertNotEqual(iter1.get_offset(), iter2.get_offset())
+
+ iter2.assign(iter1)
+ self.assert_(iter1 is not iter2)
+ self.assertEqual(iter1.get_offset(), iter2.get_offset())
+
class TextViewTest(unittest.TestCase):
def test_default_attributes(self):
textview = gtk.TextView()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]