allow testing the end position

2001-10-03  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktextiter.c (test_log_attrs): allow testing the end
	position

	* gtk/gtktextbuffer.c (compute_log_attrs): update for pango
	changes

	* tests/testtextbuffer.c (logical_motion_tests): updates
This commit is contained in:
Havoc Pennington 2001-10-03 20:49:10 +00:00 committed by Havoc Pennington
parent 264afe83f8
commit 77dc57e960
10 changed files with 95 additions and 5 deletions

View File

@ -1,3 +1,13 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
position
* gtk/gtktextbuffer.c (compute_log_attrs): update for pango
changes
* tests/testtextbuffer.c (logical_motion_tests): updates
2001-10-03 jacob berkman <jacob@ximian.com>
* gtk/gtkwidget.c (gtk_widget_style_get_property):

View File

@ -1,3 +1,13 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
position
* gtk/gtktextbuffer.c (compute_log_attrs): update for pango
changes
* tests/testtextbuffer.c (logical_motion_tests): updates
2001-10-03 jacob berkman <jacob@ximian.com>
* gtk/gtkwidget.c (gtk_widget_style_get_property):

View File

@ -1,3 +1,13 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
position
* gtk/gtktextbuffer.c (compute_log_attrs): update for pango
changes
* tests/testtextbuffer.c (logical_motion_tests): updates
2001-10-03 jacob berkman <jacob@ximian.com>
* gtk/gtkwidget.c (gtk_widget_style_get_property):

View File

@ -1,3 +1,13 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
position
* gtk/gtktextbuffer.c (compute_log_attrs): update for pango
changes
* tests/testtextbuffer.c (logical_motion_tests): updates
2001-10-03 jacob berkman <jacob@ximian.com>
* gtk/gtkwidget.c (gtk_widget_style_get_property):

View File

@ -1,3 +1,13 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
position
* gtk/gtktextbuffer.c (compute_log_attrs): update for pango
changes
* tests/testtextbuffer.c (logical_motion_tests): updates
2001-10-03 jacob berkman <jacob@ximian.com>
* gtk/gtkwidget.c (gtk_widget_style_get_property):

View File

@ -1,3 +1,13 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
position
* gtk/gtktextbuffer.c (compute_log_attrs): update for pango
changes
* tests/testtextbuffer.c (logical_motion_tests): updates
2001-10-03 jacob berkman <jacob@ximian.com>
* gtk/gtkwidget.c (gtk_widget_style_get_property):

View File

@ -1,3 +1,13 @@
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
position
* gtk/gtktextbuffer.c (compute_log_attrs): update for pango
changes
* tests/testtextbuffer.c (logical_motion_tests): updates
2001-10-03 jacob berkman <jacob@ximian.com>
* gtk/gtkwidget.c (gtk_widget_style_get_property):

View File

@ -3419,11 +3419,15 @@ compute_log_attrs (const GtkTextIter *iter,
if (char_lenp)
*char_lenp = char_len;
attrs = g_new (PangoLogAttr, char_len);
attrs = g_new (PangoLogAttr, char_len + 1);
/* FIXME we need to follow PangoLayout and allow different language
* tags within the paragraph
*/
pango_get_log_attrs (paragraph, byte_len, -1,
gtk_text_iter_get_language (&start),
attrs);
attrs,
char_len + 1);
g_free (paragraph);

View File

@ -2852,10 +2852,13 @@ test_log_attrs (const GtkTextIter *iter,
offset = gtk_text_iter_get_line_offset (iter);
/* char_len may be 0 and attrs will be NULL if so, if
* iter is the end iter and the last line is empty
* iter is the end iter and the last line is empty.
*
* offset may be equal to char_len, since attrs contains an entry
* for one past the end
*/
if (offset < char_len)
if (offset <= char_len)
result = (* func) (attrs, offset, 0, char_len);
return result;

View File

@ -957,6 +957,9 @@ logical_motion_tests (void)
if (!gtk_text_iter_is_end (&iter))
g_error ("Expected to stop at the end iterator\n");
if (!gtk_text_iter_is_cursor_position (&iter))
g_error ("Should be a cursor position before the end iterator");
if (i != expected_steps)
g_error ("Expected %d steps, there were actually %d\n", expected_steps, i);
@ -1016,6 +1019,11 @@ logical_motion_tests (void)
pos, expected[i]);
}
if (i != 0 &&
!gtk_text_iter_is_end (&iter) &&
!gtk_text_iter_ends_sentence (&iter))
g_error ("Iterator at %d should end a sentence", pos);
++i;
}
while (gtk_text_iter_forward_sentence_end (&iter));
@ -1054,6 +1062,11 @@ logical_motion_tests (void)
pos, expected[i]);
}
if (pos != 0 &&
!gtk_text_iter_is_end (&iter) &&
!gtk_text_iter_starts_sentence (&iter))
g_error ("Iterator at %d should start a sentence", pos);
++i;
}
while (gtk_text_iter_backward_sentence_start (&iter));