Backported tests for issue #22406.