File indexing completed on 2024-11-17 04:55:40

0001 /*
0002  *   SPDX-FileCopyrightText: 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *
0004  *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #pragma once
0008 
0009 #include "ReviewsBackend/ReviewsModel.h"
0010 #include <QObject>
0011 #include <QPointer>
0012 
0013 class AbstractResourcesBackend;
0014 class AbstractResource;
0015 class ResultsStream;
0016 
0017 class KNSBackendTest : public QObject
0018 {
0019     Q_OBJECT
0020 public:
0021     explicit KNSBackendTest(QObject *parent = nullptr);
0022 
0023 private Q_SLOTS:
0024     void testRetrieval();
0025     void testReviews();
0026     void testResourceByUrl();
0027     void testResourceByUrlResourcesModel();
0028 
0029 public Q_SLOTS:
0030     void reviewsArrived(AbstractResource *r, const QVector<ReviewPtr> &revs);
0031 
0032 private:
0033     QVector<AbstractResource *> getResources(ResultsStream *stream, bool canBeEmpty = false);
0034     QVector<AbstractResource *> getAllResources(AbstractResourcesBackend *backend);
0035     QPointer<AbstractResourcesBackend> m_backend;
0036     QPointer<AbstractResource> m_r;
0037     QVector<ReviewPtr> m_revs;
0038 };