Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

Tests: field highlights are on by default, so the toggle reads "Hide field highlights" (#2273)

vangel76f295be1e057a
diff --git a/crates/ui-egui/tests/ui_group/animate.rs b/crates/ui-egui/tests/ui_group/animate.rs
index 20008edd6..d01bf6de1 100644
--- a/crates/ui-egui/tests/ui_group/animate.rs
+++ b/crates/ui-egui/tests/ui_group/animate.rs
@@ -67,6 +67,7 @@ fn push_buttons_alone_show_no_form_bar_and_a_screen_annotation_is_not_a_comment(
}
assert!(h.query_by_label_contains("interactive form fields").is_none(), "nothing to fill in, so no form bar");
assert!(h.query_by_label("Highlight fields").is_none());
+ assert!(h.query_by_label("Hide field highlights").is_none());
}
#[test]
@@ -75,5 +76,5 @@ fn a_fillable_field_beside_push_buttons_still_shows_the_form_bar() {
let text = "<< /Type /Annot /Subtype /Widget /FT /Tx /T (name) /Rect [20 160 200 180] /P 3 0 R >>";
let h = open(pdf(&[&button, text, SCREEN]));
h.get_by_label_contains("This document contains 2 interactive form fields.");
- h.get_by_label("Highlight fields");
+ h.get_by_label("Hide field highlights");
}
diff --git a/crates/ui-egui/tests/ui_group/xfa.rs b/crates/ui-egui/tests/ui_group/xfa.rs
index 6565a9816..ee44ec823 100644
--- a/crates/ui-egui/tests/ui_group/xfa.rs
+++ b/crates/ui-egui/tests/ui_group/xfa.rs
@@ -58,8 +58,8 @@ fn a_dynamic_xfa_form_is_laid_out_and_filled() {
let doc = s.session.get(s.views[0].id).unwrap();
assert_eq!(doc.info.pages.len(), 2);
assert!(doc.form.iter().any(|f| f.name == "familyName"));
- // The notice offers to highlight the fields, like any form.
- h.get_by_label("Highlight fields");
+ // The notice offers the highlight toggle, like any form; highlights are on by default.
+ h.get_by_label("Hide field highlights");
}
#[test]
@@ -87,8 +87,8 @@ fn a_static_xfa_form_is_filled_from_its_data_and_says_so() {
assert_eq!(doc.form.iter().find(|f| f.name == "form1[0].page1[0].name[0]").unwrap().value, vec!["Ada".to_string()]);
assert_eq!(doc.form.iter().find(|f| f.name == "form1[0].page1[0].agree[0]").unwrap().value, vec!["1".to_string()]);
assert!(!doc.dirty);
- // The fields can still be highlighted from the notice.
- h.get_by_label("Highlight fields");
+ // The highlight toggle (on by default, so it reads "Hide") is still in the notice.
+ h.get_by_label("Hide field highlights");
}
#[test]