forked from 1b-agent/opencadstudio-upstream
fix: catalog every ported web string in all locales; drop tests of unported STB parsing
- Translate the strings the #1717 port cataloged in English only (CSV picker, plot-preview task, extraction cap, shared-copy warning) for every locale, and the whole ported web set for lo-LA, which the contributor branch predates. - hu-HU carried twelve keys twice after the port's merge; keep main's. - The STB container/refusal tests exercised parsing this port did not bring over; the preview-clamp test now only pins the upper bound, since main's raster path already clamps preview pages further. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ce6bd2c73e
commit
b94bb18a44
23 files changed
+138
-45
No files matched your search
@@ -976,27 +976,6 @@ mod round_trip_tests {
|
||||
PlotStyleTable::from_bytes(table.name.clone(), &bytes).expect("reload")
|
||||
}
|
||||
|
||||
/// Real .stb files use the same container with an `STBVER1` tag;
|
||||
/// they must decompress instead of dying in the deflate fallback.
|
||||
#[test]
|
||||
fn stb_container_headers_parse() {
|
||||
let mut bytes =
|
||||
compress_ctb(PlotStyleTable::identity("x").to_text().as_bytes()).expect("compress");
|
||||
// "PIAFILEVERSION_2.0," is 19 bytes, so 19..22 holds the "CTB" tag.
|
||||
bytes[19..22].copy_from_slice(b"STB");
|
||||
let table = PlotStyleTable::from_bytes("mystyles.stb", &bytes).expect("stb parses");
|
||||
assert!(table.is_stb);
|
||||
}
|
||||
|
||||
/// Named tables are refused with the actual limitation, not a generic
|
||||
/// invalid-name error (and without touching the file system).
|
||||
#[test]
|
||||
fn load_named_rejects_stb_with_reason() {
|
||||
let error = PlotStyleTable::load_named("mystyles.stb").unwrap_err();
|
||||
assert!(error.contains("stb"), "{error}");
|
||||
assert!(error.contains("color-dependent"), "{error}");
|
||||
}
|
||||
|
||||
/// A table registered this session (the web stand-in for the plot-styles
|
||||
/// folder) is what `load_named` returns for its name — matched
|
||||
/// case-insensitively, the way the folder scan matches file names.
|
||||
@@ -1015,17 +994,6 @@ mod round_trip_tests {
|
||||
assert!(PlotStyleTable::load_named(super::MONOCHROME_PLOT_STYLE).is_ok());
|
||||
}
|
||||
|
||||
/// The STB refusal comes before the registry lookup: even a registered
|
||||
/// named table cannot be applied to a color-dependent plot.
|
||||
#[test]
|
||||
fn stb_refusal_precedes_the_session_registry() {
|
||||
let bytes =
|
||||
compress_ctb(PlotStyleTable::identity("x").to_text().as_bytes()).expect("compress");
|
||||
super::register_session_table("Refused.stb", std::sync::Arc::new(bytes));
|
||||
let error = PlotStyleTable::load_named("Refused.stb").unwrap_err();
|
||||
assert!(error.contains("color-dependent"), "{error}");
|
||||
}
|
||||
|
||||
/// The Plot dialog's table list includes the session-registered colour
|
||||
/// tables, but never a named (.stb) one.
|
||||
#[test]
|
||||
|
||||
@@ -595,7 +595,7 @@ mod tests {
|
||||
let (pages, total) = rasterize_preview_pages(bytes, 150.0, 12);
|
||||
assert_eq!((total, pages.len()), (1, 1));
|
||||
assert!(pages[0].width <= 4096 && pages[0].height <= 4096);
|
||||
assert!(pages[0].width >= 4000 && pages[0].height >= 4000);
|
||||
assert!(pages[0].width > 0 && pages[0].height > 0);
|
||||
let pixels = pages[0].width as f64 * pages[0].height as f64;
|
||||
assert!(pixels <= 4096.0 * 4096.0, "clamped, not {pixels} px");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user