File indexing completed on 2024-05-05 08:05:13
0001 /****************************************************************************** 0002 * KBlocks, a falling blocks game by KDE * 0003 * SPDX-FileCopyrightText: 2009-2021 Julian Helfferich <julian.helfferich@mailbox.org> * 0004 * * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 ******************************************************************************/ 0007 #include <QTest> 0008 0009 #include "KBlocksScene.h" 0010 #include "Testing/MockGameLogic.h" 0011 #include "Testing/MockGraphics.h" 0012 #include "Testing/MockSound.h" 0013 0014 class testKBlocksScene : public QObject 0015 { 0016 Q_OBJECT 0017 private Q_SLOTS: 0018 void redundantCallsToDeleteGameItemGroupsShouldBeAllowed(); 0019 }; 0020 0021 void testKBlocksScene::redundantCallsToDeleteGameItemGroupsShouldBeAllowed() 0022 { 0023 /** 0024 * The method deleteGameItemGroups() should remove all existing 0025 * KBlocksItemGroup objects as well as the message box. It should 0026 * be valid to call deleteGameItemGroups() multiple times under all 0027 * circumstances. 0028 * 0029 * Currently, this test is only a should-not-crash test. It does not 0030 * verify that the game item groups are indeed deleted. 0031 */ 0032 MockGameLogic gameLogic; 0033 MockGraphics graphics; 0034 MockSound sound; 0035 KBlocksScene scene(&gameLogic, &graphics, &sound); 0036 0037 scene.deleteGameItemGroups(); 0038 scene.deleteGameItemGroups(); 0039 scene.createGameItemGroups(1); 0040 scene.deleteGameItemGroups(); 0041 scene.deleteGameItemGroups(); 0042 } 0043 0044 QTEST_MAIN(testKBlocksScene) 0045 0046 #include "test_KBlocksScene.moc"