Fixed unicode bug where horizontally scrollable text would attempt to iterate beyond the length of the string; this happens whenever unicode values are present in the string

This commit is contained in:
2023-08-08 10:50:18 -06:00
parent 56fe4400cc
commit 218d442694
2 changed files with 20 additions and 9 deletions
+9
View File
@@ -338,6 +338,15 @@ mod tests {
assert_str_eq!(horizontally_scrollable_text.text, test_text);
}
#[test]
fn test_horizontally_scrollable_text_len() {
let test_text = "우리 생애 최고의 해 The.Best";
let horizontally_scrollable_text = HorizontallyScrollableText::new(test_text.to_owned());
assert_eq!(horizontally_scrollable_text.len(), 20);
assert_str_eq!(horizontally_scrollable_text.text, test_text);
}
#[test]
fn test_horizontally_scrollable_text_scroll_text_left() {
let horizontally_scrollable_text = HorizontallyScrollableText::from("Test string");