Commit 62a1bce3 authored by Volker Krause's avatar Volker Krause

Remove outdated modeltest copy

parent 996a6df1
This diff is collapsed.
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef MODELTEST_H
#define MODELTEST_H
#include <QtCore/QObject>
#include <QtCore/QAbstractItemModel>
#include <QtCore/QStack>
class ModelTest : public QObject
{
Q_OBJECT
public:
ModelTest( QAbstractItemModel *model, QObject *parent = 0 );
private Q_SLOTS:
void nonDestructiveBasicTest();
void rowCount();
void columnCount();
void hasIndex();
void index();
void parent();
void data();
protected Q_SLOTS:
void runAllTests();
void layoutAboutToBeChanged();
void layoutChanged();
void rowsAboutToBeInserted( const QModelIndex &parent, int start, int end );
void rowsInserted( const QModelIndex & parent, int start, int end );
void rowsAboutToBeRemoved( const QModelIndex &parent, int start, int end );
void rowsRemoved( const QModelIndex & parent, int start, int end );
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void headerDataChanged(Qt::Orientation orientation, int start, int end);
private:
void checkChildren( const QModelIndex &parent, int currentDepth = 0 );
QAbstractItemModel *model;
struct Changing {
QModelIndex parent;
int oldSize;
QVariant last;
QVariant next;
};
QStack<Changing> insert;
QStack<Changing> remove;
bool fetchingMore;
QList<QPersistentModelIndex> changing;
};
#endif
......@@ -2,7 +2,6 @@ configure_file(test-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/test-config.h)
if(TARGET KUserFeedbackConsole)
add_library(KUserFeedbackTestUtils STATIC
servercontroller.cpp
${CMAKE_SOURCE_DIR}/3rdparty/qt/modeltest.cpp
)
target_link_libraries(KUserFeedbackTestUtils LINK_PUBLIC Qt5::Test KUserFeedbackConsole)
endif()
......
......@@ -21,12 +21,13 @@
#include <console/core/sample.h>
#include <console/core/schemaentrytemplates.h>
#include <3rdparty/qt/modeltest.h>
#include <QDebug>
#include <QtTest/qtest.h>
#include <QObject>
#include <QStandardPaths>
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
#include <QAbstractItemModelTester>
#endif
using namespace KUserFeedback::Console;
......@@ -43,7 +44,9 @@ private slots:
void testEmptyModel()
{
CategoryAggregationModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
model.setAggregation(Aggregation());
AggregationElement aggrElem;
{
......@@ -81,7 +84,9 @@ private slots:
void testModelContentDepth1()
{
CategoryAggregationModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
AggregationElement aggrElem;
{
SchemaEntry entry;
......@@ -166,7 +171,9 @@ private slots:
QCOMPARE(p.aggregations().size(), 1);
CategoryAggregationModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
model.setAggregation(p.aggregations().at(0));
TimeAggregationModel timeModel;
......@@ -248,7 +255,9 @@ private slots:
QCOMPARE(p.aggregations().size(), 1);
CategoryAggregationModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
model.setAggregation(p.aggregations().at(0));
TimeAggregationModel timeModel;
......
......@@ -19,12 +19,13 @@
#include <console/core/schemaentrytemplates.h>
#include <console/model/datamodel.h>
#include <3rdparty/qt/modeltest.h>
#include <QDebug>
#include <QtTest/qtest.h>
#include <QObject>
#include <QStandardPaths>
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
#include <QAbstractItemModelTester>
#endif
using namespace KUserFeedback::Console;
......@@ -51,7 +52,9 @@ private slots:
void testEmptyDataModel()
{
DataModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
model.setProduct({});
QCOMPARE(model.rowCount(), 0);
......@@ -68,7 +71,9 @@ private slots:
void testDataModelContent()
{
DataModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
Product p;
for (const auto &tpl : SchemaEntryTemplates::availableTemplates())
p.addTemplate(tpl);
......
......@@ -21,12 +21,13 @@
#include <console/core/sample.h>
#include <console/core/schemaentrytemplates.h>
#include <3rdparty/qt/modeltest.h>
#include <QDebug>
#include <QtTest/qtest.h>
#include <QObject>
#include <QStandardPaths>
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
#include <QAbstractItemModelTester>
#endif
using namespace KUserFeedback::Console;
......@@ -43,7 +44,9 @@ private slots:
void testEmptyModel()
{
NumericAggregationModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
model.setAggregation(AggregationElement());
AggregationElement aggr;
{
......@@ -79,7 +82,9 @@ private slots:
void testModelContent()
{
NumericAggregationModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
AggregationElement aggr;
{
SchemaEntry entry;
......
......@@ -21,13 +21,14 @@
#include <rest/restclient.h>
#include <model/productmodel.h>
#include <3rdparty/qt/modeltest.h>
#include <QDebug>
#include <QtTest/qtest.h>
#include <QObject>
#include <QSignalSpy>
#include <QStandardPaths>
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
#include <QAbstractItemModelTester>
#endif
using namespace KUserFeedback::Console;
......@@ -76,7 +77,9 @@ private slots:
waitForFinished(reply);
ProductModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
QSignalSpy resetSpy(&model, &ProductModel::modelReset);
QSignalSpy insertSpy(&model, &ProductModel::rowsInserted);
QSignalSpy removeSpy(&model, &ProductModel::rowsRemoved);
......
......@@ -18,8 +18,6 @@
#include <console/core/aggregation.h>
#include <console/core/product.h>
#include <3rdparty/qt/modeltest.h>
#include <QDebug>
#include <QtTest/qtest.h>
#include <QObject>
......
......@@ -21,12 +21,13 @@
#include <console/core/sample.h>
#include <console/core/schemaentrytemplates.h>
#include <3rdparty/qt/modeltest.h>
#include <QDebug>
#include <QtTest/qtest.h>
#include <QObject>
#include <QStandardPaths>
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
#include <QAbstractItemModelTester>
#endif
using namespace KUserFeedback::Console;
......@@ -43,7 +44,9 @@ private slots:
void testEmptyModel()
{
RatioSetAggregationModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
model.setAggregationValue(QString());
model.setAggregationValue(QLatin1String("applicationVersion.value"));
......@@ -68,7 +71,9 @@ private slots:
void testModelContent()
{
RatioSetAggregationModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
model.setAggregationValue(QLatin1String("newPropertyRatio"));
TimeAggregationModel timeModel;
......
......@@ -18,13 +18,14 @@
#include <model/schemamodel.h>
#include <core/schemaentrytemplates.h>
#include <3rdparty/qt/modeltest.h>
#include <QDebug>
#include <QtTest/qtest.h>
#include <QObject>
#include <QSignalSpy>
#include <QStandardPaths>
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
#include <QAbstractItemModelTester>
#endif
using namespace KUserFeedback::Console;
......@@ -41,7 +42,9 @@ private slots:
void testSchemaModel()
{
SchemaModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
model.setProduct(Product());
QCOMPARE(model.rowCount(), 0);
......
......@@ -20,12 +20,13 @@
#include <console/model/datamodel.h>
#include <console/model/timeaggregationmodel.h>
#include <3rdparty/qt/modeltest.h>
#include <QDebug>
#include <QtTest/qtest.h>
#include <QObject>
#include <QStandardPaths>
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
#include <QAbstractItemModelTester>
#endif
using namespace KUserFeedback::Console;
......@@ -42,7 +43,9 @@ private slots:
void testEmptyModel()
{
TimeAggregationModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
DataModel srcModel;
model.setSourceModel(&srcModel);
......@@ -62,7 +65,9 @@ private slots:
void testModelContent()
{
TimeAggregationModel model;
ModelTest modelTest(&model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
QAbstractItemModelTester modelTest(&model);
#endif
DataModel srcModel;
model.setSourceModel(&srcModel);
......@@ -127,4 +132,3 @@ private slots:
QTEST_MAIN(TimeAggregationModelTest)
#include "timeaggregationmodeltest.moc"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment