#![cfg(feature = "DISABLED_selection_tests")]
use azul_layout::text3::selection::*;
#[test]
fn test_word_boundaries_simple() {
let text = "Hello World";
let (start, end) = find_word_boundaries(text, 2);
assert_eq!(&text[start..end], "Hello");
let (start, end) = find_word_boundaries(text, 7);
assert_eq!(&text[start..end], "World");
let (start, end) = find_word_boundaries(text, 5);
assert_eq!(&text[start..end], " ");
}
#[test]
fn test_word_boundaries_start_end() {
let text = "Hello";
let (start, end) = find_word_boundaries(text, 0);
assert_eq!(&text[start..end], "Hello");
let (start, end) = find_word_boundaries(text, 5);
assert_eq!(&text[start..end], "Hello");
}
#[test]
fn test_word_boundaries_punctuation() {
let text = "Hello, World!";
let (start, end) = find_word_boundaries(text, 2);
assert_eq!(&text[start..end], "Hello");
let (start, end) = find_word_boundaries(text, 5);
assert_eq!(&text[start..end], ", ");
let (start, end) = find_word_boundaries(text, 8);
assert_eq!(&text[start..end], "World");
}
#[test]
fn test_word_boundaries_underscore() {
let text = "hello_world";
let (start, end) = find_word_boundaries(text, 5);
assert_eq!(&text[start..end], "hello_world");
}
#[test]
fn test_is_word_char() {
assert!(is_word_char('a'));
assert!(is_word_char('Z'));
assert!(is_word_char('0'));
assert!(is_word_char('_'));
assert!(!is_word_char(' '));
assert!(!is_word_char(','));
assert!(!is_word_char('!'));
}