mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-29 01:34:29 +01:00
Links: a Show filter that hides every image titles the panel No matching images
Show Missing or another filter can leave the list empty while the document still holds images, and the empty panel said "No images". The filtered empty state now says "No matching images"; Show All keeps "No images".
This commit is contained in:
1 parent
85ce801302
commit
592ad486db
2 files changed
+20
-5
No files matched your search
@@ -786,14 +786,15 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
});
|
||||
})
|
||||
.show(ui, |ui, _| {
|
||||
// With no rows the body says how to bring an image in, as the other panels' empty states do.
|
||||
// With no rows the body says how to bring an image in, as the other panels' empty states do;
|
||||
// under a Show filter the document can still hold images that the filter hides.
|
||||
if row_ids.is_empty() {
|
||||
let detail = if o.show == "all" {
|
||||
tl!("File › Place… brings in an image, linked or embedded.")
|
||||
let (title, detail) = if o.show == "all" {
|
||||
(tl!("No images"), tl!("File › Place… brings in an image, linked or embedded."))
|
||||
} else {
|
||||
tl!("Nothing matches the Show filter.")
|
||||
(tl!("No matching images"), tl!("Nothing matches the Show filter."))
|
||||
};
|
||||
super::empty_state(ui, "link", tl!("No images"), detail);
|
||||
super::empty_state(ui, "link", title, detail);
|
||||
return;
|
||||
}
|
||||
let mut list = List::<u64>::new(tl!("Links")).selection(Bind::bound(&mut selection)).row_menu();
|
||||
|
||||
@@ -203,6 +203,20 @@ fn opening_the_panel_on_the_selected_image_leaves_another_document_alone() {
|
||||
assert_eq!(h.state().ui.links.show, None, "the request is dropped");
|
||||
}
|
||||
|
||||
/// A Show filter that hides every image titles the empty panel "No matching images", since the
|
||||
/// document still holds images; "No images" stays for a document with none.
|
||||
#[test]
|
||||
fn a_filter_that_hides_every_image_says_no_matching_images() {
|
||||
let dir = Folder::new("empty-filter-title");
|
||||
let (app, _, _) = app(&dir);
|
||||
let mut h = rig(app);
|
||||
command(&mut h, "ui.links.show", json!({"show": "missing"}));
|
||||
assert!(shown(&h, "No matching images"), "Show Missing with nothing missing");
|
||||
assert!(!shown(&h, "No images"), "the document holds two images");
|
||||
command(&mut h, "ui.links.show", json!({"show": "all"}));
|
||||
assert!(shown(&h, "linked.png") && !shown(&h, "No matching images"), "Show All lists the rows");
|
||||
}
|
||||
|
||||
/// A frame that fetches nothing keeps the stored rows and Link Info as they are, without a copy; the
|
||||
/// two-second recheck, another first selected image and an edit each store a new cache.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user