summaryrefslogtreecommitdiff
path: root/testsuite/gtk/textiter.c
Commit message (Collapse)AuthorAgeFilesLines
* testsuite/gtk/textiter: Add missing assertionDaniel Boles2017-02-181-1/+2
| | | | | | gboolean ret for whether gtk_text_iter_backward_line() moved the iter was declared but not used anywhere. I presume it was meant to be checked, and it passes now, so let’s do it.
* Revert "testsuite/gtk/textiter: Remove an unused variable"Daniel Boles2017-02-181-0/+1
| | | | This reverts commit 8bddf52b510457f73e2ab70049e63d2f6125f456.
* testsuite/gtk/textiter: Remove an unused variableDaniel Boles2017-02-181-1/+0
|
* textiter: fix bug in gtk_text_iter_backward_line()Nelson Benítez León2017-02-171-0/+37
| | | | | | | | | | | | | | | | gtk_text_iter_backward_line() checks the value of real->line_char_offset without previously calling ensure_char_offsets (real) to make sure the former is up-to-date. As a consequence of this, when gtk_text_iter_backward_line() is called after a gtk_text_buffer_insert_range() in the first line of buffer, the iter is not moved to the start of the line, and the return value is wrong. Fixed by adding the ensure_char_offsets() call. A test case for this bug is added to the textiter gtk testsuite.
* textiter: add unit test for forward_to_line_endPaolo Borelli2016-04-221-0/+33
| | | | Surprisingly we had no unit test for this method
* textiter: fix bug in case insensitive backward searchSébastien Wilmet2015-11-301-0/+12
| | | | | | | | | | | | | | | | | | 'win.lines' contains the same content as the GtkTextBuffer, so to find @match_start, forward_chars_with_skipping() is called with skip_decomp=FALSE (the last parameter). So far so good. On the other hand, the content 'lines' (the needle split in lines) is casefolded and normalized for a case insensitive search. So, forward_chars_with_skipping(..., skip_decomp=TRUE) must be called only for the portion of text containing the needle. Since 'start_tmp' contains the location at the start of the match, we can simply begin at that location to find the end of the match. Unit tests are added. https://bugzilla.gnome.org/show_bug.cgi?id=758698
* Simplify _gtk_text_buffer_get_line_log_attrs()Sébastien Wilmet2014-08-211-2/+2
| | | | | | | | | | | | | | | | NULL was returned in case of an empty last line. Every users needed to special-case this. Now it will return the expected result: char_len of 0 with one PangoLogAttr. In compute_log_attrs(), 'paragraph' will be the empty string "" with 'char_len' == 0. pango_get_log_attrs() works fine with an empty string, it will return one correct PangoLogAttr (because there is one text position for the empty string). It fixes the unit tests for gtk_text_iter_is_cursor_position(). https://bugzilla.gnome.org/show_bug.cgi?id=156164
* textbuffer: unit tests for the empty last lineSébastien Wilmet2014-08-211-0/+28
| | | | | | | | | | | For functions using _gtk_text_buffer_get_line_log_attrs(): - gtk_text_buffer_backspace() - some gtk_text_iter functions (word/sentence/cursor boundaries) As the FIXME comments show, there is a bug with gtk_text_iter_is_cursor_position() for an empty last line. https://bugzilla.gnome.org/show_bug.cgi?id=156164
* textiter: fix bug in find_visible_by_log_attrs()Sébastien Wilmet2014-07-171-2/+2
| | | | | | | | | | | | | | | find_by_log_attrs() can return true only in this case: return moved && !gtk_text_iter_is_end (arg_iter); So if the iter moved (i.e. something has been found), but is the end iter, find_by_log_attrs() returns false. Now the same checks are made in find_visible_by_log_attrs(). The public functions using find_visible_by_log_attrs() say in their documentation that false is returned for the end iter, hence the check with gtk_text_iter_is_end(). https://bugzilla.gnome.org/show_bug.cgi?id=618852
* textiter: fix bug in FindLogAttrFunc functionsSébastien Wilmet2014-07-171-3/+3
| | | | | | | | | | | | | | | | attrs[len] is the last PangoLogAttr available, at the iter position after the last character of the line. For a line in the middle or the start of the buffer, the '\n' is taken into account by 'len'. For example the is_word_end is generally reached before the '\n', not after. But for the last line in the buffer, where there is no trailing '\n', it is important to test until attrs[len]. The bug didn't occur before because find_by_log_attrs() worked directly on the iter passed as the function argument. But now it is no longer the case. https://bugzilla.gnome.org/show_bug.cgi?id=618852
* textiter: fix bug in find_by_log_attrs()Sébastien Wilmet2014-07-171-5/+6
| | | | | | | | | | Do not work with the iter passed as the function argument. Work with another iter, and set it back to the function argument only if something has been found. This fixes a few unit tests. But there are regressions for a few others. https://bugzilla.gnome.org/show_bug.cgi?id=618852
* tests textiter: unit tests for sentence boundariesSébastien Wilmet2014-07-171-0/+85
| | | | | | | As the FIXME comment shows, there is a bug. It is the same bug as for the word boundaries. https://bugzilla.gnome.org/show_bug.cgi?id=618852
* tests textiter: unit tests for visible word boundariesSébastien Wilmet2014-07-171-0/+84
| | | | | | As the FIXME comments show, there are several problems. https://bugzilla.gnome.org/show_bug.cgi?id=618852
* tests textiter: unit tests for cursor positionsSébastien Wilmet2014-07-131-0/+100
| | | | | | See the FIXME comment. https://bugzilla.gnome.org/show_bug.cgi?id=618852
* tests textiter: test word boundariesSébastien Wilmet2014-04-131-2/+90
| | | | | | | | | | - As the tests show, some of the functions have a strange and inconsistent behavior for corner cases. - Rename test_full_buffer() -> test_search_full_buffer() because textiter.c is used for other GtkTextIter unit tests. https://bugzilla.gnome.org/show_bug.cgi?id=727908
* textiter: bug fix in forward_search() and backward_search()Sébastien Wilmet2013-06-241-0/+12
| | | | | | | | | | | | | | | | When the search is case sensitive, g_utf8_normalize() is not called, so the skip_decomp argument of the function forward_chars_with_skipping() must be FALSE. To verify that, when searching "éb", the count parameter of forward_chars_with_skipping() have a different value: - case sensitive: count = 2 - case insensitive: count = 3 (g_utf8_normalize() has been called) The commit adds unit tests that didn't pass before, and that now pass (without known regression, obviously). https://bugzilla.gnome.org/show_bug.cgi?id=702977
* Fix gtk_text_iter_forward_to_tag_toggle() for end iterSébastien Wilmet2013-06-201-0/+52
| | | | | | | | | | The function must return TRUE only if there is a tag toggle _after_ the iter, not _at_ the iter. So for the end iter, the function must always return FALSE. Add also unit tests for gtk_text_iter_forward_to_tag_toggle(). https://bugzilla.gnome.org/show_bug.cgi?id=691266
* build: Move gtk/tests to testsuite/gtkBenjamin Otte2013-05-151-0/+269