This merge request fixes bugs 407244 and 380462.
I have created an issue in this project to track the progress: Issue #1 (closed)
In case the game is over, the currently active block was not moved leaving it ambiguous to how/why the game is over. After this fix, not only is the last block moved to its final position, but also the next piece is placed, making it clear where it conflicts with the pieces already on the board.
If you want to reproduce to bug and verify the fix, I suggest the following:
- Stack blocks in the center until only two lines are left on the top.
- Move all appearing blocks to the left/right and drop them. A vertical 4-block will conflict with the stack of blocks in the center. 3a. Before the fix: The last block is not dropped, but still hovers in the air. 3b. After the fix: The last block is dropped, and the vertical 4-block is displayed, clearly conflicting with the existing blocks.
The actual fix is ~6 lines of code, but I have recently read Michael C. Feathers seminal book "Working effectively with legacy code" and tried to apply all good practices. Thus, many commits are centered around setting up unit tests, creating interface and mock classes and refactoring existing classes to be able to introduce tests alongside the changes. I decided to go this route because I have further ideas for KBlocks.