mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-15 03:36:57 -04:00
Merge PR #1652
This commit is contained in:
commit
89b6a34595
2 files changed
+27
No files matched your search
@@ -895,6 +895,28 @@ mod tests {
|
||||
assert_eq!(h.app.session.filter.text, "wedding", "and the library is filtered by it");
|
||||
}
|
||||
|
||||
/// Issue #1648: clearing the filters from the loupe's pill empties the search field too, so
|
||||
/// the field never shows a search that is no longer applied.
|
||||
#[test]
|
||||
fn clearing_the_loupe_filters_empties_the_search_field() {
|
||||
let mut h = demo([1200.0, 760.0]);
|
||||
let t = Duration::from_secs(10);
|
||||
h.settle(SETTLE);
|
||||
for (method, params) in [("ui.clickWidget", json!({"id": "field:search"})), ("ui.text", json!({"text": "a"}))] {
|
||||
let r = h.request(method, params, t);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
h.settle(SETTLE);
|
||||
}
|
||||
assert_eq!(h.app.session.filter.text, "a", "filtered while typing");
|
||||
assert!(!h.app.session.visible_cloned().is_empty(), "the search finds photos, so the loupe has one to show");
|
||||
h.request("engine.execute", json!({"command": "view.detail"}), t);
|
||||
h.settle(SETTLE);
|
||||
let r = h.request("ui.clickWidget", json!({"id": "loupe:filters"}), t);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
h.settle(SETTLE);
|
||||
assert_eq!((h.app.ui.search.as_str(), h.app.session.filter.text.as_str()), ("", ""));
|
||||
}
|
||||
|
||||
/// Esc in the search field gives back the search from before the edit, and the filter with it.
|
||||
#[test]
|
||||
fn escape_in_the_search_field_gives_back_the_search() {
|
||||
|
||||
@@ -537,6 +537,11 @@ impl LightcraftApp {
|
||||
.map(|d| d.crop.aspect.map_or(serde_json::json!("free"), |(w, h)| serde_json::json!([w as f64 / 100.0, h as f64 / 100.0])))
|
||||
};
|
||||
}
|
||||
if r.is_ok() && id == "library.clearFilter" {
|
||||
// the search field shows the text filter: cleared from anywhere (the loupe's pill, the
|
||||
// menu), it must not keep a search that no longer applies (issue #1648)
|
||||
self.ui.search.clear();
|
||||
}
|
||||
if r.is_ok() && id == "mask.adjust" {
|
||||
// Judge local adjustments on the photo, without the selection overlay obscuring them.
|
||||
// Keep it hidden after release; O / the overlay eye can show it again.
|
||||
|
||||
Reference in new issue
Block a user