+$first_win = open_window;
+
+################################################################################
+# verify that moving to the current ws moves to the previous one with
+# workspace_auto_back_and_forth.
+################################################################################
+
+cmd qq|workspace "$first_ws"|;
+$second_win = open_window;
+
+is(@{get_ws_content($second_ws)}, 1, 'one container on ws 2 before moving');
+cmd qq|move workspace "$first_ws"|;
+is(@{get_ws_content($second_ws)}, 2, 'two containers on ws 2');
+
+################################################################################
+# Now see if "workspace number <number>" also works as expected with
+# workspace_auto_back_and_forth enabled.
+################################################################################
+
+cmd 'workspace number 5';
+ok(get_ws('5')->{focused}, 'workspace 5 focused');
+# ensure it stays open
+cmd 'open';
+
+cmd 'workspace number 6';
+ok(get_ws('6')->{focused}, 'workspace 6 focused');
+# ensure it stays open
+cmd 'open';
+
+cmd 'workspace number 6';
+is(focused_ws, '5', 'workspace 5 focused again');
+
+################################################################################
+# Rename the workspaces and see if workspace number still works with BAF.
+################################################################################
+
+cmd 'rename workspace 5 to 5: foo';
+cmd 'rename workspace 6 to 6: baz';
+
+is(focused_ws, '5: foo', 'workspace 5 still focused');
+
+cmd 'workspace number 6';
+is(focused_ws, '6: baz', 'workspace 6 now focused');
+
+cmd 'workspace number 6';
+is(focused_ws, '5: foo', 'workspace 5 focused again');
+
+################################################################################
+# Place a window in the scratchpad, see if BAF works after showing the
+# scratchpad window.
+################################################################################
+
+my $scratchwin = open_window;
+cmd 'move scratchpad';
+
+# show scratchpad window
+cmd 'scratchpad show';
+
+# hide scratchpad window
+cmd 'scratchpad show';
+
+cmd 'workspace back_and_forth';
+is(focused_ws, '6: baz', 'workspace 6 now focused');