diff options
| author | Stefan Kangas | 2021-10-13 00:04:23 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2021-10-28 22:21:16 +0200 |
| commit | 2671ea0de8e90e20241fe0441f4f8b79eeccdb12 (patch) | |
| tree | 8f7706ebb6178963fefd94131b2de5ddfd3a58c9 /test/src | |
| parent | 64cc31b5c80ab165c4e565ff8943919d832ebd2f (diff) | |
| download | emacs-2671ea0de8e90e20241fe0441f4f8b79eeccdb12.tar.gz emacs-2671ea0de8e90e20241fe0441f4f8b79eeccdb12.zip | |
Be more allowing when looking for menu-bar items
* src/keymap.c (lookup_key_1): Factor out function from
Flookup_key.
(Flookup_key): Be case insensitive, and treat spaces as dashes,
when looking for Qmenu_bar items. (Bug#50752)
* test/src/keymap-tests.el
(keymap-lookup-key/mixed-case)
(keymap-lookup-key/mixed-case-multibyte)
(keymap-lookup-keymap/with-spaces)
(keymap-lookup-keymap/with-spaces-multibyte)
(keymap-lookup-keymap/with-spaces-multibyte-lang-env): New tests.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/keymap-tests.el | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/src/keymap-tests.el b/test/src/keymap-tests.el index 13f47b45f81..fc4dce01827 100644 --- a/test/src/keymap-tests.el +++ b/test/src/keymap-tests.el | |||
| @@ -124,6 +124,49 @@ | |||
| 124 | ;; (ert-deftest keymap-lookup-key/accept-default () | 124 | ;; (ert-deftest keymap-lookup-key/accept-default () |
| 125 | ;; ...) | 125 | ;; ...) |
| 126 | 126 | ||
| 127 | (ert-deftest keymap-lookup-key/mixed-case () | ||
| 128 | "Backwards compatibility behaviour (Bug#50752)." | ||
| 129 | (let ((map (make-keymap))) | ||
| 130 | (define-key map [menu-bar foo bar] 'foo) | ||
| 131 | (should (eq (lookup-key map [menu-bar foo bar]) 'foo)) | ||
| 132 | (should (eq (lookup-key map [menu-bar Foo Bar]) 'foo))) | ||
| 133 | (let ((map (make-keymap))) | ||
| 134 | (define-key map [menu-bar i-bar] 'foo) | ||
| 135 | (should (eq (lookup-key map [menu-bar I-bar]) 'foo)))) | ||
| 136 | |||
| 137 | (ert-deftest keymap-lookup-key/mixed-case-multibyte () | ||
| 138 | "Backwards compatibility behaviour (Bug#50752)." | ||
| 139 | (let ((map (make-keymap))) | ||
| 140 | ;; (downcase "Åäö") => "åäö" | ||
| 141 | (define-key map [menu-bar åäö bar] 'foo) | ||
| 142 | (should (eq (lookup-key map [menu-bar åäö bar]) 'foo)) | ||
| 143 | (should (eq (lookup-key map [menu-bar Åäö Bar]) 'foo)) | ||
| 144 | ;; (downcase "Γ") => "γ" | ||
| 145 | (define-key map [menu-bar γ bar] 'baz) | ||
| 146 | (should (eq (lookup-key map [menu-bar γ bar]) 'baz)) | ||
| 147 | (should (eq (lookup-key map [menu-bar Γ Bar]) 'baz)))) | ||
| 148 | |||
| 149 | (ert-deftest keymap-lookup-keymap/with-spaces () | ||
| 150 | "Backwards compatibility behaviour (Bug#50752)." | ||
| 151 | (let ((map (make-keymap))) | ||
| 152 | (define-key map [menu-bar foo-bar] 'foo) | ||
| 153 | (should (eq (lookup-key map [menu-bar Foo\ Bar]) 'foo)))) | ||
| 154 | |||
| 155 | (ert-deftest keymap-lookup-keymap/with-spaces-multibyte () | ||
| 156 | "Backwards compatibility behaviour (Bug#50752)." | ||
| 157 | (let ((map (make-keymap))) | ||
| 158 | (define-key map [menu-bar åäö-bar] 'foo) | ||
| 159 | (should (eq (lookup-key map [menu-bar Åäö\ Bar]) 'foo)))) | ||
| 160 | |||
| 161 | (ert-deftest keymap-lookup-keymap/with-spaces-multibyte-lang-env () | ||
| 162 | "Backwards compatibility behaviour (Bug#50752)." | ||
| 163 | (let ((lang-env current-language-environment)) | ||
| 164 | (set-language-environment "Turkish") | ||
| 165 | (let ((map (make-keymap))) | ||
| 166 | (define-key map [menu-bar i-bar] 'foo) | ||
| 167 | (should (eq (lookup-key map [menu-bar I-bar]) 'foo))) | ||
| 168 | (set-language-environment lang-env))) | ||
| 169 | |||
| 127 | (ert-deftest describe-buffer-bindings/header-in-current-buffer () | 170 | (ert-deftest describe-buffer-bindings/header-in-current-buffer () |
| 128 | "Header should be inserted into the current buffer. | 171 | "Header should be inserted into the current buffer. |
| 129 | https://debbugs.gnu.org/39149#31" | 172 | https://debbugs.gnu.org/39149#31" |