[#444] Fix renaming of unused pic#xxx icons

The error was being caused because, in a situation where an icon wasn't
being used, no mapid was created and the icon instead gained the mapid
of 0.

This meant the table row was overwritten in any attempt to rename
another anonymous icon, since again the mapid was set to 0.

Fix is to make sure we generate a new mapid if it doesn't already exist,
then update the userpicmap3 row for this pic#xxx so that it points to
the correct (renamed to) keyword.

Commit includes a test for the renaming of userpics with no keywords.
Merge pull request #939 'renaming-unused-picxxx-bug-444' into develop

* renaming-unused-picxxx-bug-444:
  [#444] Fix renaming of unused pic#xxx icons