Fix z-index on shape grouping/ungrouping
When grouping, the command should change z-index as little as possible.
If the new shape was above the group, it should be appended, if it was
below the group, it should be prepended.
The same should happen on ungrouping: the ungrouped shapes should be
added right above their previous parent.
This patch also rewrites TestShapeGroupCommand
BUG:381344