Add test for ticket #16731.