Ticket #5797: Add test case, that now works.

Hi,

This ticket has been fixed by some previous commit, and this patch adds the test case as unit test. Thanks to consider merging.

Cheers,
  Simon