mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 11:45:40 +08:00
Split the giant test binaries into smaller unit tests
This is an intermediate step to have smaller unit tests. It is a trade off between having many many test executables compared to a few bigger ones. But this comes a lot closer to what QtTest is meant to be used.
This commit is contained in:
59
tests/blackmisc/testicon/testicon.cpp
Normal file
59
tests/blackmisc/testicon/testicon.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/* Copyright (C) 2017
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \cond PRIVATE_TESTS
|
||||
//! \file
|
||||
//! \ingroup testblackmisc
|
||||
|
||||
#include "blackmisc/iconlist.h"
|
||||
#include "test.h"
|
||||
#include <QString>
|
||||
#include <QTest>
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
//! Testing icons
|
||||
class CTestIcon : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
//! Icon order/index
|
||||
void iconIndex();
|
||||
};
|
||||
|
||||
void CTestIcon::iconIndex()
|
||||
{
|
||||
const int max = static_cast<int>(CIcons::IconIsGenerated);
|
||||
QVERIFY2(CIconList::allIcons().size() == max, "Icon list size");
|
||||
|
||||
int c = 0;
|
||||
for (const CIcon &icon : CIconList::allIcons())
|
||||
{
|
||||
CIcons::IconIndex ii = icon.getIndex();
|
||||
const int i = static_cast<int>(ii);
|
||||
if (i != c)
|
||||
{
|
||||
static const QString verifyMsg("Wrong index %1/%2 for icon %3");
|
||||
qDebug() << verifyMsg.arg(i).arg(c).arg(icon.getDescriptiveText());
|
||||
QVERIFY2(i == c, "Wrong icon index");
|
||||
}
|
||||
c++;
|
||||
}
|
||||
}
|
||||
} //namespace
|
||||
|
||||
//! main
|
||||
BLACKTEST_MAIN(BlackMiscTest::CTestIcon);
|
||||
|
||||
#include "testicon.moc"
|
||||
|
||||
//! \endcond
|
||||
Reference in New Issue
Block a user