diff --git a/autotests/configmodeltest.h b/autotests/configmodeltest.h index 87cd81c0a..f704ba771 100644 --- a/autotests/configmodeltest.h +++ b/autotests/configmodeltest.h @@ -1,39 +1,39 @@ /****************************************************************************** * Copyright 2016 David Rosca * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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. * *******************************************************************************/ #pragma once -#include +#include namespace Plasma { class Applet; } class ConfigModelTest : public QObject { Q_OBJECT private Q_SLOTS: void configSchemeFromPackage(); void emptySourceWithApplet(); void notEmptySourceWithApplet(); }; diff --git a/autotests/coronatest.h b/autotests/coronatest.h index d1d91d71f..6f23f19e7 100644 --- a/autotests/coronatest.h +++ b/autotests/coronatest.h @@ -1,98 +1,98 @@ /****************************************************************************** * Copyright 2014 Marco Martin * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 CORONATEST_H #define CORONATEST_H -#include +#include #include #include "plasma/corona.h" #include "plasma/pluginloader.h" class SimpleLoader : public Plasma::PluginLoader { protected: virtual Plasma::Applet *internalLoadApplet(const QString &name, uint appletId = 0, const QVariantList &args = QVariantList()) override; }; class SimpleCorona : public Plasma::Corona { Q_OBJECT public: explicit SimpleCorona(QObject * parent = nullptr); ~SimpleCorona(); QRect screenGeometry(int) const override; int screenForContainment(const Plasma::Containment *) const override; }; class SimpleApplet : public Plasma::Applet { Q_OBJECT public: explicit SimpleApplet(QObject *parent = nullptr, const QString &serviceId = QString(), uint appletId = 0); private: QTimer m_timer; }; class SimpleContainment : public Plasma::Containment { Q_OBJECT public: explicit SimpleContainment(QObject *parent = nullptr, const QString &serviceId = QString(), uint appletId = 0); private: QTimer m_timer; }; class SimpleNoScreenContainment : public Plasma::Containment { Q_OBJECT public: explicit SimpleNoScreenContainment(QObject *parent = nullptr, const QString &serviceId = QString(), uint appletId = 0); }; class CoronaTest : public QObject { Q_OBJECT public Q_SLOTS: void initTestCase(); void cleanupTestCase(); private Q_SLOTS: void restore(); void checkOrder(); void startupCompletion(); void addRemoveApplets(); void immutability(); private: SimpleCorona *m_corona; QDir m_configDir; }; #endif diff --git a/autotests/dialognativetest.h b/autotests/dialognativetest.h index 780bc8eec..09da22e17 100644 --- a/autotests/dialognativetest.h +++ b/autotests/dialognativetest.h @@ -1,53 +1,53 @@ /****************************************************************************** * Copyright 2014 Marco Martin * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 DIALOGTEST_H #define DIALOGTEST_H -#include +#include #include #include #include "plasmaquick/dialog.h" class DialogNativeTest : public QObject { Q_OBJECT public Q_SLOTS: void initTestCase(); void cleanupTestCase(); private Q_SLOTS: void size(); void position(); private: QQuickView *m_panel; QQuickView *m_panel2; QQuickView *m_panel3; QQuickItem *m_content; QQuickItem *m_content2; PlasmaQuick::Dialog *m_dialog; QDir m_cacheDir; }; #endif diff --git a/autotests/dialogqmltest.cpp b/autotests/dialogqmltest.cpp index 93cef6104..a90ed34e8 100644 --- a/autotests/dialogqmltest.cpp +++ b/autotests/dialogqmltest.cpp @@ -1,90 +1,90 @@ /******************************************************************************** * Copyright 2014 David Edmundson * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 "dialogqmltest.h" #include "plasmaquick/dialog.h" #include #include #include -#include -#include +#include +#include //this test checks that we don't set visible to true until after we set the window flags void DialogQmlTest::loadAndShow() { QQmlEngine engine; QByteArray dialogQml = "import QtQuick 2.0\n" "import org.kde.plasma.core 2.0 as PlasmaCore\n" "\n" "PlasmaCore.Dialog {\n" " id: root\n" "\n" " location: true && PlasmaCore.Types.TopEdge\n" " visible: true && true\n" " type: true && PlasmaCore.Dialog.Notification\n" "\n" " mainItem: Rectangle {\n" " width: 200\n" " height: 200\n" " }\n" "}\n"; //we use true && Value to force it to be a complex binding, which won't be evaluated in //component.beginCreate //the bug still appears without this, but we need to delay it in this test //so we can connect to the visibleChanged signal QQmlComponent component(&engine); QSignalSpy spy(&component, SIGNAL(statusChanged(QQmlComponent::Status))); component.setData(dialogQml, QUrl(QStringLiteral("test://dialogTest"))); spy.wait(); PlasmaQuick::Dialog *dialog = qobject_cast< PlasmaQuick::Dialog* >(component.beginCreate(engine.rootContext())); qDebug() << component.errorString(); Q_ASSERT(dialog); m_dialogShown = false; //this will be called during component.completeCreate auto c = connect(dialog, &QWindow::visibleChanged, [=]() { m_dialogShown = true; QCOMPARE(dialog->type(), PlasmaQuick::Dialog::Notification); QCOMPARE(dialog->location(), Plasma::Types::TopEdge); }); component.completeCreate(); QCOMPARE(m_dialogShown, true); //disconnect on visible changed before we delete the dialog disconnect(c); delete dialog; } QTEST_MAIN(DialogQmlTest) diff --git a/autotests/dialogqmltest.h b/autotests/dialogqmltest.h index 4e750f920..7f1b1832e 100644 --- a/autotests/dialogqmltest.h +++ b/autotests/dialogqmltest.h @@ -1,40 +1,40 @@ /****************************************************************************** * Copyright 2014 Marco Martin * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 DIALOLOADGTEST_H #define DIALOLOADGTEST_H -#include +#include #include "plasmaquick/dialog.h" class DialogQmlTest : public QObject { Q_OBJECT private Q_SLOTS: void loadAndShow(); private: bool m_dialogShown; }; #endif diff --git a/autotests/dialogstatetest.h b/autotests/dialogstatetest.h index 9841050ac..37d31b632 100644 --- a/autotests/dialogstatetest.h +++ b/autotests/dialogstatetest.h @@ -1,44 +1,44 @@ /****************************************************************************** * Copyright 2016 Eike Hein * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 DIALOGTEST_H #define DIALOGTEST_H -#include +#include #include "plasmaquick/dialog.h" class DialogStateTest : public QObject { Q_OBJECT public Q_SLOTS: void initTestCase(); void cleanupTestCase(); private Q_SLOTS: void windowState(); private: bool verifyState(PlasmaQuick::Dialog *dialog) const; PlasmaQuick::Dialog *m_dialog; }; #endif diff --git a/autotests/dynamictreemodel.cpp b/autotests/dynamictreemodel.cpp index 190298e95..3d7c33c49 100644 --- a/autotests/dynamictreemodel.cpp +++ b/autotests/dynamictreemodel.cpp @@ -1,331 +1,331 @@ /**************************************************************************** ** ** Copyright (C) 2009 Stephen Kelly ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "dynamictreemodel.h" -#include -#include -#include +#include +#include +#include DynamicTreeModel::DynamicTreeModel(QObject *parent) : QAbstractItemModel(parent), nextId(1) { } QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &parent) const { // if (column != 0) // return QModelIndex(); if (column < 0 || row < 0) { return QModelIndex(); } QList > childIdColumns = m_childItems.value(parent.internalId()); const qint64 grandParent = findParentId(parent.internalId()); if (grandParent >= 0) { QList > parentTable = m_childItems.value(grandParent); Q_ASSERT(parent.column() < parentTable.size()); QList parentSiblings = parentTable.at(parent.column()); Q_ASSERT(parent.row() < parentSiblings.size()); } if (childIdColumns.size() == 0) { return QModelIndex(); } if (column >= childIdColumns.size()) { return QModelIndex(); } QList rowIds = childIdColumns.at(column); if (row >= rowIds.size()) { return QModelIndex(); } qint64 id = rowIds.at(row); return createIndex(row, column, reinterpret_cast(id)); } qint64 DynamicTreeModel::findParentId(qint64 searchId) const { if (searchId <= 0) { return -1; } QHashIterator > > i(m_childItems); while (i.hasNext()) { i.next(); QListIterator > j(i.value()); while (j.hasNext()) { QList l = j.next(); if (l.contains(searchId)) { return i.key(); } } } return -1; } QModelIndex DynamicTreeModel::parent(const QModelIndex &index) const { if (!index.isValid()) { return QModelIndex(); } qint64 searchId = index.internalId(); qint64 parentId = findParentId(searchId); // Will never happen for valid index, but what the hey... if (parentId <= 0) { return QModelIndex(); } qint64 grandParentId = findParentId(parentId); if (grandParentId < 0) { grandParentId = 0; } int column = 0; QList childList = m_childItems.value(grandParentId).at(column); int row = childList.indexOf(parentId); return createIndex(row, column, reinterpret_cast(parentId)); } int DynamicTreeModel::rowCount(const QModelIndex &index) const { QList > cols = m_childItems.value(index.internalId()); if (cols.size() == 0) { return 0; } if (index.column() > 0) { return 0; } return cols.at(0).size(); } int DynamicTreeModel::columnCount(const QModelIndex &index) const { // Q_UNUSED(index); return m_childItems.value(index.internalId()).size(); } QVariant DynamicTreeModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) { return QVariant(); } if (Qt::DisplayRole == role) { return m_items.value(index.internalId()); } return QVariant(); } void DynamicTreeModel::clear() { beginResetModel(); m_items.clear(); m_childItems.clear(); nextId = 1; endResetModel(); } ModelChangeCommand::ModelChangeCommand(DynamicTreeModel *model, QObject *parent) : QObject(parent), m_model(model), m_numCols(1), m_startRow(-1), m_endRow(-1) { } QModelIndex ModelChangeCommand::findIndex(QList rows) { const int col = 0; QModelIndex parent = QModelIndex(); QListIterator i(rows); while (i.hasNext()) { parent = m_model->index(i.next(), col, parent); Q_ASSERT(parent.isValid()); } return parent; } ModelInsertCommand::ModelInsertCommand(DynamicTreeModel *model, QObject *parent) : ModelChangeCommand(model, parent) { } void ModelInsertCommand::doCommand() { QModelIndex parent = findIndex(m_rowNumbers); m_model->beginInsertRows(parent, m_startRow, m_endRow); qint64 parentId = parent.internalId(); for (int row = m_startRow; row <= m_endRow; row++) { for (int col = 0; col < m_numCols; col++) { if (m_model->m_childItems[parentId].size() <= col) { m_model->m_childItems[parentId].append(QList()); } // QString name = QUuid::createUuid().toString(); qint64 id = m_model->newId(); QString name = QString::number(id); m_model->m_items.insert(id, name); m_model->m_childItems[parentId][col].insert(row, id); } } m_model->endInsertRows(); } ModelMoveCommand::ModelMoveCommand(DynamicTreeModel *model, QObject *parent) : ModelChangeCommand(model, parent) { } bool ModelMoveCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow) { return m_model->beginMoveRows(srcParent, srcStart, srcEnd, destParent, destRow); } void ModelMoveCommand::doCommand() { QModelIndex srcParent = findIndex(m_rowNumbers); QModelIndex destParent = findIndex(m_destRowNumbers); if (!emitPreSignal(srcParent, m_startRow, m_endRow, destParent, m_destRow)) { return; } for (int column = 0; column < m_numCols; ++column) { QList l = m_model->m_childItems.value(srcParent.internalId())[column].mid(m_startRow, m_endRow - m_startRow + 1); for (int i = m_startRow; i <= m_endRow; i++) { m_model->m_childItems[srcParent.internalId()][column].removeAt(m_startRow); } int d; if (m_destRow < m_startRow) { d = m_destRow; } else { if (srcParent == destParent) { d = m_destRow - (m_endRow - m_startRow + 1); } else { d = m_destRow - (m_endRow - m_startRow) + 1; } } foreach (const qint64 id, l) { m_model->m_childItems[destParent.internalId()][column].insert(d++, id); } } emitPostSignal(); } void ModelMoveCommand::emitPostSignal() { m_model->endMoveRows(); } ModelResetCommand::ModelResetCommand(DynamicTreeModel *model, QObject *parent) : ModelMoveCommand(model, parent) { } ModelResetCommand::~ModelResetCommand() { } bool ModelResetCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow) { Q_UNUSED(srcParent); Q_UNUSED(srcStart); Q_UNUSED(srcEnd); Q_UNUSED(destParent); Q_UNUSED(destRow); return true; } void ModelResetCommand::emitPostSignal() { m_model->reset(); } ModelResetCommandFixed::ModelResetCommandFixed(DynamicTreeModel *model, QObject *parent) : ModelMoveCommand(model, parent) { } ModelResetCommandFixed::~ModelResetCommandFixed() { } bool ModelResetCommandFixed::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow) { Q_UNUSED(srcParent); Q_UNUSED(srcStart); Q_UNUSED(srcEnd); Q_UNUSED(destParent); Q_UNUSED(destRow); m_model->beginResetModel(); return true; } void ModelResetCommandFixed::emitPostSignal() { m_model->endResetModel(); } diff --git a/autotests/dynamictreemodel.h b/autotests/dynamictreemodel.h index 24bba1c62..6f9a0dffc 100644 --- a/autotests/dynamictreemodel.h +++ b/autotests/dynamictreemodel.h @@ -1,214 +1,214 @@ /**************************************************************************** ** ** Copyright (C) 2009 Stephen Kelly ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef DYNAMICTREEMODEL_H #define DYNAMICTREEMODEL_H -#include +#include -#include -#include +#include +#include class DynamicTreeModel : public QAbstractItemModel { Q_OBJECT public: DynamicTreeModel(QObject *parent = nullptr); QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &index) const; int rowCount(const QModelIndex &index = QModelIndex()) const; int columnCount(const QModelIndex &index = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; void clear(); protected Q_SLOTS: /** Finds the parent id of the string with id @p searchId. Returns -1 if not found. */ qint64 findParentId(qint64 searchId) const; private: QHash m_items; QHash > > m_childItems; qint64 nextId; qint64 newId() { return nextId++; }; QModelIndex m_nextParentIndex; int m_nextRow; int m_depth; int maxDepth; friend class ModelInsertCommand; friend class ModelMoveCommand; friend class ModelResetCommand; friend class ModelResetCommandFixed; }; class ModelChangeCommand : public QObject { Q_OBJECT public: explicit ModelChangeCommand(DynamicTreeModel *model, QObject *parent = nullptr); virtual ~ModelChangeCommand() {} void setAncestorRowNumbers(QList rowNumbers) { m_rowNumbers = rowNumbers; } QModelIndex findIndex(QList rows); void setStartRow(int row) { m_startRow = row; } void setEndRow(int row) { m_endRow = row; } void setNumCols(int cols) { m_numCols = cols; } virtual void doCommand() = 0; protected: DynamicTreeModel *m_model; QList m_rowNumbers; int m_numCols; int m_startRow; int m_endRow; }; typedef QList ModelChangeCommandList; class ModelInsertCommand : public ModelChangeCommand { Q_OBJECT public: explicit ModelInsertCommand(DynamicTreeModel *model, QObject *parent = nullptr); virtual ~ModelInsertCommand() {} virtual void doCommand(); }; class ModelMoveCommand : public ModelChangeCommand { Q_OBJECT public: ModelMoveCommand(DynamicTreeModel *model, QObject *parent); virtual ~ModelMoveCommand() {} virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow); virtual void doCommand(); virtual void emitPostSignal(); void setDestAncestors(QList rows) { m_destRowNumbers = rows; } void setDestRow(int row) { m_destRow = row; } protected: QList m_destRowNumbers; int m_destRow; }; /** A command which does a move and emits a reset signal. */ class ModelResetCommand : public ModelMoveCommand { Q_OBJECT public: explicit ModelResetCommand(DynamicTreeModel *model, QObject *parent = nullptr); virtual ~ModelResetCommand(); virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow); virtual void emitPostSignal(); }; /** A command which does a move and emits a beginResetModel and endResetModel signals. */ class ModelResetCommandFixed : public ModelMoveCommand { Q_OBJECT public: explicit ModelResetCommandFixed(DynamicTreeModel *model, QObject *parent = nullptr); virtual ~ModelResetCommandFixed(); virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow); virtual void emitPostSignal(); }; #endif diff --git a/autotests/fallbackpackagetest.h b/autotests/fallbackpackagetest.h index a1bdb4a3c..0069833fc 100644 --- a/autotests/fallbackpackagetest.h +++ b/autotests/fallbackpackagetest.h @@ -1,46 +1,46 @@ /****************************************************************************** * Copyright 2007 by Aaron Seigo * * Copyright 2014 Marco Martin * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 FALLBACKPACKAGETEST_H -#include +#include #include "plasma/package.h" class FallbackPackageTest : public QObject { Q_OBJECT private Q_SLOTS: void initTestCase(); void beforeFallback(); void afterFallback(); void cycle(); private: Plasma::Package m_pkg; Plasma::Package m_fallbackPkg; QString m_packagePath; QString m_fallPackagePath; }; #endif diff --git a/autotests/framesvgtest.h b/autotests/framesvgtest.h index e84385a1f..0209a9329 100644 --- a/autotests/framesvgtest.h +++ b/autotests/framesvgtest.h @@ -1,49 +1,49 @@ /****************************************************************************** * Copyright 2014 Marco Martin * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 FRAMESVGTEST_H #define FRAMESVGTEST_H -#include +#include #include "plasma/framesvg.h" class FrameSvgTest : public QObject { Q_OBJECT public Q_SLOTS: void initTestCase(); void cleanupTestCase(); private Q_SLOTS: void margins(); void contentsRect(); void setTheme(); void repaintBlocked(); private: Plasma::FrameSvg *m_frameSvg; QDir m_cacheDir; }; #endif diff --git a/autotests/iconitemtest.cpp b/autotests/iconitemtest.cpp index d1cc7a95d..f8c9d2765 100644 --- a/autotests/iconitemtest.cpp +++ b/autotests/iconitemtest.cpp @@ -1,556 +1,556 @@ /****************************************************************************** * Copyright 2016 David Rosca * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 "iconitemtest.h" #include #include #include #include #include -#include +#include #include #include #include #include "plasma/theme.h" #include "plasma/svg.h" static bool imageIsEmpty(const QImage &img) { for (int i = 0; i < img.width(); ++i) { for (int j = 0; j < img.height(); ++j) { if (img.pixel(i, j) != 0) { return false; } } } return true; } void IconItemTest::initTestCase() { if (qgetenv("XDG_DATA_DIRS").isEmpty()) { QWARN("\n" " !!!\n" " Switching QStandardPaths into testing mode.\n" " Make sure xdg data can be found or set XDG_DATA_DIRS.\n" " !!!\n"); } // make our theme in search path qputenv("XDG_DATA_DIRS", qgetenv("XDG_DATA_DIRS") + ":" + QFINDTESTDATA("data").toLocal8Bit()); // set default icon theme to test-theme QStandardPaths::setTestModeEnabled(true); QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); if(!QDir(configPath).mkpath(QStringLiteral("."))) { qFatal("Failed to create test configuration directory."); } QFile::remove(configPath); QIcon::setThemeSearchPaths({QFINDTESTDATA("data/icons")}); QIcon::setThemeName("test-theme"); KIconTheme::forceThemeForTests("test-theme"); KIconTheme::reconfigure(); KIconLoader::global()->reconfigure(QString()); m_view = new QQuickView(); m_view->setSource(QUrl::fromLocalFile(QFINDTESTDATA("data/view.qml"))); m_view->show(); QVERIFY(QTest::qWaitForWindowExposed(m_view)); if (!m_view->rootObject() || !m_view->rootObject()->grabToImage()) { QSKIP("Cannot grab item to image."); } } void IconItemTest::cleanupTestCase() { delete m_view; } void IconItemTest::init() { Plasma::Theme().setThemeName(QStringLiteral("default")); } void IconItemTest::cleanup() { qDeleteAll(m_view->rootObject()->childItems()); } QQuickItem *IconItemTest::createIconItem() { QByteArray iconQml = "import QtQuick 2.0;" "import org.kde.plasma.core 2.0 as PlasmaCore;" "PlasmaCore.IconItem {" " id: root;" "}"; QQmlComponent component(m_view->engine()); QSignalSpy spy(&component, SIGNAL(statusChanged(QQmlComponent::Status))); component.setData(iconQml, QUrl("test://iconTest")); if (component.status() != QQmlComponent::Ready) { spy.wait(); } QQuickItem *item = qobject_cast(component.create(m_view->engine()->rootContext())); Q_ASSERT(item && qstrcmp(item->metaObject()->className(), "IconItem") == 0); item->setParentItem(m_view->rootObject()); return item; } QImage IconItemTest::grabImage(QQuickItem *item) { QSharedPointer grab = item->grabToImage(); QSignalSpy spy(grab.data(), SIGNAL(ready())); spy.wait(); return grab->image(); } Plasma::Svg *IconItemTest::findPlasmaSvg(QQuickItem *item) { return item->findChild(); } void IconItemTest::changeTheme(Plasma::Theme *theme, const QString &themeName) { if (theme->themeName() != themeName) { QSignalSpy spy(theme, SIGNAL(themeChanged())); theme->setThemeName(themeName); spy.wait(); } } // ------ Tests void IconItemTest::loadPixmap() { QScopedPointer item(createIconItem()); QPixmap sourcePixmap(QFINDTESTDATA("data/test_image.png")); item->setSize(sourcePixmap.size()); item->setProperty("source", sourcePixmap); QVERIFY(item->property("valid").toBool()); QImage capture = grabImage(item.data()); QCOMPARE(capture, sourcePixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied)); QCOMPARE(sourcePixmap, item->property("source").value()); } //tests setting icon from a QImage void IconItemTest::loadImage() { QScopedPointer item(createIconItem()); QImage sourceImage(QFINDTESTDATA("data/test_image.png")); item->setSize(sourceImage.size()); item->setProperty("source", sourceImage); QVERIFY(item->property("valid").toBool()); QImage capture = grabImage(item.data()); QCOMPARE(capture, sourceImage.convertToFormat(QImage::Format_ARGB32_Premultiplied)); QCOMPARE(sourceImage, item->property("source").value()); } void IconItemTest::invalidIcon() { QString name("tst-plasma-framework-invalid-icon-name"); KIconLoader iconLoader("tst_plasma-framework"); if (iconLoader.hasIcon(name)) { QSKIP("Current icon theme has 'tst-plasma-framework-invalid-icon-name' icon."); } QQuickItem *item = createIconItem(); item->setProperty("source", name); QVERIFY(!item->property("valid").toBool()); QVERIFY(imageIsEmpty(grabImage(item))); } void IconItemTest::usesPlasmaTheme() { // usesPlasmaTheme = true (default) QQuickItem *item1 = createIconItem(); item1->setProperty("source", "konversation"); QVERIFY(item1->property("valid").toBool()); QCOMPARE(QStringLiteral("konversation"), item1->property("source").toString()); Plasma::Svg svg; svg.setContainsMultipleImages(true); svg.setImagePath("icons/konversation"); QImage img1 = grabImage(item1); QImage img2 = svg.image(QSize(item1->width(), item1->height()), "konversation"); QVERIFY(!imageIsEmpty(img1)); QVERIFY(!imageIsEmpty(img2)); QCOMPARE(img1, img2); // usesPlasmaTheme = false QQuickItem *item2 = createIconItem(); item2->setProperty("usesPlasmaTheme", false); item2->setProperty("source", "konversation"); img1 = grabImage(item2); // This depends on konversation icon being different in Plasma Breeze theme // and our test icon theme QVERIFY(img1 != img2); } void IconItemTest::animation() { // animated = true (default) QQuickItem *item1 = createIconItem(); item1->setProperty("source", "user-away"); // first icon is not animated QImage userAwayImg = grabImage(item1); item1->setProperty("source", "user-busy"); grabImage(item1); item1->setProperty("source", "user-away"); // animation from user-busy -> user-away QVERIFY(userAwayImg != grabImage(item1)); // animated = false QQuickItem *item2 = createIconItem(); item2->setProperty("animated", false); item2->setProperty("source", "user-busy"); QImage userBusyImg = grabImage(item2); item2->setProperty("source", "user-away"); QCOMPARE(userAwayImg, grabImage(item2)); item2->setProperty("source", "user-busy"); QCOMPARE(userBusyImg, grabImage(item2)); } void IconItemTest::animationAfterHide() { QQuickItem *item1 = createIconItem(); QQuickItem *item2 = createIconItem(); item1->setProperty("source", "user-away"); item2->setProperty("source", "user-busy"); // first icon is not animated QImage userAwayImg = grabImage(item1); QImage userBusyImg = grabImage(item2); item1->setProperty("source", "user-busy"); grabImage(item1); item1->setProperty("visible", "false"); item1->setProperty("visible", "true"); item1->setProperty("source", "user-away"); // icon was hidden, no animation QCOMPARE(userAwayImg, grabImage(item1)); item1->setProperty("source", "user-busy"); QVERIFY(userBusyImg != grabImage(item1)); } void IconItemTest::bug_359388() { if (!KIconTheme::list().contains("hicolor")) { // This test depends on hicolor icon theme to resolve the icon. QSKIP("hicolor icon theme not available"); } QString name("bug359388"); KIconLoader iconLoader("tst_plasma-framework"); QIcon customThemeIcon(new KIconEngine(name, &iconLoader)); if (iconLoader.hasIcon(name)) { QSKIP("Current icon theme has 'bug359388' icon."); } iconLoader.addAppDir("tst_plasma-framework", QFINDTESTDATA("data/bug359388")); QQuickItem *item1 = createIconItem(); item1->setProperty("source", customThemeIcon); QVERIFY(item1->property("valid").toBool()); QCOMPARE(customThemeIcon, item1->property("source").value()); QQuickItem *item2 = createIconItem(); item2->setProperty("source", QIcon(QFINDTESTDATA("data/bug359388/hicolor/22x22/apps/" + name + ".svg"))); QVERIFY(item2->property("valid").toBool()); QCOMPARE(grabImage(item1), grabImage(item2)); } void IconItemTest::loadSvg() { QString name("tst-plasma-framework-test-icon"); QQuickItem *item = createIconItem(); item->setProperty("animated", false); item->setSize(QSize(22, 22)); item->setProperty("source", name); QVERIFY(item->property("valid").toBool()); Plasma::Svg *svg; svg = findPlasmaSvg(item); Q_ASSERT(svg); QCOMPARE(svg->imagePath(), QFINDTESTDATA("data/icons/test-theme/apps/22/" + name + ".svg")); // we only have 32x32 and 22x22 version in the theme, thus 32x32 is a better match. item->setSize(QSize(64, 64)); // just to update the icon grabImage(item); svg = findPlasmaSvg(item); Q_ASSERT(svg); QCOMPARE(svg->imagePath(), QFINDTESTDATA("data/icons/test-theme/apps/32/" + name + ".svg")); } void IconItemTest::themeChange() { // Icon from Plasma theme QQuickItem *item1 = createIconItem(); item1->setProperty("animated", false); item1->setProperty("source", "zoom-fit-height"); Plasma::Svg *svg1 = item1->findChild(); changeTheme(svg1->theme(), "breeze-light"); QImage img1 = grabImage(item1); changeTheme(svg1->theme(), "breeze-dark"); QImage img2 = grabImage(item1); QVERIFY(img1 != img2); // Icon from icon theme QQuickItem *item2 = createIconItem(); item2->setProperty("animated", false); item2->setProperty("width", 22); item2->setProperty("height", 22); item2->setProperty("source", "tst-plasma-framework-test-icon"); Plasma::Svg *svg2 = item2->findChild(); changeTheme(svg2->theme(), "breeze-light"); img1 = grabImage(item2); changeTheme(svg2->theme(), "breeze-dark"); img2 = grabImage(item2); QVERIFY(img1 != img2); } void IconItemTest::qiconFromTheme() { // Icon from Plasma theme QQuickItem *item1 = createIconItem(); QIcon icon1 = QIcon::fromTheme("konversation"); item1->setProperty("source", icon1); QVERIFY(item1->findChild()); QVERIFY(!imageIsEmpty(grabImage(item1))); QCOMPARE(icon1, item1->property("source").value()); // Icon from icon theme QQuickItem *item2 = createIconItem(); QIcon icon2 = QIcon::fromTheme("tst-plasma-framework-test-icon"); item2->setProperty("source", icon2); QVERIFY(item2->findChild()); QVERIFY(!imageIsEmpty(grabImage(item2))); QCOMPARE(icon2, item2->property("source").value()); } void IconItemTest::changeColorGroup() { // Icon from Plasma theme QQuickItem *item = createIconItem(); item->setProperty("animated", false); item->setProperty("source", "zoom-fit-height"); Plasma::Svg *svg = item->findChild(); // not using "breeze" theme as that one follows system color scheme // and that one might not have a complementary group or a broken one changeTheme(svg->theme(), "breeze-light"); QSignalSpy spy(svg, SIGNAL(repaintNeeded())); QVERIFY(spy.isValid()); QImage img1 = grabImage(item); item->setProperty("colorGroup", Plasma::Theme::ComplementaryColorGroup); QTRY_VERIFY(spy.count() == 1); QImage img2 = grabImage(item); QVERIFY(img1 != img2); } void IconItemTest::animatingActiveChange() { QQuickItem *item1 = createIconItem(); item1->setProperty("animated", false); item1->setProperty("source", "tst-plasma-framework-test-icon"); QImage img1 = grabImage(item1); QQuickItem *item2 = createIconItem(); item2->setProperty("animated", false); item2->setProperty("active", true); item2->setProperty("source", "tst-plasma-framework-test-icon"); QImage img2 = grabImage(item2); QVERIFY(img1 != img2); item1->setProperty("active", true); img1 = grabImage(item1); QVERIFY(img1 != img2); // animation is running } void IconItemTest::animatingEnabledChange() { QQuickItem *item1 = createIconItem(); item1->setProperty("animated", false); item1->setProperty("source", "tst-plasma-framework-test-icon"); QImage img1 = grabImage(item1); QQuickItem *item2 = createIconItem(); item2->setProperty("animated", false); item2->setProperty("enabled", false); item2->setProperty("source", "tst-plasma-framework-test-icon"); QImage img2 = grabImage(item2); QVERIFY(img1 != img2); item1->setProperty("enabled", false); img1 = grabImage(item1); QVERIFY(img1 != img2); // animation is running } void IconItemTest::windowChanged() { QQuickItem *item = createIconItem(); item->setProperty("animated", false); item->setProperty("source", "tst-plasma-framework-test-icon"); QImage img = grabImage(item); QQuickView newView; newView.setSource(QUrl::fromLocalFile(QFINDTESTDATA("data/view.qml"))); newView.show(); QVERIFY(QTest::qWaitForWindowExposed(&newView)); item->setProperty("visible", false); item->setParentItem(newView.rootObject()); item->setProperty("visible", true); QCOMPARE(grabImage(item), img); } void IconItemTest::paintedSize() { QQuickItem *item = createIconItem(); QCOMPARE(item->property("paintedWidth").toInt(), item->property("implicitWidth").toInt()); QCOMPARE(item->property("paintedHeight").toInt(), item->property("implicitHeight").toInt()); item->setWidth(40); item->setHeight(40); QCOMPARE(item->property("paintedWidth").toInt(), 32); QCOMPARE(item->property("paintedHeight").toInt(), 32); QIcon landscapeIcon(QPixmap(40, 35)); item->setProperty("source", landscapeIcon); grabImage(item); // basically just to force loading the pixmap // expanded to fit IconItem size whilst keeping aspect ratio // width should be rounded to icon size, ie. 32 is next smallest QCOMPARE(item->property("paintedWidth").toInt(), 32); // height should still match aspect ratio, so *not* 24! QCOMPARE(item->property("paintedHeight").toInt(), 28); QIcon portraitIcon(QPixmap(15, 40)); item->setProperty("source", portraitIcon); grabImage(item); QCOMPARE(item->property("paintedWidth").toInt(), 12); QCOMPARE(item->property("paintedHeight").toInt(), 32); item->setWidth(400); item->setHeight(400); grabImage(item); QCOMPARE(item->property("paintedWidth").toInt(), 150); QCOMPARE(item->property("paintedHeight").toInt(), 400); } void IconItemTest::implicitSize() { KConfigGroup cg(KSharedConfig::openConfig(), "DialogIcons"); cg.writeEntry("Size", 22); cg.sync(); KIconLoader::global()->reconfigure(QString()); QQuickItem *item = createIconItem(); // qreal cast needed as QTest::qCompare fails to link QCOMPARE(item->implicitWidth(), qreal(22)); QCOMPARE(item->implicitHeight(), qreal(22)); QSignalSpy widthSpy(item, &QQuickItem::implicitWidthChanged); QVERIFY(widthSpy.isValid()); QSignalSpy heightSpy(item, &QQuickItem::implicitHeightChanged); QVERIFY(heightSpy.isValid()); cg.writeEntry("Size", 64); cg.sync(); KIconLoader::global()->reconfigure(QString()); // merely changing the setting and calling reconfigure won't emit this signal, // the KCM uses a method "newIconLoader" method which does that but it's deprecated emit KIconLoader::global()->iconLoaderSettingsChanged(); QCOMPARE(widthSpy.count(), 1); QCOMPARE(heightSpy.count(), 1); QCOMPARE(item->implicitWidth(), qreal(64)); QCOMPARE(item->implicitHeight(), qreal(64)); } void IconItemTest::nonSquareImplicitSize() { QQuickItem *item1 = createIconItem(); // Both file:///foo and /foo must behave the same item1->setProperty("source", QFINDTESTDATA("data/test_nonsquare.png")); QCOMPARE(item1->implicitWidth(), qreal(150)); QCOMPARE(item1->implicitHeight(), qreal(50)); QQuickItem *item2 = createIconItem(); item2->setProperty("source", QUrl::fromLocalFile(QFINDTESTDATA("data/test_nonsquare.png"))); QCOMPARE(item2->implicitWidth(), item1->implicitWidth()); QCOMPARE(item2->implicitHeight(), item1->implicitHeight()); } void IconItemTest::roundToIconSize() { QQuickItem *item = createIconItem(); item->setWidth(25); item->setHeight(25); QVERIFY(item->property("paintedWidth").toInt() != 25); QVERIFY(item->property("paintedHeight").toInt() != 25); QSignalSpy paintedSizeSpy(item, SIGNAL(paintedSizeChanged())); QSignalSpy roundToIconSizeSpy(item, SIGNAL(roundToIconSizeChanged())); item->setProperty("roundToIconSize", false); QTRY_COMPARE(paintedSizeSpy.count(), 1); QTRY_COMPARE(roundToIconSizeSpy.count(), 1); QVERIFY(item->property("paintedWidth").toInt() == 25); QVERIFY(item->property("paintedHeight").toInt() == 25); } QTEST_MAIN(IconItemTest) diff --git a/autotests/iconitemtest.h b/autotests/iconitemtest.h index ef1ee3ede..91169f978 100644 --- a/autotests/iconitemtest.h +++ b/autotests/iconitemtest.h @@ -1,70 +1,70 @@ /****************************************************************************** * Copyright 2016 David Rosca * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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. * *******************************************************************************/ #pragma once #include #include -#include +#include namespace Plasma { class Svg; class Theme; } class IconItemTest : public QObject { Q_OBJECT private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); void loadPixmap(); void loadImage(); void invalidIcon(); void usesPlasmaTheme(); void animation(); void animationAfterHide(); void bug_359388(); void loadSvg(); void themeChange(); void qiconFromTheme(); void changeColorGroup(); void animatingActiveChange(); void animatingEnabledChange(); void windowChanged(); void paintedSize(); void implicitSize(); void nonSquareImplicitSize(); void roundToIconSize(); private: QQuickItem *createIconItem(); QImage grabImage(QQuickItem *item); Plasma::Svg *findPlasmaSvg(QQuickItem *item); void changeTheme(Plasma::Theme *theme, const QString &themeName); QQuickView *m_view; }; diff --git a/autotests/modeltest.cpp b/autotests/modeltest.cpp index a69b51f1a..54500b78c 100644 --- a/autotests/modeltest.cpp +++ b/autotests/modeltest.cpp @@ -1,577 +1,577 @@ /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include "modeltest.h" -#include +#include //#undef Q_ASSERT //#define Q_ASSERT QVERIFY Q_DECLARE_METATYPE(QModelIndex) /*! Connect to all of the models signals. Whenever anything happens recheck everything. */ ModelTest::ModelTest(QAbstractItemModel *_model, QObject *parent) : QObject(parent), model(_model), fetchingMore(false) { Q_ASSERT(model); connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(runAllTests())); connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(runAllTests())); connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)), this, SLOT(runAllTests())); connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)), this, SLOT(runAllTests())); connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(runAllTests())); connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), this, SLOT(runAllTests())); connect(model, SIGNAL(layoutAboutToBeChanged()), this, SLOT(runAllTests())); connect(model, SIGNAL(layoutChanged()), this, SLOT(runAllTests())); connect(model, SIGNAL(modelReset()), this, SLOT(runAllTests())); connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(runAllTests())); connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(runAllTests())); connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(runAllTests())); connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(runAllTests())); // Special checks for inserting/removing connect(model, SIGNAL(layoutAboutToBeChanged()), this, SLOT(layoutAboutToBeChanged())); connect(model, SIGNAL(layoutChanged()), this, SLOT(layoutChanged())); connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int))); connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); runAllTests(); } void ModelTest::runAllTests() { if (fetchingMore) { return; } nonDestructiveBasicTest(); rowCount(); columnCount(); hasIndex(); index(); parent(); data(); } /*! nonDestructiveBasicTest tries to call a number of the basic functions (not all) to make sure the model doesn't outright segfault, testing the functions that makes sense. */ void ModelTest::nonDestructiveBasicTest() { Q_ASSERT(model->buddy(QModelIndex()) == QModelIndex()); model->canFetchMore(QModelIndex()); Q_ASSERT(model->columnCount(QModelIndex()) >= 0); Q_ASSERT(model->data(QModelIndex()) == QVariant()); fetchingMore = true; model->fetchMore(QModelIndex()); fetchingMore = false; Qt::ItemFlags flags = model->flags(QModelIndex()); Q_ASSERT(flags == Qt::ItemIsDropEnabled || flags == 0); model->hasChildren(QModelIndex()); model->hasIndex(0, 0); model->headerData(0, Qt::Horizontal); model->index(0, 0); model->itemData(QModelIndex()); QVariant cache; model->match(QModelIndex(), -1, cache); model->mimeTypes(); Q_ASSERT(model->parent(QModelIndex()) == QModelIndex()); Q_ASSERT(model->rowCount() >= 0); QVariant variant; model->setData(QModelIndex(), variant, -1); model->setHeaderData(-1, Qt::Horizontal, QVariant()); model->setHeaderData(999999, Qt::Horizontal, QVariant()); QMap roles; model->sibling(0, 0, QModelIndex()); model->span(QModelIndex()); model->supportedDropActions(); } /*! Tests model's implementation of QAbstractItemModel::rowCount() and hasChildren() Models that are dynamically populated are not as fully tested here. */ void ModelTest::rowCount() { // qDebug() << "rc"; // check top row QModelIndex topIndex = model->index(0, 0, QModelIndex()); int rows = model->rowCount(topIndex); Q_ASSERT(rows >= 0); if (rows > 0) { Q_ASSERT(model->hasChildren(topIndex) == true); } QModelIndex secondLevelIndex = model->index(0, 0, topIndex); if (secondLevelIndex.isValid()) { // not the top level // check a row count where parent is valid rows = model->rowCount(secondLevelIndex); Q_ASSERT(rows >= 0); if (rows > 0) { Q_ASSERT(model->hasChildren(secondLevelIndex) == true); } } // The models rowCount() is tested more extensively in checkChildren(), // but this catches the big mistakes } /*! Tests model's implementation of QAbstractItemModel::columnCount() and hasChildren() */ void ModelTest::columnCount() { // check top row QModelIndex topIndex = model->index(0, 0, QModelIndex()); Q_ASSERT(model->columnCount(topIndex) >= 0); // check a column count where parent is valid QModelIndex childIndex = model->index(0, 0, topIndex); if (childIndex.isValid()) { Q_ASSERT(model->columnCount(childIndex) >= 0); } // columnCount() is tested more extensively in checkChildren(), // but this catches the big mistakes } /*! Tests model's implementation of QAbstractItemModel::hasIndex() */ void ModelTest::hasIndex() { // qDebug() << "hi"; // Make sure that invalid values returns an invalid index Q_ASSERT(model->hasIndex(-2, -2) == false); Q_ASSERT(model->hasIndex(-2, 0) == false); Q_ASSERT(model->hasIndex(0, -2) == false); int rows = model->rowCount(); int columns = model->columnCount(); // check out of bounds Q_ASSERT(model->hasIndex(rows, columns) == false); Q_ASSERT(model->hasIndex(rows + 1, columns + 1) == false); if (rows > 0) { Q_ASSERT(model->hasIndex(0, 0) == true); } // hasIndex() is tested more extensively in checkChildren(), // but this catches the big mistakes } /*! Tests model's implementation of QAbstractItemModel::index() */ void ModelTest::index() { // qDebug() << "i"; // Make sure that invalid values returns an invalid index Q_ASSERT(model->index(-2, -2) == QModelIndex()); Q_ASSERT(model->index(-2, 0) == QModelIndex()); Q_ASSERT(model->index(0, -2) == QModelIndex()); int rows = model->rowCount(); int columns = model->columnCount(); if (rows == 0) { return; } // Catch off by one errors Q_ASSERT(model->index(rows, columns) == QModelIndex()); Q_ASSERT(model->index(0, 0).isValid() == true); // Make sure that the same index is *always* returned QModelIndex a = model->index(0, 0); QModelIndex b = model->index(0, 0); Q_ASSERT(a == b); // index() is tested more extensively in checkChildren(), // but this catches the big mistakes } /*! Tests model's implementation of QAbstractItemModel::parent() */ void ModelTest::parent() { // qDebug() << "p"; // Make sure the model wont crash and will return an invalid QModelIndex // when asked for the parent of an invalid index. Q_ASSERT(model->parent(QModelIndex()) == QModelIndex()); if (model->rowCount() == 0) { return; } // Column 0 | Column 1 | // QModelIndex() | | // \- topIndex | topIndex1 | // \- childIndex | childIndex1 | // Common error test #1, make sure that a top level index has a parent // that is a invalid QModelIndex. QModelIndex topIndex = model->index(0, 0, QModelIndex()); Q_ASSERT(model->parent(topIndex) == QModelIndex()); // Common error test #2, make sure that a second level index has a parent // that is the first level index. if (model->rowCount(topIndex) > 0) { QModelIndex childIndex = model->index(0, 0, topIndex); Q_ASSERT(model->parent(childIndex) == topIndex); } // Common error test #3, the second column should NOT have the same children // as the first column in a row. // Usually the second column shouldn't have children. QModelIndex topIndex1 = model->index(0, 1, QModelIndex()); if (model->rowCount(topIndex1) > 0) { QModelIndex childIndex = model->index(0, 0, topIndex); QModelIndex childIndex1 = model->index(0, 0, topIndex1); Q_ASSERT(childIndex != childIndex1); } // Full test, walk n levels deep through the model making sure that all // parent's children correctly specify their parent. checkChildren(QModelIndex()); } /*! Called from the parent() test. A model that returns an index of parent X should also return X when asking for the parent of the index. This recursive function does pretty extensive testing on the whole model in an effort to catch edge cases. This function assumes that rowCount(), columnCount() and index() already work. If they have a bug it will point it out, but the above tests should have already found the basic bugs because it is easier to figure out the problem in those tests then this one. */ void ModelTest::checkChildren(const QModelIndex &parent, int currentDepth) { // First just try walking back up the tree. QModelIndex p = parent; while (p.isValid()) { p = p.parent(); } // For models that are dynamically populated if (model->canFetchMore(parent)) { fetchingMore = true; model->fetchMore(parent); fetchingMore = false; } int rows = model->rowCount(parent); int columns = model->columnCount(parent); if (rows > 0) { Q_ASSERT(model->hasChildren(parent)); } // Some further testing against rows(), columns(), and hasChildren() Q_ASSERT(rows >= 0); Q_ASSERT(columns >= 0); if (rows > 0) { Q_ASSERT(model->hasChildren(parent) == true); } //qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows // << "columns:" << columns << "parent column:" << parent.column(); Q_ASSERT(model->hasIndex(rows + 1, 0, parent) == false); for (int r = 0; r < rows; ++r) { if (model->canFetchMore(parent)) { fetchingMore = true; model->fetchMore(parent); fetchingMore = false; } Q_ASSERT(model->hasIndex(r, columns + 1, parent) == false); for (int c = 0; c < columns; ++c) { Q_ASSERT(model->hasIndex(r, c, parent) == true); QModelIndex index = model->index(r, c, parent); // rowCount() and columnCount() said that it existed... Q_ASSERT(index.isValid() == true); // index() should always return the same index when called twice in a row QModelIndex modifiedIndex = model->index(r, c, parent); Q_ASSERT(index == modifiedIndex); // Make sure we get the same index if we request it twice in a row QModelIndex a = model->index(r, c, parent); QModelIndex b = model->index(r, c, parent); Q_ASSERT(a == b); // Some basic checking on the index that is returned Q_ASSERT(index.model() == model); Q_ASSERT(index.row() == r); Q_ASSERT(index.column() == c); // While you can technically return a QVariant usually this is a sign // of an bug in data() Disable if this really is ok in your model. // Q_ASSERT ( model->data ( index, Qt::DisplayRole ).isValid() == true ); // If the next test fails here is some somewhat useful debug you play with. if (model->parent(index) != parent) { qDebug() << r << c << currentDepth << model->data(index).toString() << model->data(parent).toString(); qDebug() << index << parent << model->parent(index); // And a view that you can even use to show the model. // QTreeView view; // view.setModel(model); // view.show(); } // Check that we can get back our real parent. // qDebug() << model->parent ( index ) << parent ; Q_ASSERT(model->parent(index) == parent); // recursively go down the children if (model->hasChildren(index) && currentDepth < 10) { //qDebug() << r << c << "has children" << model->rowCount(index); checkChildren(index, ++currentDepth); }/* else { if (currentDepth >= 10) qDebug() << "checked 10 deep"; };*/ // make sure that after testing the children that the index doesn't change. QModelIndex newerIndex = model->index(r, c, parent); Q_ASSERT(index == newerIndex); } } } /*! Tests model's implementation of QAbstractItemModel::data() */ void ModelTest::data() { // Invalid index should return an invalid qvariant Q_ASSERT(!model->data(QModelIndex()).isValid()); if (model->rowCount() == 0) { return; } // A valid index should have a valid QVariant data Q_ASSERT(model->index(0, 0).isValid()); // shouldn't be able to set data on an invalid index Q_ASSERT(model->setData(QModelIndex(), QLatin1String("foo"), Qt::DisplayRole) == false); // General Purpose roles that should return a QString QVariant variant = model->data(model->index(0, 0), Qt::ToolTipRole); if (variant.isValid()) { Q_ASSERT(qVariantCanConvert (variant)); } variant = model->data(model->index(0, 0), Qt::StatusTipRole); if (variant.isValid()) { Q_ASSERT(qVariantCanConvert (variant)); } variant = model->data(model->index(0, 0), Qt::WhatsThisRole); if (variant.isValid()) { Q_ASSERT(qVariantCanConvert (variant)); } // General Purpose roles that should return a QSize variant = model->data(model->index(0, 0), Qt::SizeHintRole); if (variant.isValid()) { Q_ASSERT(qVariantCanConvert (variant)); } // General Purpose roles that should return a QFont QVariant fontVariant = model->data(model->index(0, 0), Qt::FontRole); if (fontVariant.isValid()) { Q_ASSERT(qVariantCanConvert (fontVariant)); } // Check that the alignment is one we know about QVariant textAlignmentVariant = model->data(model->index(0, 0), Qt::TextAlignmentRole); if (textAlignmentVariant.isValid()) { int alignment = textAlignmentVariant.toInt(); Q_ASSERT(alignment == (alignment & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask))); } // General Purpose roles that should return a QColor QVariant colorVariant = model->data(model->index(0, 0), Qt::BackgroundColorRole); if (colorVariant.isValid()) { Q_ASSERT(qVariantCanConvert (colorVariant)); } colorVariant = model->data(model->index(0, 0), Qt::TextColorRole); if (colorVariant.isValid()) { Q_ASSERT(qVariantCanConvert (colorVariant)); } // Check that the "check state" is one we know about. QVariant checkStateVariant = model->data(model->index(0, 0), Qt::CheckStateRole); if (checkStateVariant.isValid()) { int state = checkStateVariant.toInt(); Q_ASSERT(state == Qt::Unchecked || state == Qt::PartiallyChecked || state == Qt::Checked); } } /*! Store what is about to be inserted to make sure it actually happens \sa rowsInserted() */ void ModelTest::rowsAboutToBeInserted(const QModelIndex &parent, int start, int end) { // Q_UNUSED(end); // qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString() // << "current count of parent=" << model->rowCount ( parent ); // << "display of last=" << model->data( model->index(start-1, 0, parent) ); // qDebug() << model->index(start-1, 0, parent) << model->data( model->index(start-1, 0, parent) ); Changing c; c.parent = parent; c.oldSize = model->rowCount(parent); c.last = model->data(model->index(start - 1, 0, parent)); c.next = model->data(model->index(start, 0, parent)); insert.push(c); } /*! Confirm that what was said was going to happen actually did \sa rowsAboutToBeInserted() */ void ModelTest::rowsInserted(const QModelIndex &parent, int start, int end) { Changing c = insert.pop(); Q_ASSERT(c.parent == parent); // qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize // << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent ); // for (int ii=start; ii <= end; ii++) // { // qDebug() << "itemWasInserted:" << ii << model->data ( model->index ( ii, 0, parent )); // } // qDebug(); Q_ASSERT(c.oldSize + (end - start + 1) == model->rowCount(parent)); Q_ASSERT(c.last == model->data(model->index(start - 1, 0, c.parent))); if (c.next != model->data(model->index(end + 1, 0, c.parent))) { qDebug() << start << end; for (int i = 0; i < model->rowCount(); ++i) { qDebug() << model->index(i, 0).data().toString(); } qDebug() << c.next << model->data(model->index(end + 1, 0, c.parent)); } Q_ASSERT(c.next == model->data(model->index(end + 1, 0, c.parent))); } void ModelTest::layoutAboutToBeChanged() { for (int i = 0; i < qBound(0, model->rowCount(), 100); ++i) { changing.append(QPersistentModelIndex(model->index(i, 0))); } } void ModelTest::layoutChanged() { for (int i = 0; i < changing.count(); ++i) { QPersistentModelIndex p = changing[i]; Q_ASSERT(p == model->index(p.row(), p.column(), p.parent())); } changing.clear(); } /*! Store what is about to be inserted to make sure it actually happens \sa rowsRemoved() */ void ModelTest::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) { qDebug() << "ratbr" << parent << start << end; Changing c; c.parent = parent; c.oldSize = model->rowCount(parent); c.last = model->data(model->index(start - 1, 0, parent)); c.next = model->data(model->index(end + 1, 0, parent)); remove.push(c); } /*! Confirm that what was said was going to happen actually did \sa rowsAboutToBeRemoved() */ void ModelTest::rowsRemoved(const QModelIndex &parent, int start, int end) { qDebug() << "rr" << parent << start << end; Changing c = remove.pop(); Q_ASSERT(c.parent == parent); Q_ASSERT(c.oldSize - (end - start + 1) == model->rowCount(parent)); Q_ASSERT(c.last == model->data(model->index(start - 1, 0, c.parent))); Q_ASSERT(c.next == model->data(model->index(start, 0, c.parent))); } diff --git a/autotests/packagestructuretest.h b/autotests/packagestructuretest.h index 788d6f4cb..2b7a50728 100644 --- a/autotests/packagestructuretest.h +++ b/autotests/packagestructuretest.h @@ -1,53 +1,53 @@ /****************************************************************************** * Copyright 2007 by Aaron Seigo * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 PACKAGESTRUCTURETEST_H -#include +#include #include "plasma/package.h" class PackageStructureTest : public QObject { Q_OBJECT private Q_SLOTS: void initTestCase(); void validStructures(); void validPackages(); void copyPerformance(); void mutateAfterCopy(); void emptyContentsPrefix(); void multiplePaths(); void directories(); void requiredDirectories(); void files(); void requiredFiles(); void path(); void name(); void required(); void mimeTypes(); private: Plasma::Package ps; QString m_packagePath; }; #endif diff --git a/autotests/plasmoidpackagetest.h b/autotests/plasmoidpackagetest.h index 6c475ba94..aa5604dd8 100644 --- a/autotests/plasmoidpackagetest.h +++ b/autotests/plasmoidpackagetest.h @@ -1,56 +1,56 @@ /****************************************************************************** * Copyright 2007 by Bertjan Broeksema * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 PACKAGETEST_H -#include +#include #include "plasma/package.h" #include "plasma/packagestructure.h" class PlasmoidPackageTest : public QObject { Q_OBJECT public Q_SLOTS: void initTestCase(); void init(); void cleanup(); private Q_SLOTS: void createAndInstallPackage(); void isValid(); void filePath(); void entryList(); void packageInstalled(KJob *j); void packageUninstalled(KJob *j); private: void createTestPackage(const QString &packageName); QString m_packageRoot; QString m_package; KJob *m_packageJob; Plasma::Package m_defaultPackage; Plasma::PackageStructure *m_defaultPackageStructure; }; #endif diff --git a/autotests/pluginloadertest.cpp b/autotests/pluginloadertest.cpp index b43b93a30..9b70ee804 100644 --- a/autotests/pluginloadertest.cpp +++ b/autotests/pluginloadertest.cpp @@ -1,109 +1,109 @@ /****************************************************************************** * Copyright 2013 Sebastian Kügler * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 "pluginloadertest.h" #include #include //#include -#include +#include #include //#include #include #include QTEST_MAIN(PluginTest) PluginTest::PluginTest() : m_buildonly(false) { } void PluginTest::listEngines() { KPluginInfo::List plugins = Plasma::PluginLoader::listEngineInfo(); // foreach (const KPluginInfo& info, plugins) { //qDebug() << " Found DataEngine: " << info.pluginName() << info.name(); // } qDebug() << " Found " << plugins.count() << " DataEngines"; // Switch to true in order to let tests pass, this test usually will only // work with plugins installed, but there aren't any in plasma-framework m_buildonly = plugins.count() == 0; QVERIFY(plugins.count() > 0 || m_buildonly); } void PluginTest::listAppletCategories() { const QStringList cats = Plasma::PluginLoader::self()->listAppletCategories(); qDebug() << "Categories" << cats; QVERIFY(cats.count() > 0 || m_buildonly); } void PluginTest::listContainmentActions() { const KPluginInfo::List plugins = Plasma::PluginLoader::self()->listContainmentActionsInfo(QStringLiteral("plasma-shell")); qDebug() << "Categories: " << plugins.count(); //QVERIFY(plugins.count() > 0 || m_buildonly); } void PluginTest::listContainmentsOfType() { const KPluginInfo::List plugins = Plasma::PluginLoader::listContainmentsOfType(QStringLiteral("Desktop")); qDebug() << "Desktop Containments: " << plugins.count(); QVERIFY(plugins.count() > 0 || m_buildonly); } static const auto source = QStringLiteral("Europe/Sofia"); void EngineTest::dataUpdated(const QString &s, const Plasma::DataEngine::Data &data) { QVERIFY(source == s); QVERIFY(data["Timezone"] == source); } void PluginTest::loadDataEngine() { if (m_buildonly) { return; } QPointer engine, nullEngine; { Plasma::DataEngineConsumer consumer; engine = consumer.dataEngine(QStringLiteral("time")); nullEngine = consumer.dataEngine(QStringLiteral("noop")); QVERIFY(nullEngine && engine); QVERIFY(!nullEngine->isValid() && engine->isValid()); { EngineTest test; engine->connectSource(source, &test); QSignalSpy spy(engine, SIGNAL(sourceAdded(QString))); spy.wait(); QVERIFY(!engine->isEmpty()); } QSignalSpy spy(engine, SIGNAL(sourceRemoved(QString))); spy.wait(); QVERIFY(engine->isEmpty()); } QVERIFY(!nullEngine.isNull() && engine.isNull()); } #include "moc_pluginloadertest.cpp" diff --git a/autotests/storagetest.h b/autotests/storagetest.h index 1fc3e3eac..d29e881d3 100644 --- a/autotests/storagetest.h +++ b/autotests/storagetest.h @@ -1,42 +1,42 @@ /******************************************************************************** * Copyright 2010 by Martin Blumenstingl * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 STORAGETEST_H #define STORAGETEST_H -#include +#include class StorageTest : public QObject { Q_OBJECT public Q_SLOTS: void initTestCase(); private Q_SLOTS: void store(); void retrieve(); void deleteEntry(); private: QVariantMap m_data; }; #endif diff --git a/autotests/themetest.h b/autotests/themetest.h index 8abd18725..628ba28c7 100644 --- a/autotests/themetest.h +++ b/autotests/themetest.h @@ -1,46 +1,46 @@ /****************************************************************************** * Copyright 2016 Marco Martin * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) 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 License * * 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 THEMETEST_H #define THEMETEST_H -#include +#include #include "plasma/theme.h" #include "plasma/svg.h" class ThemeTest : public QObject { Q_OBJECT public Q_SLOTS: void initTestCase(); void cleanupTestCase(); private Q_SLOTS: void loadSvgIcon(); void testColors(); void testCompositingChange(); private: Plasma::Svg *m_svg; Plasma::Theme *m_theme; }; #endif diff --git a/src/declarativeimports/platformcomponents/platformextensionplugin.cpp b/src/declarativeimports/platformcomponents/platformextensionplugin.cpp index 1ee9d00c4..1ee1625e2 100644 --- a/src/declarativeimports/platformcomponents/platformextensionplugin.cpp +++ b/src/declarativeimports/platformcomponents/platformextensionplugin.cpp @@ -1,48 +1,48 @@ /* * Copyright (C) 2013 Ivan Cukic * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * or (at your option) any later version, as published by the Free * Software Foundation * * This program 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 General Public License for more details * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include -#include +#include #include #include "application.h" #include "icondialog.h" class PlatformComponentsPlugin: public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.kde.plasma.platformcomponents") public: PlatformComponentsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.platformcomponents")); qmlRegisterType (uri, 2, 0, "Application"); qmlRegisterType (uri, 2, 0, "IconDialog"); } }; #include "platformextensionplugin.moc"