mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 00:57:26 +00:00
Merge pull request #3156 from batistalucasv/test/7317-rtf-target-prefers-text-rtf
test(platform): restore rtf_target_prefers_text_rtf test (wordcraft#7317)
This commit is contained in:
@@ -27,6 +27,18 @@ fn cf_html_offsets_delimit_the_fragment_bytes() {
|
||||
assert_eq!(end_html, data.len() - 1);
|
||||
}
|
||||
|
||||
/// Ported from WordCraft (#7317). When multiple RTF targets are offered, text/rtf is preferred over application/rtf and text/richtext.
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
#[test]
|
||||
fn rtf_target_prefers_text_rtf() {
|
||||
use super::unix::rtf_target;
|
||||
let names = |n: &[&str]| n.iter().map(|s| s.to_string()).collect::<Vec<_>>();
|
||||
assert_eq!(rtf_target(&names(&["TARGETS", "text/richtext", "application/rtf", "text/rtf"])), Some("text/rtf"));
|
||||
assert_eq!(rtf_target(&names(&["text/richtext", "UTF8_STRING"])), Some("text/richtext"));
|
||||
assert_eq!(rtf_target(&names(&["text/html", "text/rtf;charset=x"])), None);
|
||||
assert_eq!(rtf_target(&[]), None);
|
||||
}
|
||||
|
||||
// Copied files reach the system clipboard as a file list holding the same paths, spaces and
|
||||
// non-ASCII names included; a URI that names no local file is never written as one, and a list
|
||||
// with no file in it leaves the write to the next flavour.
|
||||
|
||||
Reference in New Issue
Block a user