-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use zvariant::Type; | ||
|
||
/// An action which may be triggered through the accessibility API. | ||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Type)] | ||
pub struct Action { | ||
/// The name of the action | ||
pub name: String, | ||
/// Description of the action | ||
pub description: String, | ||
// TODO: should be an enum/stricter type; this is why it's in its own file. | ||
/// The keybinding(s) used to trigger it (without the AT). | ||
pub keybinding: String, | ||
} | ||
|
||
#[cfg(test)] | ||
mod test { | ||
use super::Action; | ||
use zbus_lockstep::method_return_signature; | ||
use zvariant::Type; | ||
#[test] | ||
fn validate_action_signature() { | ||
// signature is of type `a(sss)`, where `(sss)` is the type we're validating. | ||
let action_signature = | ||
method_return_signature!(member: "GetActions", interface: "org.a11y.atspi.Action") | ||
.slice(1..); | ||
assert_eq!(Action::signature(), action_signature); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters