DrawCommand(s) and unit testing


In order for all commands to work after multiple undo/redo operations,
the added hydrogens also need to have the same id every time. To solve
this problem, I added two parameters to the
Molecule::addHydrogens(Atom *atom, QList atomIds =
QList(), QList bondIds = …) function.
To ensure this is all working, I added some unit tests for this.

Adjusting hydrogens is now handled by two separate commands:
AdjustHydrogens[Pre/Post]Command which are created/called from the
other commands (AddAtom, …). This, together with the unit tests
allows us to replace the workings of some commands that still copy the
molecule. I already did this for the DeleteAtom command (recording
atom info, bond info and info about hydrogens on heavy neighbor
atoms). DeleteBond, InsertFragment, HydrogensCommand still have to be

If you still find problems with the drawing tool and undo/redo-ing,
try to file a bug report with a minimum amount of draw actions needed
to reproduce it. Also, I’d be really interested in more test cases
which I might have overlooked.