Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
1016 B
Raw Blame
/*
 *  SPDX-FileCopyrightText: 2007 Boudewijn Rempt <[email protected]>
 *  SPDX-FileCopyrightText: 2011 Dmitry Kazakov <[email protected]>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */

#include <testutil.h>
#include <KoResource.h>
#include <KoMD5Generator.h>

namespace TestUtil
{

QStringList getHierarchy(KisNodeSP root, const QString &prefix) {
    QStringList list;

    QString nextPrefix;
    if (root->parent()) {
        nextPrefix = prefix + "+";
        list << prefix + root->name();
    }

    KisNodeSP node = root->firstChild();
    while (node) {
        list += getHierarchy(node, nextPrefix);
        node = node->nextSibling();
    }

    return list;
}

bool checkHierarchy(KisNodeSP root, const QStringList &expected)
{
    QStringList result = getHierarchy(root);
    if (result != expected) {
        qDebug() << "Failed to compare hierarchy:";
        qDebug() << "   " << ppVar(result);
        qDebug() << "   " << ppVar(expected);
        return false;
    }

    return true;
}
}