Cover hyperlink colour across line breaks
This commit is contained in:
1 parent
9dc1f59f8e
commit
6414770de7
2 files changed
+28
-1
No files matched your search
+1
-1
@@ -115,7 +115,7 @@ See `docs/ROADMAP.md` for concrete implementation plans.
|
||||
- ASCII-only documents use non-embedded Base-14 Times/Courier (arXiv PDF is
|
||||
about 0.7 MB); documents with accented/non-WinAnsi text embed Liberation
|
||||
faces. Tables use natural column widths and centered rules.
|
||||
- `cargo fmt --check` passes; `cargo test --offline` (49 tests: 45 compiler
|
||||
- `cargo fmt --check` passes; `cargo test --offline` (50 tests: 46 compiler
|
||||
integration tests + 4 server tests) covers the three examples, the arXiv
|
||||
fixture, figure/table floats (top and bottom), newpage, page styles and `\thispagestyle`, SVG/PDF output,
|
||||
project API, static frontend assets, path traversal, the legacy
|
||||
|
||||
@@ -1392,6 +1392,33 @@ fn natbib_citations_use_author_year() {
|
||||
);
|
||||
}
|
||||
|
||||
fn text_has_fill(svg: &str, word: &str, fill: &str) -> bool {
|
||||
let needle = format!(">{word}</text>");
|
||||
let Some(end) = svg.find(&needle) else {
|
||||
return false;
|
||||
};
|
||||
let start = svg[..end].rfind("<text").expect("text element not found");
|
||||
svg[start..end].contains(fill)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hyperlink_colour_survives_line_breaks() {
|
||||
let source = r"\documentclass{article}
|
||||
\usepackage[margin=6.5cm]{geometry}
|
||||
\begin{document}
|
||||
\href{https://example.com/a}{alpha beta gamma delta epsilon zeta eta theta iota kappa}
|
||||
\end{document}";
|
||||
let value = fresh_preview(source, "hyperlink-wrap.tex");
|
||||
assert_eq!(value["status"], "ok", "{value}");
|
||||
let svg = page_svg(&value, 0);
|
||||
for word in ["alpha", "gamma", "kappa"] {
|
||||
assert!(
|
||||
text_has_fill(&svg, word, "fill=\"#008000\""),
|
||||
"hyperlink word {word} lost its green colour"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn href_text_is_painted_with_the_link_colour() {
|
||||
let source = r"\documentclass{article}
|
||||
|
||||
Reference in new issue
Block a user