mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-05-07 22:58:10 +03:00
feat(keyboard): shortcuts, color of "Reset to defaults"
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -58,6 +58,39 @@ void main() {
|
||||
['primary', 'ctrl', 'alt', 'shift']);
|
||||
});
|
||||
|
||||
test('shortcutBindingMapsFrom ignores malformed bindings', () {
|
||||
expect(shortcutBindingMapsFrom('not a list'), isEmpty);
|
||||
|
||||
final bindings = shortcutBindingMapsFrom([
|
||||
{
|
||||
'action': kShortcutActionScreenshot,
|
||||
'mods': ['primary'],
|
||||
'key': 'p',
|
||||
},
|
||||
'bad',
|
||||
1,
|
||||
{
|
||||
'action': kShortcutActionToggleMute,
|
||||
'mods': ['alt'],
|
||||
'key': 's',
|
||||
},
|
||||
]);
|
||||
|
||||
expect(bindings, hasLength(2));
|
||||
expect(bindings.map((binding) => binding['action']), [
|
||||
kShortcutActionScreenshot,
|
||||
kShortcutActionToggleMute,
|
||||
]);
|
||||
});
|
||||
|
||||
test('shortcutModSetFrom ignores malformed modifiers', () {
|
||||
expect(shortcutModSetFrom('not a list'), isEmpty);
|
||||
expect(shortcutModSetFrom(['primary', 1, 'alt', null, 'primary']), {
|
||||
'primary',
|
||||
'alt',
|
||||
});
|
||||
});
|
||||
|
||||
test('non-desktop defaults exclude desktop-only and tab shortcuts', () {
|
||||
final defaults = [
|
||||
{
|
||||
@@ -85,6 +118,11 @@ void main() {
|
||||
'mods': ['primary', 'alt', 'shift'],
|
||||
'key': 'right_bracket',
|
||||
},
|
||||
{
|
||||
'action': kShortcutActionToggleRelativeMouseMode,
|
||||
'mods': ['primary', 'alt', 'shift'],
|
||||
'key': 'g',
|
||||
},
|
||||
];
|
||||
|
||||
final filtered = filterDefaultBindingsForPlatform(
|
||||
@@ -158,6 +196,7 @@ void main() {
|
||||
final ids = idSet(groups);
|
||||
// Desktop-only actions are stripped.
|
||||
expect(ids, isNot(contains(kShortcutActionToggleFullscreen)));
|
||||
expect(ids, isNot(contains(kShortcutActionToggleRelativeMouseMode)));
|
||||
expect(ids, isNot(contains(kShortcutActionScreenshot)));
|
||||
expect(ids, isNot(contains(kShortcutActionToggleToolbar)));
|
||||
expect(ids, isNot(contains(kShortcutActionCloseTab)));
|
||||
|
||||
Reference in New Issue
Block a user