Commit 77dc57e9 authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

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
parent 264afe83
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):
......
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):
......
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):
......
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):
......
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):
......
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):
......
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):
......
......@@ -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);
......
......@@ -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;
......
......@@ -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));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment