Git commit d350fc8e1785553edf6e0f49988dbd66f5ea63e0 by Montel Laurent. Committed on 09/08/2017 at 05:02. Pushed by mlaurent into branch 'master'. Start to create an autotest. Clean up code M +1 -0 autotests/CMakeLists.txt A +31 -0 autotests/roommodeltest.cpp [License: LGPL (v2/3+eV)] A +35 -0 autotests/roommodeltest.h [License: LGPL (v2/3+eV)] M +2 -4 src/roommodel.h https://commits.kde.org/ruqola/d350fc8e1785553edf6e0f49988dbd66f5ea63e0 diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index c2f2b34..dbd03ae 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -9,3 +9,4 @@ macro(add_ruqola_test _source _additionalsource) endmacro() = add_ruqola_test(rocketchatmessagetest.cpp "") +add_ruqola_test(roommodeltest.cpp "") diff --git a/autotests/roommodeltest.cpp b/autotests/roommodeltest.cpp new file mode 100644 index 0000000..be068bb --- /dev/null +++ b/autotests/roommodeltest.cpp @@ -0,0 +1,31 @@ +/* + Copyright (c) 2017 Montel Laurent + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as publish= ed + by the Free Software Foundation; either version 2 of the License or + ( at your option ) version 3 or, at the discretion of KDE e.V. + ( which shall act as a proxy as in section 14 of the GPLv3 ), any later= version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public Licen= se + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#include "roommodeltest.h" +#include + +QTEST_MAIN(RoomModelTest) + +RoomModelTest::RoomModelTest(QObject *parent) + : QObject(parent) +{ + +} diff --git a/autotests/roommodeltest.h b/autotests/roommodeltest.h new file mode 100644 index 0000000..bed679b --- /dev/null +++ b/autotests/roommodeltest.h @@ -0,0 +1,35 @@ +/* + Copyright (c) 2017 Montel Laurent + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as publish= ed + by the Free Software Foundation; either version 2 of the License or + ( at your option ) version 3 or, at the discretion of KDE e.V. + ( which shall act as a proxy as in section 14 of the GPLv3 ), any later= version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public Licen= se + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#ifndef ROOMMODELTEST_H +#define ROOMMODELTEST_H + +#include + +class RoomModelTest : public QObject +{ + Q_OBJECT +public: + explicit RoomModelTest(QObject *parent =3D nullptr); + ~RoomModelTest() =3D default; +}; + +#endif // ROOMMODELTEST_H diff --git a/src/roommodel.h b/src/roommodel.h index 1d10d7e..7ae1b9c 100644 --- a/src/roommodel.h +++ b/src/roommodel.h @@ -52,8 +52,8 @@ public: explicit RoomModel(QObject *parent =3D nullptr); virtual ~RoomModel(); = - virtual int rowCount(const QModelIndex &parent =3D QModelIndex()) cons= t; - virtual QVariant data(const QModelIndex &index, int role =3D Qt::Displ= ayRole) const; + int rowCount(const QModelIndex &parent =3D QModelIndex()) const overri= de; + QVariant data(const QModelIndex &index, int role =3D Qt::DisplayRole) = const override; = /** * @brief Constructs room object from @param roomID and @param roomName= and @param selected, then calls @method addRoom @@ -104,9 +104,7 @@ protected: QHash roleNames() const override; = private: - QVector m_roomsList; - //QHash< QString, Room > m_roomsHash; }; = #endif // ROOMMODEL_H