Tree @master (Download .tar.gz)
- ..
- 000-load-deps.t
- 001-tile.t
- 002-i3-sync.t
- 003-ipc.t
- 004-unmanaged.t
- 005-floating.t
- 100-fullscreen.t
- 101-focus.t
- 102-dock.t
- 104-focus-stack.t
- 111-goto.t
- 112-floating-resize.t
- 113-urgent.t
- 114-client-leader.t
- 115-ipc-workspaces.t
- 116-nestedcons.t
- 117-workspace.t
- 118-openkill.t
- 119-match.t
- 120-multiple-cmds.t
- 121-next-prev.t
- 122-split.t
- 124-move.t
- 126-regress-close.t
- 127-regress-floating-parent.t
- 128-open-order.t
- 129-focus-after-close.t
- 130-close-empty-split.t
- 131-stacking-order.t
- 132-move-workspace.t
- 133-size-hints.t
- 134-invalid-command.t
- 135-floating-focus.t
- 136-floating-ws-empty.t
- 137-floating-unmap.t
- 138-floating-attach.t
- 139-ws-numbers.t
- 140-focus-lost.t
- 141-resize.t
- 142-regress-move-floating.t
- 143-regress-floating-restart.t
- 144-regress-floating-resize.t
- 145-flattening.t
- 146-floating-reinsert.t
- 147-regress-floatingmove.t
- 148-regress-floatingmovews.t
- 150-regress-dock-restart.t
- 151-regress-float-size.t
- 152-regress-level-up.t
- 153-floating-originalsize.t
- 154-regress-multiple-dock.t
- 155-floating-split-size.t
- 156-fullscreen-focus.t
- 158-wm_take_focus.t
- 159-socketpaths.t
- 161-regress-borders-restart.t
- 162-regress-dock-urgent.t
- 163-wm-state.t
- 164-kill-win-vs-client.t
- 165-for_window.t
- 166-assign.t
- 167-workspace_layout.t
- 168-regress-fullscreen-restart.t
- 169-border-toggle.t
- 170-force_focus_wrapping.t
- 171-config-migrate.t
- 172-start-on-named-ws.t
- 173-get-marks.t
- 174-border-config.t
- 175-startup-notification.t
- 176-workspace-baf.t
- 177-bar-config.t
- 178-regress-workspace-open.t
- 179-regress-multiple-ws.t
- 180-fd-leaks.t
- 181-regress-float-border.t
- 182-regress-focus-dock.t
- 183-config-variables.t
- 184-regress-float-split-resize.t
- 185-scratchpad.t
- 186-regress-assign-focus-parent.t
- 187-commands-parser.t
- 188-regress-focus-restart.t
- 189-floating-constraints.t
- 190-scratchpad-diff-ws.t
- 191-resize-levels.t
- 192-layout.t
- 193-ipc-version.t
- 194-regress-floating-size.t
- 195-net-active-window.t
- 196-randr-output-names.t
- 197-regression-move-vanish.t
- 198-regression-scratchpad-crash.t
- 199-ipc-mode-event.t
- 200-urgency-timer.t
- 201-config-parser.t
- 202-scratchpad-criteria.t
- 203-regress-assign-and-move.t
- 204-regress-scratchpad-move.t
- 205-ipc-windows.t
- 206-fullscreen-scratchpad.t
- 207-shmlog.t
- 208-regress-floating-criteria.t
- 209-ewmh-net-workarea.t
- 210-mark-unmark.t
- 211-regress-urgency-assign.t
- 212-assign-urgency.t
- 213-layout-restore-simple.t
- 214-layout-restore-criteria.t
- 215-layout-restore-crash.t
- 216-layout-restore-split-swallows.t
- 217-NET_CURRENT_DESKTOP.t
- 218-regress-floating-split.t
- 219-ipc-window-focus.t
- 220-ipc-window-title.t
- 221-floating-type-hints.t
- 222-regress-dock-resize.t
- 223-net-client-list.t
- 224-regress-resize-branch.t
- 225-ipc-window-fullscreen.t
- 226-internal-workspaces.t
- 227-ipc-workspace-empty.t
- 228-border-widths.t
- 229-cleanup-tmpdir.t
- 230-floating-fullscreen-restart.t
- 231-ipc-floating-event.t
- 232-cmd-move-criteria.t
- 233-regress-manage-focus-unmapped.t
- 234-ewmh-desktop-names.t
- 235-check-config-no-x.t
- 236-floating-focus-raise.t
- 237-regress-assign-focus.t
- 238-ipc-binding-event.t
- 239-net-close-window-request.t
- 240-focus-on-window-activation.t
- 241-consistent-center.t
- 242-no-focus.t
- 243-move-to-mark.t
- 244-new-workspace-floating-enable-center.t
- 245-move-position-mouse.t
- 246-window-decoration-focus.t
- 247-config-line-continuation.t
- 248-regress-urgency-clear.t
- 249-layout-restore-floating.t
- 250-layout-restore-multiple-criteria.t
- 251-command-criteria-focused.t
- 252-floating-size.t
- 253-multiple-net-wm-state-atoms.t
- 254-move-to-output-with-criteria.t
- 255-multiple-marks.t
- 256-no-auto-back-and-forth.t
- 257-keypress-group1-fallback.t
- 258-keypress-release.t
- 259-net-wm-user-time.t
- 260-invalid-criteria.t
- 261-match-con_id-con_mark-combinations.t
- 262-config-validation.t
- 263-config-reload-reverts-bind-mode.t
- 264-dock-criteria.t
- 265-ipc-mark.t
- 266-net-moveresize-window.t
- 267-regress-mark-restart.t
- 268-ipc-config.t
- 269-focus-stack-above.t
- 270-config-no-newline-end.t
- 271-for_window_tilingfloating.t
- 272-regress-focus-assign.t
- 273-regress-focus-toggle.t
- 274-move-branch-position.t
- 275-ipc-window-close.t
- 276-ipc-window-move.t
- 277-ipc-window-urgent.t
- 278-layout-restore-output.t
- 279-regress-default-floating-border.t
- 280-wm-class-change-handler.t
- 281-regress-reload-bindsym.t
- 282-tabbed-floating-disable-crash.t
- 283-net-wm-state-hidden.t
- 284-ewmh-visible-name.t
- 285-sticky.t
- 286-root-window-mouse-binding.t
- 287-edge-borders.t
- 288-i3-floating-window-atom.t
- 289-ipc-shutdown-event.t
- 290-keypress-numlock.t
- 291-swap.t
- 292-regress-layout-toggle.t
- 293-focus-follows-mouse.t
- 293-sticky-output-crash.t
- 294-focus-order.t
- 294-update-ewmh-atoms.t
- 295-net-wm-state-focused.t
- 296-regress-focus-behind-fullscreen-floating.t
- 297-assign-workspace-to-output.t
- 297-scroll-tabbed.t
- 298-ipc-misbehaving-connection.t
- 299-regress-scratchpad-focus.t
- 300-restart-non-utf8.t
- 301-shape.t
- 302-tree.t
- 303-regress-move-floating.t
- 304-ipc-workspace-init.t
- 305-restart-reply.t
- 306-move-to-parent.t
- 307-focus-next-prev.t
- 308-focus_wrapping.t
- 309-crash-move-parent.t
- 310-client-message-sticky.t
- 311-get-binding-modes.t
- 312-regress-layout-default.t
- 313-include.t
- 314-window-icon-padding.t
- 315-all-criterion.t
- 315-long-commands.t
- 316-drag-container.t
- 316-transient-for-loop.t
- 317-bar-config-font-order.t
- 317-bar-output-trailing-space.t
- 318-i3-dmenu-desktop.t
- 500-multi-monitor.t
- 501-scratchpad.t
- 502-focus-output.t
- 503-workspace.t
- 504-move-workspace-to-output.t
- 505-scratchpad-resolution.t
- 506-focus-right.t
- 507-workspace-move-crash.t
- 509-workspace_layout.t
- 510-focus-across-outputs.t
- 511-scratchpad-configure-request.t
- 512-move-wraps.t
- 513-move-workspace.t
- 514-ipc-workspace-multi-monitor.t
- 515-create-workspace.t
- 516-move.t
- 517-regress-move-direction-ipc.t
- 518-interpret-workspace-numbers.t
- 519-mouse-warping.t
- 520-regress-focus-direction-floating.t
- 521-ewmh-desktop-viewport.t
- 522-rename-assigned-workspace.t
- 523-move-position-center.t
- 524-move.t
- 525-i3bar-mouse-bindings.t
- 526-reconfigure-dock.t
- 527-focus-fallback.t
- 528-workspace-next-prev-reversed.t
- 529-net-wm-desktop.t
- 530-bug-2229.t
- 531-fullscreen-on-given-output.t
- 532-xresources.t
- 533-randr15.t
- 534-dont-warp.t
- 535-workspace-next-prev.t
- 536-net-wm-desktop_mm.t
- 537-move-single-to-output.t
- 538-i3bar-primary-output.t
- 539-disable_focus_wrapping.t
- 540-sigterm-cleanup.t
- 541-resize-set-tiling.t
- 542-layout-restore-remanage.t
- 543-move-workspace-to-multiple-outputs.t
- 544-focus-multiple-outputs.t
- 545-i3-registration.t
- 546-empty-bindcommand.t
- 547-explicit-mode-default.t
- 547-nested-variables.t
- 548-motif-hints.t
290-keypress-numlock.t @master — raw · history · blame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | #!perl
# vim:ts=4:sw=4:expandtab
#
# Please read the following documents before working on tests:
# • https://build.i3wm.org/docs/testsuite.html
# (or docs/testsuite)
#
# • https://build.i3wm.org/docs/lib-i3test.html
# (alternatively: perldoc ./testcases/lib/i3test.pm)
#
# • https://build.i3wm.org/docs/ipc.html
# (or docs/ipc)
#
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
# (unless you are already familiar with Perl)
#
# Verifies that one can bind on numpad keys in different numlock states.
# Ticket: #2346
# Bug still in: 4.12-78-g85bb324
use i3test i3_autostart => 0;
use i3test::XTEST;
use ExtUtils::PkgConfig;
SKIP: {
skip "libxcb-xkb too old (need >= 1.11)", 1 unless
ExtUtils::PkgConfig->atleast_version('xcb-xkb', '1.11');
my $config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# Same key, different numlock states.
bindsym Mod2+KP_1 nop KP_1
bindsym KP_End nop KP_End
# Binding which should work with numlock and without.
bindsym Mod4+a nop a
# Binding which should work with numlock and without, see issue #2418.
bindsym Escape nop Escape
# Binding which should work with numlock and without, see issue #2418.
bindsym Shift+Escape nop Shift+Escape
# Binding which should work with numlock and without, see issue #2418.
bindsym Mod1+Shift+q nop Mod1+Shift+q
# Binding which should work with numlock and without, see issue #2559.
bindcode 39 nop s
EOT
my $pid = launch_with_config($config);
is(listen_for_binding(
sub {
xtest_key_press(87); # KP_End
xtest_key_release(87); # KP_End
xtest_sync_with_i3;
},
),
'KP_End',
'triggered the "KP_End" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(87); # KP_1
xtest_key_release(87); # KP_1
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
xtest_sync_with_i3;
},
),
'KP_1',
'triggered the "KP_1" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(133); # Super_L
xtest_key_press(38); # a
xtest_key_release(38); # a
xtest_key_release(133); # Super_L
xtest_sync_with_i3;
},
),
'a',
'triggered the "a" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(133); # Super_L
xtest_key_press(38); # a
xtest_key_release(38); # a
xtest_key_release(133); # Super_L
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
xtest_sync_with_i3;
},
),
'a',
'triggered the "a" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(9); # Escape
xtest_key_release(9); # Escape
xtest_sync_with_i3;
},
),
'Escape',
'triggered the "Escape" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(9); # Escape
xtest_key_release(9); # Escape
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
xtest_sync_with_i3;
},
),
'Escape',
'triggered the "Escape" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(50); # Shift_L
xtest_key_press(9); # Escape
xtest_key_release(9); # Escape
xtest_key_release(50); # Shift_L
xtest_sync_with_i3;
},
),
'Shift+Escape',
'triggered the "Escape" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(50); # Shift_L
xtest_key_press(9); # Escape
xtest_key_release(9); # Escape
xtest_key_release(50); # Shift_L
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
xtest_sync_with_i3;
},
),
'Shift+Escape',
'triggered the "Escape" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(50); # Shift_L
xtest_key_press(64); # Alt_L
xtest_key_press(24); # q
xtest_key_release(24); # q
xtest_key_release(64); # Alt_L
xtest_key_release(50); # Shift_L
xtest_sync_with_i3;
},
),
'Mod1+Shift+q',
'triggered the "Mod1+Shift+q" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(50); # Shift_L
xtest_key_press(64); # Alt_L
xtest_key_press(24); # q
xtest_key_release(24); # q
xtest_key_release(64); # Alt_L
xtest_key_release(50); # Shift_L
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
xtest_sync_with_i3;
},
),
'Mod1+Shift+q',
'triggered the "Mod1+Shift+q" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(39); # s
xtest_key_release(39); # s
xtest_sync_with_i3;
},
),
's',
'triggered the "s" keybinding without Num_Lock');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(39); # s
xtest_key_release(39); # s
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
xtest_sync_with_i3;
},
),
's',
'triggered the "s" keybinding with Num_Lock');
exit_gracefully($pid);
################################################################################
# Verify bindings for modifiers work
################################################################################
$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
bindsym Mod4+Return nop Return
# Binding which should work with numlock and without, see issue #2559.
bindcode --release 133 nop Super_L
EOT
$pid = launch_with_config($config);
is(listen_for_binding(
sub {
xtest_key_press(133); # Super_L
xtest_key_release(133); # Super_L
xtest_sync_with_i3;
},
),
'Super_L',
'triggered the "Super_L" keybinding without Num_Lock');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(133); # Super_L
xtest_key_release(133); # Super_L
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
xtest_sync_with_i3;
},
),
'Super_L',
'triggered the "Super_L" keybinding with Num_Lock');
is(listen_for_binding(
sub {
xtest_key_press(133); # Super_L
xtest_key_press(36); # Return
xtest_key_release(36); # Return
xtest_key_release(133); # Super_L
xtest_sync_with_i3;
},
),
'Return',
'triggered the "Return" keybinding without Num_Lock');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(133); # Super_L
xtest_key_press(36); # Return
xtest_key_release(36); # Return
xtest_key_release(133); # Super_L
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
xtest_sync_with_i3;
},
),
'Return',
'triggered the "Return" keybinding with Num_Lock');
exit_gracefully($pid);
################################################################################
# Verify the binding is only triggered for KP_End, not KP_1
################################################################################
$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
bindsym KP_End nop KP_End
bindcode 88 nop KP_Down
EOT
$pid = launch_with_config($config);
is(listen_for_binding(
sub {
xtest_key_press(87); # KP_End
xtest_key_release(87); # KP_End
xtest_sync_with_i3;
},
),
'KP_End',
'triggered the "KP_End" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(88); # KP_Down
xtest_key_release(88); # KP_Down
xtest_sync_with_i3;
},
),
'KP_Down',
'triggered the "KP_Down" keybinding');
my @unexpected = events_for(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(87); # KP_1
xtest_key_release(87); # KP_1
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
xtest_sync_with_i3;
},
'binding');
is(scalar @unexpected, 0, 'Did not trigger the KP_End keybinding with KP_1');
my @unexpected2 = events_for(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(88); # KP_2
xtest_key_release(88); # KP_2
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
xtest_sync_with_i3;
},
'binding');
is(scalar @unexpected2, 0, 'Did not trigger the KP_Down keybinding with KP_2');
# TODO: This test does not verify that i3 does _NOT_ grab keycode 87 with Mod2.
exit_gracefully($pid);
################################################################################
# Verify mouse bindings are unaffected by NumLock
################################################################################
$config = <<EOT;
# i3 config file (v4)
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
bindsym --whole-window button4 nop button4
EOT
$pid = launch_with_config($config);
my $win = open_window;
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_button_press(4, 50, 50);
xtest_button_release(4, 50, 50);
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
xtest_sync_with_i3;
},
),
'button4',
'triggered the button4 keybinding with NumLock');
is(listen_for_binding(
sub {
xtest_button_press(4, 50, 50);
xtest_button_release(4, 50, 50);
xtest_sync_with_i3;
},
),
'button4',
'triggered the button4 keybinding without NumLock');
exit_gracefully($pid);
}
done_testing;
|