swift
Loading...
Searching...
No Matches
testicon.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
7
8#include <QString>
9#include <QTest>
10
11#include "test.h"
12
13#include "misc/iconlist.h"
14
15using namespace swift::misc;
16
17namespace MiscTest
18{
20 class CTestIcon : public QObject
21 {
23
24 private slots:
26 void iconIndex();
27 };
28
29 void CTestIcon::iconIndex()
30 {
31 const int max = static_cast<int>(CIcons::IconIsGenerated);
32 QVERIFY2(CIcon::allIcons().size() == max, "Icon list size");
33
34 int c = 0;
35 for (const CIcon &icon : CIcon::allIcons())
36 {
37 CIcons::IconIndex ii = icon.getIndex();
38 const int i = static_cast<int>(ii);
39 if (i != c)
40 {
41 static const QString verifyMsg("Wrong index %1/%2 for icon %3");
42 qDebug() << verifyMsg.arg(i).arg(c).arg(icon.getDescriptiveText());
43 QVERIFY2(i == c, "Wrong icon index");
44 }
45 c++;
46 }
47 }
48} // namespace MiscTest
49
52
53#include "testicon.moc"
54
Testing icons.
Definition testicon.cpp:21
Value object for icons. An icon is stored in the global icon repository and identified by its index....
Definition icon.h:39
static const CSequence< CIcon > & allIcons()
All icons.
Definition icon.cpp:73
IconIndex
Index for each icon, allows to send them via DBus, efficiently store them, etc.
Definition icons.h:32
Free functions in swift::misc.
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
#define SWIFTTEST_MAIN(TestObject)
Implements a main() function that executes all tests in TestObject including instantiating a QCoreApp...
Definition test.h:57