Advance native LaTeX execution and preview
This commit is contained in:
1 parent
91f9d76b16
commit
2741546ca8
414 files changed
+99872
-933
No files matched your search
@@ -0,0 +1,80 @@
|
||||
//! Owned script boxes, not a reconstructed diagnostic view of flat paint.
|
||||
#[path = "support/font_world.rs"]
|
||||
mod font_world;
|
||||
use std::{fs, process::Command};
|
||||
use texrra_tex_core::execution::*;
|
||||
#[test]
|
||||
fn actual_base_characters_script_boxes_shifts_and_recursive_lists_match_tex() {
|
||||
let fonts = include_str!("../../../examples/native-bootstrap/math-fonts.tex");
|
||||
let mut source = format!(r"{fonts}\showboxbreadth=1000\showboxdepth=50\tracingonline=1 ");
|
||||
let mut count = 0;
|
||||
for space in ["0pt", ".5pt", "-5pt"] {
|
||||
for style in [
|
||||
r"\textstyle",
|
||||
r"\scriptstyle",
|
||||
r"\scriptscriptstyle",
|
||||
r"\displaystyle",
|
||||
] {
|
||||
for formula in [
|
||||
r"x^2",
|
||||
r"x_i",
|
||||
r"x_i^j",
|
||||
r"{xy}_i^j",
|
||||
r"\hbox{Box}_i^j",
|
||||
r"{}_i^j",
|
||||
r"x^{i_j}_{k^l}",
|
||||
] {
|
||||
source.push_str(&format!(
|
||||
"\\scriptspace={space}\\setbox0=\\hbox{{${style} {formula}$}}\\showbox0\n"
|
||||
));
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
source.push_str(r"\end");
|
||||
let e = Executor::new(State::initex().with_etex(), Limits::default())
|
||||
.run(
|
||||
SourceFile {
|
||||
name: "probe.tex".into(),
|
||||
data: source.as_bytes().to_vec(),
|
||||
},
|
||||
&mut font_world::FontFiles,
|
||||
)
|
||||
.unwrap();
|
||||
let dir = std::env::temp_dir().join(format!("texrra-owned-scripts-{}", std::process::id()));
|
||||
fs::create_dir_all(&dir).unwrap();
|
||||
fs::write(dir.join("probe.tex"), &source).unwrap();
|
||||
let r = Command::new("pdftex")
|
||||
.args(["-ini", "-etex", "-interaction=nonstopmode", "probe.tex"])
|
||||
.current_dir(&dir)
|
||||
.output()
|
||||
.unwrap();
|
||||
let log = fs::read_to_string(dir.join("probe.log")).unwrap();
|
||||
assert_eq!(r.status.code(), Some(1));
|
||||
assert!(
|
||||
log.lines()
|
||||
.filter(|l| l.starts_with("! "))
|
||||
.all(|l| l == "! OK.")
|
||||
);
|
||||
let reports: Vec<_> = e
|
||||
.events
|
||||
.iter()
|
||||
.filter_map(|e| {
|
||||
if let Event::ShowBox(r) = e {
|
||||
Some(r)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(reports.len(), count);
|
||||
for (i, r) in reports.iter().enumerate() {
|
||||
assert!(
|
||||
log.contains(&r.text),
|
||||
"case {i}, actual native box:\n{}\nreference saved: {}",
|
||||
r.text,
|
||||
dir.display()
|
||||
);
|
||||
}
|
||||
fs::remove_dir_all(dir).unwrap();
|
||||
}
|
||||
Reference in new issue
Block a user