Skip to content

Add cursor tests for RTL text followed by newline #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions parley/src/tests/test_cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,35 @@ fn cursor_next_visual() {

layout.assert_cursor_is_after("ipsum d", cursor);
}

// Currently fails
#[ignore]
#[test]
fn cursor_rtl_newline_by_character() {
let (mut lcx, mut fcx) = (LayoutContext::new(), FontContext::new());
let text = "abcאבג\nde";
let layout = CursorTest::single_line(text, &mut lcx, &mut fcx);

let mut cursor: Cursor = layout.cursor_after("אבג");
layout.print_cursor(cursor);
cursor = cursor.previous_visual(layout.layout());

layout.assert_cursor_is_after("abcא", cursor);
cursor = cursor.previous_visual(layout.layout());
cursor = cursor.previous_visual(layout.layout());
layout.assert_cursor_is_after("abc", cursor);
}

// Currently goes into an infinite loop
#[ignore]
#[test]
fn cursor_rtl_newline_by_word() {
let (mut lcx, mut fcx) = (LayoutContext::new(), FontContext::new());
let text = "abcאבג\nde";
let layout = CursorTest::single_line(text, &mut lcx, &mut fcx);

let mut cursor: Cursor = layout.cursor_after("אבג");
layout.print_cursor(cursor);
cursor = cursor.previous_visual_word(layout.layout());
layout.assert_cursor_is_after("abc", cursor);
}
Loading