mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-14 22:54:16 +00:00
AEP #3319: remove duplicate integrated report test module
This commit is contained in:
@@ -311,56 +311,3 @@ mod tests {
|
||||
assert_eq!(report.losses[0].unlisted, 5);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// A report with losses in two categories, as the collector finishes it.
|
||||
fn collected() -> ExportReport {
|
||||
let mut col = Collector::default();
|
||||
col.exported.layers = 2;
|
||||
col.lose(LossCategory::RoundedTimes, "time 1");
|
||||
col.lose(LossCategory::Effects, String::from("fx 1"));
|
||||
col.lose(LossCategory::Effects, "fx 2");
|
||||
let mut report = col.finish();
|
||||
report.limitations.truncate(1);
|
||||
report.limitations[0] = "limit".into();
|
||||
report
|
||||
}
|
||||
|
||||
/// The JSON shape agents read: field names, category spelling, order and the loss entries.
|
||||
#[test]
|
||||
fn the_json_shape_is_pinned() {
|
||||
let json = serde_json::to_string(&collected()).unwrap();
|
||||
assert_eq!(
|
||||
json,
|
||||
r#"{"exported":{"folders":0,"compositions":0,"solids":0,"layers":2,"solidLayers":0,"nullLayers":0,"adjustmentLayers":0,"properties":0,"keyframes":0,"expressions":0,"masks":0,"precompLayers":0,"effects":0,"footage":0,"footageLayers":0,"textLayers":0,"markers":0,"cameras":0,"lights":0,"shapeLayers":0,"timeRemaps":0,"textAnimators":0,"layerStyles":0},"losses":[{"category":"effects","count":2,"details":["fx 1","fx 2"],"unlisted":0},{"category":"rounded_times","count":1,"details":["time 1"],"unlisted":0}],"limitations":["limit"]}"#
|
||||
);
|
||||
let back: ExportReport = serde_json::from_str(&json).unwrap();
|
||||
assert_eq!(back, collected());
|
||||
}
|
||||
|
||||
/// The queries read the losses.
|
||||
#[test]
|
||||
fn the_queries_read_the_losses() {
|
||||
let report = collected();
|
||||
assert_eq!((report.total_losses(), report.is_lossless()), (3, false));
|
||||
assert_eq!((report.count(LossCategory::Effects), report.count(LossCategory::Lights)), (2, 0));
|
||||
assert_eq!(report.summary(), "effects: 2, rounded times: 1");
|
||||
let empty = Collector::default().finish();
|
||||
assert_eq!((empty.total_losses(), empty.is_lossless(), empty.summary()), (0, true, String::new()));
|
||||
}
|
||||
|
||||
/// Details stop at the cap.
|
||||
#[test]
|
||||
fn details_stop_at_the_cap() {
|
||||
let mut col = Collector::default();
|
||||
for i in 0..MAX_DETAILS + 5 {
|
||||
col.lose(LossCategory::Masks, format!("mask {i}"));
|
||||
}
|
||||
let report = col.finish();
|
||||
assert_eq!(report.count(LossCategory::Masks), MAX_DETAILS + 5);
|
||||
assert_eq!(report.losses[0].details.len(), MAX_DETAILS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user