mirror of
https://github.com/harivansh-afk/deskctl.git
synced 2026-04-16 15:02:36 +00:00
tests and tooling (#4)
* init openspec * clean out src, move mod into lib, remove trash * create tests * pre-commit hook * add tests to CI * update website * README, CONTRIBUTING and Makefile * openspec * archive task * fix ci order * fix integration test * fix validation tests
This commit is contained in:
parent
7dfab68304
commit
3819a85c47
24 changed files with 892 additions and 286 deletions
|
|
@ -136,8 +136,12 @@ impl RefMap {
|
|||
|
||||
/// Resolve a selector to the center coordinates of the window.
|
||||
pub fn resolve_to_center(&self, selector: &str) -> Option<(i32, i32)> {
|
||||
self.resolve(selector)
|
||||
.map(|entry| (entry.x + entry.width as i32 / 2, entry.y + entry.height as i32 / 2))
|
||||
self.resolve(selector).map(|entry| {
|
||||
(
|
||||
entry.x + entry.width as i32 / 2,
|
||||
entry.y + entry.height as i32 / 2,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn entries(&self) -> impl Iterator<Item = (&String, &RefEntry)> {
|
||||
|
|
@ -182,7 +186,10 @@ mod tests {
|
|||
|
||||
assert_eq!(refs.resolve("@w1").unwrap().window_id, window_id);
|
||||
assert_eq!(refs.resolve(&window_id).unwrap().backend_window_id, 42);
|
||||
assert_eq!(refs.resolve(&format!("id={window_id}")).unwrap().title, "Editor");
|
||||
assert_eq!(
|
||||
refs.resolve(&format!("id={window_id}")).unwrap().title,
|
||||
"Editor"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue