File indexing completed on 2024-04-21 04:02:04

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 "KBlocksGameLogic.h"
0010 
0011 class testKBlocksGameLogic : public QObject
0012 {
0013     Q_OBJECT
0014 private Q_SLOTS:
0015     void test_hasSingleGames();
0016 };
0017 
0018 void testKBlocksGameLogic::test_hasSingleGames()
0019 {
0020     /**
0021      * KBlocksGameLogic::hasSingleGames() should return true if single
0022      * games have been created and false otherwise.
0023      */
0024     KBlocksGameLogic gameLogic(1);
0025     QVERIFY(!gameLogic.hasSingleGames());
0026     gameLogic.startGame(1);
0027     QVERIFY(gameLogic.hasSingleGames());
0028     gameLogic.deleteSingleGames();
0029     QVERIFY(!gameLogic.hasSingleGames());
0030 
0031     gameLogic.startGame(0);
0032     QVERIFY(!gameLogic.hasSingleGames());
0033 }
0034 
0035 QTEST_MAIN(testKBlocksGameLogic)
0036 
0037 #include "test_KBlocksGameLogic.moc"