1. 07 May, 2021 2 commits
  2. 28 Apr, 2021 1 commit
  3. 14 Apr, 2021 2 commits
  4. 09 Apr, 2021 3 commits
  5. 08 Apr, 2021 1 commit
  6. 02 Apr, 2021 5 commits
  7. 28 Mar, 2021 1 commit
  8. 13 Mar, 2021 1 commit
  9. 24 Feb, 2021 1 commit
  10. 17 Feb, 2021 1 commit
    • Julian Helfferich's avatar
      Set mMessageBox pointer to nullptr · 8d717bad
      Julian Helfferich authored
      This is done to prevent double delete. Now, the deleteGameItemGroups()
      can safely be called multiple times.
      I have added a simple test to verify that there is no crash.
  11. 14 Feb, 2021 2 commits
    • Julian Helfferich's avatar
      Fix memory leak in KBlocksScene · 546a8ca3
      Julian Helfferich authored
      The destructor of KBlocksScene now calls deleteGameItemGroups() to
      ensure that the created objects are properly delete. This fixes a
      memory leak flagged by valgrind.
    • Julian Helfferich's avatar
      Fix memory leak in main · 5256838e
      Julian Helfferich authored
      Create KBlocksConfigManager on the stack to ensure that it is deleted
      when it goes out of scope.
  12. 29 Jan, 2021 1 commit
  13. 24 Jan, 2021 16 commits
    • Julian Helfferich's avatar
      Add missing initialization · 086563d9
      Julian Helfferich authored
    • Julian Helfferich's avatar
      Refresh items also on game over · 5e9bd5a1
      Julian Helfferich authored
      If items are not refreshed, the final piece (causing the game to be
      over) will be invisible. With this change, it will be correctly
      displayed, making it obvious why the game is over.
    • Julian Helfferich's avatar
      Create SvgItemInterface · 2d6f98c5
      Julian Helfferich authored
      To be able to test the next step in the bugfix, I need to verify the
      actions taken on a KBlocksSvgItem object. Thus, I want to replace it
      with a mock object. To make this possible, I have created a
      SvgItemInterface class and replaced all necessary KBlocksSvgItem
      pointers with SvgItemInterface pointers.
    • Julian Helfferich's avatar
      Do not call setupGui() in KBlocksWin constructor · 17b25472
      Julian Helfferich authored
      This function makes it more difficult to build unit tests for
      KBlocksWin. A better way is to make this a public member and call it
      explicitely after the KBlocksWin object has been created.
    • Julian Helfferich's avatar
      Do not create KBlocksGraphics and KBlocksSound objects in KBlocksScene · 13fc0e56
      Julian Helfferich authored
      Complex objects being created in constructors is always a big headache
      for unit tests, particularly in C++, because constructor calls can't be
      avoided and neither can the work be delegated to a virtual member
      Instead of creating the objects, KBlocksScene now takes them as input
      This reduces the number of warnings in the UnitTest-KBlocksWin test
      suite to one.
    • Julian Helfferich's avatar
      Remove mpGameScene member from KBlocksView · 140e1188
      Julian Helfferich authored
      KBlocksView actually stored two pointers to the same Scene object. The
      parent QGraphicsView stores a QGraphicsScene pointer, accessible via
      scene() and setScene(). And KBlocksView also stored a SceneInterface
      pointer as a private member function.
      This could lead to confusing behavior. For example, calling setScene()
      on the KBlocksView object only replaces one of the two pointers. I have
      removed the private mpGameScene member. The scene is now always accessed
      via the scene() interface.
    • Julian Helfferich's avatar
      Move definition of TestingKBlocksWin to .cpp file · 3a0a84f9
      Julian Helfferich authored
      This requires that the cpp file is compiled into a new KBlocksTesting
      library against which the KBlocksWin test is linked.
    • Julian Helfferich's avatar
      Do not return status in deleteSingleGames() method · fcb0babd
      Julian Helfferich authored
      The status was determined by whether single games were created before
      the call to deleteSingleGames(). The better way to check this is to use
      the new hasSingleGames() functionality as it is now done in KBlocksWin.
    • Julian Helfferich's avatar
      Create new method in game logic: hasSingleGames() · 288c346a
      Julian Helfferich authored
      Using this new functionality, the KBlocksWin::stopGame() method can be
      improved and made more readable. The check if single games were created
      are now made explicit.
    • Julian Helfferich's avatar
      Fix the test and fix the crash · 1d2ae0cc
      Julian Helfferich authored
      To fix the issue, I introduced a test whether the game logic object has
      created single games (by trying to access one). Only if the game logic
      object has single games, stop game and delete single games is called.
      I have also confirmed by manual testing that the game no longer crashes
      when (re)starting a game after the first one.
      The test is not as unit-test-y as I would like: Several QWARN are
      issued. Furthermore, there is another option to improve usability:
      The last piece is also placed ontop of an existing piece, triggering a
      game over. However, this final piece is still invisible.
    • Julian Helfferich's avatar
      Add test that stopGame is not called after single games are deleted · a3e9b5fe
      Julian Helfferich authored
      To fix the bug I am targeting, stopGame() triggers an update of the
      layout, which includes processing the remaining game actions. To do
      this, the corresponding single game objects need to still exist.
      In this commit, I have just created the test. It is currently failing.
    • Julian Helfferich's avatar
      Replace KBlocksGameLogic with GameLogicInterface in KBlocksWin · e426bdca
      Julian Helfferich authored
      To be able to sense the actions performed on the game logic element, I
      want to be able to replace the GameLogic with a Mock object.
    • Julian Helfferich's avatar
      Remove unused code · 2702d854
      Julian Helfferich authored
      Removed function with fully commented-out body that was never used
    • Julian Helfferich's avatar
      Use SceneInterface also in KBlocksWin · 283a4c99
      Julian Helfferich authored
      The goal is still to be able to use a MockScene in KBlocksWin that can
      be used in unit testing.
    • Julian Helfferich's avatar
      Create SceneInterface · 454ad0ad
      Julian Helfferich authored
      Later on, I want to create a MockScene object in order to sense the
      changes done to the scene by the KBlocksWin class.
    • Julian Helfferich's avatar
      Call updateLayout() also in stopGame() · fc3fd5cd
      Julian Helfferich authored
      Calling updateLayout() means that all remaining game actions are
      processed when the game is intended to be stopped. This has the effect
      that the play area is updated before the highscore window is shown,
      not at a later time.
      BUG: 407244
  14. 21 Jan, 2021 1 commit
  15. 20 Jan, 2021 2 commits
    • Julian Helfferich's avatar
      Make test pass and first fix to the reported bug. · 093908ca
      Julian Helfferich authored
      Now, the final piece does correctly move into place at the end of the
      game. But some improvements are still possible:
      1) The piece only moves to the correct location after the highscore
      window is displayed (and closed).
      2) The piece that could not be placed and ended the game is invisible.
    • Julian Helfferich's avatar
      Add test to get the reported bug under test · 35007319
      Julian Helfferich authored
      The test is currently failing: KBlocksItemGroup::updateGame() does not
      call updateLayout() when the game is over. This means that the final
      game actions are not processed.