Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #94 Dropped/Sold items can't be removed from HUD #95

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix #94 -- copy-paste considered harmful
Djikstra is alleged to have provided that title for the essay,
I have read. He was a real trickster figure.
ceejbot committed Dec 21, 2023
commit cdbbe56fbbdc2d50858ffd351409c861e8abb8c7
18 changes: 18 additions & 0 deletions src/controller/cycleentries.rs
Original file line number Diff line number Diff line change
@@ -458,4 +458,22 @@ mod tests {
let id = cycle.find_next_id();
assert_eq!(id, 1);
}

#[test]
fn filtering() {
use crate::data::item_cache::ItemCache;
let mut cache = ItemCache::new();
let mut cycle = Vec::<String>::new();

let item = cache.get(&"form-one".to_string());
assert!(cycle.add(&item.form_string()));
let item2 = cache.get(&"form-two".to_string());
assert!(cycle.add(&item2.form_string()));
let item3 = cache.get(&"form-three".to_string());
cycle.add(&item3.form_string());
assert_eq!(cycle.len(), 3);

assert!(cycle.filter_id(&"form-two"));
assert_eq!(cycle.len(), 2);
}
}
4 changes: 2 additions & 2 deletions src/controller/cycles.rs
Original file line number Diff line number Diff line change
@@ -201,10 +201,10 @@ impl CycleData {
self.utility.filter_id(form_spec);
}
if kind.left_hand_ok() {
self.utility.filter_id(form_spec);
self.left.filter_id(form_spec);
}
if kind.right_hand_ok() {
self.utility.filter_id(form_spec);
self.right.filter_id(form_spec);
}
}