BufferView: user must call update() after all changes and before vert_iter()

This commit is contained in:
josh committed 2017-09-03 17:34:41 -04:00
1 parent 5b35a35b24
commit 14e285041e
3 files changed
+13 -12

No files matched your search

+4
View File
@@ -63,6 +63,7 @@ TEST(BufferViewTest, does_not_iterate_for_empty_buffer)
BufferView bv(b, iterator, Cwd);
bv.resize(40, 8);
int iter_count = 0;
bv.update();
for (auto it = bv.vert_iter(); it.is_valid(); it++)
{
iter_count++;
@@ -80,6 +81,7 @@ TEST(BufferViewTest, iterates_through_screen_lines_with_no_wrapping)
BufferView bv(b, iterator, Cwd);
bv.resize(40, 8);
int iter_count = 0;
bv.update();
for (auto it = bv.vert_iter(); it.is_valid(); it++)
{
EXPECT_EQ(iter_count, LineNumber(it.iterator()));
@@ -99,6 +101,7 @@ TEST(BufferViewTest, iterates_through_screen_lines_with_wrapping)
bv.resize(3, 10);
int iter_count = 0;
int expected_row_offsets[] = {0, 1, 2, 4, 5, 6, 7};
bv.update();
for (auto it = bv.vert_iter(); it.is_valid(); it++)
{
EXPECT_EQ(iter_count, LineNumber(it.iterator()));
@@ -122,6 +125,7 @@ TEST(BufferViewTest, fills_view_with_last_lines_of_buffer_when_cursor_warps_to_l
bv.resize(40, 3);
int iter_count = 0;
int expected_row_offsets[] = {0, 1, 2};
bv.update();
for (auto it = bv.vert_iter(); it.is_valid(); it++)
{
EXPECT_EQ(10 + iter_count, LineNumber(it.iterator()));