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 "KBlocksScene.h"
0010 #include "KBlocksView.h"
0011 #include "Testing/MockGameLogic.h"
0012 #include "Testing/MockScene.h"
0013 
0014 class testViewScene : public QObject
0015 {
0016     Q_OBJECT
0017 private Q_SLOTS:
0018     void test_settingsShouldBeUpdatedInViewAndScene();
0019 };
0020 
0021 void testViewScene::test_settingsShouldBeUpdatedInViewAndScene()
0022 {
0023     /**
0024      * When the settings are updated for the View, the new settings
0025      * should also be read in the scene to make sure the scene fits
0026      * the view exactly.
0027      */
0028     MockGameLogic gameLogic;
0029     MockScene scene(&gameLogic);
0030     KBlocksView view(&scene);
0031     view.settingsChanged();
0032     QVERIFY(scene.readSettingsCalled);
0033 }
0034 
0035 QTEST_MAIN(testViewScene)
0036 
0037 #include "test_View-Scene.moc"